Also detect actual current runlevel
authorJamie Cameron <jcameron@webmin.com>
Mon, 28 Feb 2011 06:16:02 +0000 (22:16 -0800)
committerJamie Cameron <jcameron@webmin.com>
Mon, 28 Feb 2011 06:16:02 +0000 (22:16 -0800)
http://www.virtualmin.com/node/17333

init/init-lib.pl

index 8ce6ba9..675d614 100755 (executable)
@@ -369,6 +369,13 @@ if ($config{"inittab_rl_$rv[0]"}) {
        @rv = split(/,/, $config{"inittab_rl_$rv[0]"});
        }
 push(@rv, $config{'inittab_extra'});
+
+# Add current runlevel. This is needed on EC2, as the boot runlevel can be
+# 4 even if inittab says 3!
+local $out = &backquote_command("who -r 2>/dev/null");
+if (!$? && $out =~ /run-level\s+(\d+)/) {
+       push(@rv, $1);
+       }
 return &unique(@rv);
 }