mirror of
https://github.com/HikariKnight/quickpassthrough
synced 2025-06-28 05:58:00 +02:00
Add logger debug output
This commit is contained in:
parent
27a52cda1f
commit
639d056abe
7 changed files with 71 additions and 18 deletions
|
@ -6,6 +6,7 @@ import (
|
|||
"regexp"
|
||||
"strings"
|
||||
|
||||
"github.com/HikariKnight/quickpassthrough/internal/logger"
|
||||
"github.com/HikariKnight/quickpassthrough/pkg/fileio"
|
||||
)
|
||||
|
||||
|
@ -30,6 +31,9 @@ func Set_Mkinitcpio() {
|
|||
// Read the mkinitcpio file
|
||||
mkinitcpio_content := fileio.ReadLines(sysfile)
|
||||
|
||||
// Write to logger
|
||||
logger.Printf("Read %s:\n%s", sysfile, strings.Join(mkinitcpio_content, "\n"))
|
||||
|
||||
for _, line := range mkinitcpio_content {
|
||||
// If we are at the line starting with MODULES=
|
||||
if module_line_re.MatchString(line) {
|
||||
|
@ -41,6 +45,9 @@ func Set_Mkinitcpio() {
|
|||
|
||||
// If vendor-reset is in the current modules
|
||||
if strings.Contains(line, "vendor-reset") {
|
||||
// Write to logger
|
||||
logger.Printf("vendor-reset module detected in %s\nMaking sure it will be loaded before vfio", sysfile)
|
||||
|
||||
// Add vendor-reset first
|
||||
modules = append([]string{"vendor-reset"}, modules...)
|
||||
}
|
||||
|
@ -54,6 +61,9 @@ func Set_Mkinitcpio() {
|
|||
}
|
||||
}
|
||||
|
||||
// Write to logger
|
||||
logger.Printf("Replacing line in %s:\n%s\nWith:\nMODULES=(%s)\n", config.Path.MKINITCPIO, line, strings.Join(modules, " "))
|
||||
|
||||
// Write the modules line we generated
|
||||
fileio.AppendContent(fmt.Sprintf("MODULES=(%s)\n", strings.Join(modules, " ")), config.Path.MKINITCPIO)
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue