diff --git a/cmd/control/os.go b/cmd/control/os.go index b24bab6e..b41ab3aa 100644 --- a/cmd/control/os.go +++ b/cmd/control/os.go @@ -54,6 +54,10 @@ func osSubcommands() []cli.Command { Name: "kexec", Usage: "reboot using kexec", }, + cli.StringFlag{ + Name: "append", + Usage: "kernel args to append by kexec", + }, }, }, { @@ -153,7 +157,7 @@ func osUpgrade(c *cli.Context) { if c.Args().Present() { log.Fatalf("invalid arguments %v", c.Args()) } - if err := startUpgradeContainer(image, c.Bool("stage"), c.Bool("force"), !c.Bool("no-reboot"), c.Bool("kexec")); err != nil { + if err := startUpgradeContainer(image, c.Bool("stage"), c.Bool("force"), !c.Bool("no-reboot"), c.Bool("kexec"), c.String("append")); err != nil { log.Fatal(err) } } @@ -172,7 +176,7 @@ func yes(in *bufio.Reader, question string) bool { return strings.ToLower(line[0:1]) == "y" } -func startUpgradeContainer(image string, stage, force, reboot, kexec bool) error { +func startUpgradeContainer(image string, stage, force, reboot, kexec bool, kernelArgs string) error { in := bufio.NewReader(os.Stdin) command := []string{ @@ -182,6 +186,11 @@ func startUpgradeContainer(image string, stage, force, reboot, kexec bool) error if kexec { command = append(command, "-k") + + kernelArgs = strings.TrimSpace(kernelArgs) + if kernelArgs != "" { + command = append(command, "-a", kernelArgs) + } } container, err := compose.CreateService(nil, "os-upgrade", &project.ServiceConfig{ diff --git a/scripts/installer/lay-down-os b/scripts/installer/lay-down-os index 9bd0f4cb..eef3f7e1 100755 --- a/scripts/installer/lay-down-os +++ b/scripts/installer/lay-down-os @@ -6,7 +6,7 @@ SCRIPTS_DIR=$(dirname ${0}) . "${SCRIPTS_DIR}/build.conf" VERSION=${VERSION:?"VERSION not set"} -while getopts "i:f:c:d:t:r:o:p:k" OPTION +while getopts "i:f:c:d:t:r:o:p:k:a" OPTION do case ${OPTION} in i) DIST="$OPTARG" ;; @@ -17,6 +17,7 @@ do p) PARTITION="$OPTARG" ;; r) ROLLBACK_VERSION="$OPTARG" ;; k) KEXEC=y ;; + a) APPEND="$OPTARG" ;; t) ENV="$OPTARG" ;; *) exit 1 ;; esac @@ -195,5 +196,8 @@ pvgrub_config "${KERNEL_ARGS}" install_rancher if [ "$KEXEC" = "y" ]; then - kexec -l ${DIST}/vmlinuz --initrd=${DIST}/initrd -f + if [ "$APPEND" = "" ]; then + APPEND=$(cat /proc/cmdline) + fi + kexec -l ${DIST}/vmlinuz --initrd=${DIST}/initrd --append="$APPEND" -f fi