diff mbox

[Xen-devel,RFC,OSSTEST,08/19] ts-host-install: Add option to boot debian-installer in rescue mode

Message ID 1412942554-752-8-git-send-email-ian.campbell@citrix.com
State New
Headers show

Commit Message

Ian Campbell Oct. 10, 2014, 12:02 p.m. UTC
This is useful when trying to bootstrap onto a new platform, since you can log
in to an otherwise unbootable rootfs to figure out what is going wrong.

The procedure is the same as installing except "rescue/enabled=true" is added
to the command line, hence part of ts-host-install rather than separate.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
---
 Osstest/Debian.pm | 1 +
 ts-host-install   | 9 +++++++--
 2 files changed, 8 insertions(+), 2 deletions(-)

Comments

Ian Jackson Oct. 10, 2014, 2:06 p.m. UTC | #1
Ian Campbell writes ("[PATCH RFC OSSTEST 08/19] ts-host-install: Add option to boot debian-installer in rescue mode"):
> This is useful when trying to bootstrap onto a new platform, since
> you can log in to an otherwise unbootable rootfs to figure out what
> is going wrong.
> 
> The procedure is the same as installing except "rescue/enabled=true" is added
> to the command line, hence part of ts-host-install rather than separate.

Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
diff mbox

Patch

diff --git a/Osstest/Debian.pm b/Osstest/Debian.pm
index 29dec3b..8f80eb4 100644
--- a/Osstest/Debian.pm
+++ b/Osstest/Debian.pm
@@ -422,6 +422,7 @@  sub di_installcmdline_core ($$;@) {
     my $debconf_priority= $xopts{DebconfPriority};
     push @cl, "debconf/priority=$debconf_priority"
         if defined $debconf_priority;
+    push @cl, "rescue/enable=true" if $xopts{RescueMode};
 
     return @cl;
 }
diff --git a/ts-host-install b/ts-host-install
index cdbd774..7c8d693 100755
--- a/ts-host-install
+++ b/ts-host-install
@@ -30,9 +30,14 @@  my $debconf_priority;
 
 our %xopts;
 
-if (@ARGV && $ARGV[0] =~ m/^--priority(?:=(.*))?$/) {
+while (@ARGV and $ARGV[0] =~ m/^-/) {
+    $_= shift @ARGV;
+    last if m/^--$/;
+    if (m/^--priority(?:=(.*))?$/) {
     $xopts{DebconfPriority}= defined($1) ? $1 : 'low';
-    shift @ARGV;
+    } elsif  (m/^--rescue$/) {
+	$xopts{RescueMode}= 1;
+    }
 }
 
 our ($whhost) = @ARGV;