make generating the module list its own function and fix minor things

This commit is contained in:
HikariKnight 2023-04-09 20:40:33 +02:00
parent 8312d8853c
commit e93d215669
5 changed files with 47 additions and 25 deletions

View file

@ -2,6 +2,7 @@ package configs
import (
"fmt"
"os"
"strings"
"github.com/HikariKnight/quickpassthrough/pkg/fileio"
@ -21,6 +22,15 @@ func Set_Modprobe(gpu_IDs []string) {
vfio_pci_options = append(vfio_pci_options, "disable_vga=1")
}
// Put our config file path into a string
conffile := fmt.Sprintf("%s/vfio.conf", config.Path.MODPROBE)
// If the file exists
if fileio.FileExist(conffile) {
// Delete the old file
os.Remove(conffile)
}
// Write the vfio.conf file to our modprobe config
fileio.AppendContent(
fmt.Sprint(
@ -39,9 +49,6 @@ func Set_Modprobe(gpu_IDs []string) {
"softdep amdgpu pre: vfio vfio_pci\n",
"softdep radeon pre: vfio vfio_pci\n",
),
fmt.Sprintf(
"%s/vfio.conf",
config.Path.MODPROBE,
),
conffile,
)
}