2
0
mirror of https://github.com/linka-cloud/d2vm.git synced 2026-06-09 13:35:45 +00:00

fix: remove unused parameters from grub cmdline

Signed-off-by: Adphi <philippe.adrien.nousse@gmail.com>
This commit is contained in:
2026-05-07 09:19:15 +02:00
parent 58739c9f1b
commit ece3ff4745
9 changed files with 38 additions and 20 deletions
+14 -4
View File
@@ -60,11 +60,21 @@ type Config struct {
}
func (c Config) Cmdline(root Root, args ...string) string {
var r string
if root != nil {
r = fmt.Sprintf("root=%s", root.String())
cmdline := "net.ifnames=0 rootfstype=ext4 console=tty0 console=ttyS0,115200n8"
if c.Kernel == "" && c.Initrd == "" {
return cmdline
}
return fmt.Sprintf("ro initrd=%s %s net.ifnames=0 rootfstype=ext4 console=tty0 console=ttyS0,115200n8 %s", c.Initrd, r, strings.Join(args, " "))
parts := []string{"ro"}
if root != nil {
parts = append(parts, fmt.Sprintf("root=%s", root.String()))
}
if c.Initrd != "" {
parts = append(parts, fmt.Sprintf("initrd=%s", c.Initrd))
}
if len(args) != 0 {
parts = append(parts, args...)
}
return strings.Join(append(parts, cmdline), " ")
}
func (r OSRelease) Config() (Config, error) {