]> rtime.felk.cvut.cz Git - novaboot.git/commitdiff
Do not read the script if --on or -off is specified
authorMichal Sojka <sojkam1@fel.cvut.cz>
Sun, 16 Feb 2014 21:27:29 +0000 (22:27 +0100)
committerMichal Sojka <sojkam1@fel.cvut.cz>
Sun, 16 Feb 2014 21:27:29 +0000 (22:27 +0100)
This allows running novaboot without any script in which case
novaboot does not block in reading from stdin.

README.md
novaboot

index df5cee612db546d94ec564756f32c1186a026ed3..b89088fb3f75d2f13fd5c8a883465a109442c481 100644 (file)
--- a/README.md
+++ b/README.md
@@ -342,8 +342,8 @@ to a particular location, e.g. to a TFTP boot server or to the
 
 - \--on, --off
 
-    Switch on/off the target machine. Currently works only with
-    __\--iprelay__.
+    Switch on/off the target machine and exit. If script (if any) is
+    completely ignored. Currently works only with __\--iprelay__.
 
 - \-Q, --qemu\[=_qemu-binary_\]
 
index bbd1e08778b3d6bf1c9f24d35c9b2207ce9f428e..43496e486440d7b8e08048ff16b247ce2dcba7ed 100755 (executable)
--- a/novaboot
+++ b/novaboot
@@ -228,7 +228,8 @@ my $file;
 my $EOF;
 my $last_fn = '';
 my ($modules, $variables, $generated, $continuation);
-while (<>) {
+my $skip_reading = defined($on_opt) || defined($off_opt);
+while (!$skip_reading && ($_ = <>)) {
     if ($ARGV ne $last_fn) { # New script
        die "Missing EOF in $last_fn" if $file;
        die "Unfinished line in $last_fn" if $continuation;
@@ -1224,8 +1225,8 @@ copying files as a result of I<--server> option.
 
 =item --on, --off
 
-Switch on/off the target machine. Currently works only with
-B<--iprelay>.
+Switch on/off the target machine and exit. If script (if any) is
+completely ignored. Currently works only with B<--iprelay>.
 
 =item -Q, --qemu[=I<qemu-binary>]