From: Michal Sojka Date: Sun, 16 Feb 2014 21:27:29 +0000 (+0100) Subject: Do not read the script if --on or -off is specified X-Git-Tag: 20140513~14 X-Git-Url: http://rtime.felk.cvut.cz/gitweb/novaboot.git/commitdiff_plain/2eb9c511dcbff5520b014313a70fc17d98dbb38a Do not read the script if --on or -off is specified This allows running novaboot without any script in which case novaboot does not block in reading from stdin. --- diff --git a/README.md b/README.md index df5cee6..b89088f 100644 --- 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_\] diff --git a/novaboot b/novaboot index bbd1e08..43496e4 100755 --- 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]