From 8e5eba0ac50f85a84bb0c072721b9cca27711da7 Mon Sep 17 00:00:00 2001 From: Sven Dowideit Date: Wed, 18 Jan 2017 10:50:37 +1000 Subject: [PATCH 1/4] add --debug logging option to installer, and a dummy set-disk-partitions Signed-off-by: Sven Dowideit --- cmd/control/install.go | 11 +++++++++++ log/log.go | 7 +++++++ scripts/installer/BaseDockerfile.amd64 | 5 +++++ scripts/installer/Dockerfile.amd64 | 2 -- 4 files changed, 23 insertions(+), 2 deletions(-) diff --git a/cmd/control/install.go b/cmd/control/install.go index cd438056..82368175 100755 --- a/cmd/control/install.go +++ b/cmd/control/install.go @@ -74,6 +74,10 @@ var installCommand = cli.Command{ Name: "kexec", Usage: "reboot using kexec", }, + cli.BoolFlag{ + Name: "debug", + Usage: "Run installer with debug output", + }, }, } @@ -81,6 +85,13 @@ func installAction(c *cli.Context) error { if c.Args().Present() { log.Fatalf("invalid arguments %v", c.Args()) } + + if c.Bool("debug") { + originalLevel := log.GetLevel() + defer log.SetLevel(originalLevel) + log.SetLevel(log.DebugLevel) + } + kappend := strings.TrimSpace(c.String("append")) force := c.Bool("force") kexec := c.Bool("kexec") diff --git a/log/log.go b/log/log.go index 4b905a4d..b9339e91 100755 --- a/log/log.go +++ b/log/log.go @@ -46,6 +46,13 @@ func SetLevel(level Level) { } } +func GetLevel() Level { + if userHook != nil { + return Level(userHook.Level) + } + return Level(appLog.Level) +} + func Debugf(format string, args ...interface{}) { appLog.Debugf(format, args...) } diff --git a/scripts/installer/BaseDockerfile.amd64 b/scripts/installer/BaseDockerfile.amd64 index 2bfd7198..4bdb267d 100644 --- a/scripts/installer/BaseDockerfile.amd64 +++ b/scripts/installer/BaseDockerfile.amd64 @@ -19,5 +19,10 @@ COPY ./build/ros /bin/ RUN ln -s /bootiso/boot/ /dist +# need to make a /scripts/set-disk-partitions so that older releases can call the installer +RUN echo "#!/bin/sh" > /scripts/set-disk-partitions \ + && echo "echo 'set-disk-partitions deprecated'" >> /scripts/set-disk-partitions \ + && chmod 755 /scripts/set-disk-partitions + ENTRYPOINT ["/bin/ros", "install"] diff --git a/scripts/installer/Dockerfile.amd64 b/scripts/installer/Dockerfile.amd64 index ddd1fbfa..2b837420 100755 --- a/scripts/installer/Dockerfile.amd64 +++ b/scripts/installer/Dockerfile.amd64 @@ -4,6 +4,4 @@ FROM rancher/os-installer RUN rm /dist/ \ && mkdir -p /dist/ -#COPY ./ros /bin/ COPY ./boot/ /dist/ - From 7765a3308d177b2687f7e6a0f7f4bf4ca893cdd9 Mon Sep 17 00:00:00 2001 From: Sven Dowideit Date: Wed, 18 Jan 2017 01:44:42 +0000 Subject: [PATCH 2/4] work around 'No help topic found' issue calling set-disk-partitions script on older RancherOS Signed-off-by: Sven Dowideit --- scripts/installer/BaseDockerfile.amd64 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/installer/BaseDockerfile.amd64 b/scripts/installer/BaseDockerfile.amd64 index 4bdb267d..8b8ca204 100644 --- a/scripts/installer/BaseDockerfile.amd64 +++ b/scripts/installer/BaseDockerfile.amd64 @@ -24,5 +24,8 @@ RUN echo "#!/bin/sh" > /scripts/set-disk-partitions \ && echo "echo 'set-disk-partitions deprecated'" >> /scripts/set-disk-partitions \ && chmod 755 /scripts/set-disk-partitions +# work around some really weird ros symptoms +RUN rm -rf /sbin/poweroff /sbin/shutdown /sbin/reboot /sbin/halt /usr/sbin/poweroff /usr/sbin/shutdown /usr/sbin/reboot /usr/sbin/halt + ENTRYPOINT ["/bin/ros", "install"] From fc1e4e060d5e63f97becee67f2236b6feeaba66c Mon Sep 17 00:00:00 2001 From: Sven Dowideit Date: Wed, 18 Jan 2017 02:08:16 +0000 Subject: [PATCH 3/4] Don't prompt for user input when we're not interactive Signed-off-by: Sven Dowideit --- cmd/control/install.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/control/install.go b/cmd/control/install.go index 82368175..7fbdbda8 100755 --- a/cmd/control/install.go +++ b/cmd/control/install.go @@ -154,7 +154,7 @@ func runInstall(image, installType, cloudConfig, device, kappend string, force, fmt.Printf("Installing from %s\n", image) if !force { - if !yes("Continue") { + if util.IsRunningInTty() && !yes("Continue") { log.Infof("Not continuing with installation due to user not saying 'yes'") os.Exit(1) } From ff32d2d34c51599aa8010cc7a6bebc75ef1cb7c2 Mon Sep 17 00:00:00 2001 From: Sven Dowideit Date: Wed, 18 Jan 2017 03:18:43 +0000 Subject: [PATCH 4/4] avoid kmsg ratelimiting for now Signed-off-by: Sven Dowideit --- scripts/global.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/global.cfg b/scripts/global.cfg index 398454af..3f0206f6 100755 --- a/scripts/global.cfg +++ b/scripts/global.cfg @@ -1 +1 @@ -APPEND rancher.autologin=tty1 rancher.autologin=ttyS0 console=tty0 console=ttyS0 ${APPEND} +APPEND rancher.autologin=tty1 rancher.autologin=ttyS0 console=tty0 console=ttyS0 printk.devkmsg=on ${APPEND}