Skip to content

Commit f856dde

Browse files
committed
fix: Improve grub2 configuration logic
1 parent f5c71ee commit f856dde

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

internal/configs/config_bootloaders.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,9 @@ func Configure_Grub2() {
169169

170170
// Write the modules line we generated
171171
fileio.AppendContent(fmt.Sprintf("GRUB_CMDLINE_LINUX=\"%s\"\n", strings.Join(new_kernel_args, " ")), conffile)
172+
} else {
173+
// Since we have edited the GRUB_CMDLINE_LINUX_DEFAULT line, we will just clean up the non default line
174+
fileio.AppendContent(fmt.Sprintf("GRUB_CMDLINE_LINUX=\"%s\"\n", strings.Join(clean_Grub2_Args(old_kernel_args), " ")), conffile)
172175
}
173176
}
174177
} else {
@@ -187,9 +190,9 @@ func clean_Grub2_Args(old_kernel_args []string) []string {
187190

188191
// Loop through current kernel_args and add anything that isnt vfio or vendor-reset related
189192
for _, v := range old_kernel_args {
190-
// If what we find is not a vfio module or vendor-reset module
193+
// If what we find is not a vfio argument
191194
if !vfio_args_re.MatchString(v) {
192-
// Add module to module list
195+
// Add argument to the list
193196
clean_kernel_args = append(clean_kernel_args, v)
194197
}
195198
}

0 commit comments

Comments
 (0)