diff mbox

[Xen-devel,OSSTEST,v2,07/20] ts-host-install: Add option to boot debian-installer in rescue mode

Message ID 1414579302-6692-7-git-send-email-ian.campbell@citrix.com
State New
Headers show

Commit Message

Ian Campbell Oct. 29, 2014, 10:41 a.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>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
 Osstest/Debian.pm | 1 +
 ts-host-install   | 9 +++++++--
 2 files changed, 8 insertions(+), 2 deletions(-)
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 c611ed1..2f72b5f 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;