]> rtime.felk.cvut.cz Git - novaboot.git/commitdiff
Remove $iprelay configuration variable
authorMichal Sojka <sojkam1@fel.cvut.cz>
Sun, 20 Oct 2013 23:47:50 +0000 (01:47 +0200)
committerMichal Sojka <sojkam1@fel.cvut.cz>
Sun, 20 Oct 2013 23:47:50 +0000 (01:47 +0200)
Also improve --on/--off handling.

README.md
novaboot

index 1f878c8113b652c1ba00195c8721a4170a49d107..fc3ed73f29876b4e02505c1e3c4b7e214b670a0f 100644 (file)
--- a/README.md
+++ b/README.md
@@ -36,7 +36,7 @@ configuration specified in the _script_.
 bootloaders are GRUB, GRUB2 and Pulsar) and copy it with all other
 files needed for booting to another, perhaps remote, location.
 
-        ./script --server --iprelay
+        ./script --server --iprelay=192.168.1.2
 
     This command copies files to a TFTP server specified in the
     configuration file and uses TCP/IP-controlled relay to reset the test
@@ -277,22 +277,17 @@ to a particular location, e.g. to a TFTP boot server or to the
 
 ## Target power-on and reset phase
 
-- \--iprelay\[=addr or cmd\]
+- \--iprelay=_addr\[:port\]_
 
-    If no _cmd_ is given, use IP relay to reset the machine and to get
-    the serial output. The IP address of the relay is given by _addr_
-    parameter if specified or by $iprelay\_addr variable in the
-    configuration file.
-
-    If _cmd_ is one of "on" or "off", the IP relay is used to press power
-    button for a short (in case of "on") or long (in case of "off") time.
-    Then, novaboot exits.
+    Use IP relay to reset the machine and to get the serial output. The IP
+    address of the relay is given by _addr_ parameter.
 
     Note: This option is expected to work with HWG-ER02a IP relays.
 
 - \--on, --off
 
-    Synonym for --iprelay=on/off.
+    Switch on/off the target machine. Currently works only with
+    __\--iprelay__.
 
 - \-Q, --qemu=_qemu-binary_
 
@@ -458,11 +453,6 @@ override the environment variables.
 
     Defining this variable has the same meaning as __\--bender__ option.
 
-- NOVABOOT\_IPRELAY
-
-    The IP address (and optionally the port) of the IP relay. This
-    overrides $iprelay\_addr variable from the configuration file.
-
 # AUTHORS
 
 Michal Sojka <sojka@os.inf.tu-dresden.de>
index a48f19235394cea2466d3b871ecf0ccee5b48f1c..7d55e9de791596dd6317f38b994feef56e5726c7 100755 (executable)
--- a/novaboot
+++ b/novaboot
@@ -40,7 +40,6 @@ chomp(my $gittop = `git rev-parse --show-toplevel 2>/dev/null`);
 $CFG::hypervisor = "";
 $CFG::hypervisor_params = "serial";
 $CFG::genisoimage = "genisoimage";
-$CFG::iprelay_addr = '141.76.48.80:2324'; #'141.76.48.252';
 $CFG::qemu = 'qemu';
 @CFG::chainloaders = (); #('bin/boot/bender promisc'); # TODO: convert to option
 $CFG::pulsar_root = '';         # TODO: convert to option
@@ -110,7 +109,7 @@ my %opt_spec;
     "grub-prefix=s"  => \$grub_prefix,
     "grub2:s"       => \$grub2_config,
     "grub2-prolog=s" => \$grub2_prolog,
-    "iprelay:s"             => \$iprelay,
+    "iprelay=s"             => \$iprelay,
     "iso|i:s"       => \$iso_image,
     "name=s"        => \$config_name_opt,
     "no-file-gen"    => \$no_file_gen,
@@ -138,9 +137,6 @@ pod2usage(-exitstatus => 0, -verbose => 2) if $man;
 
 ### Sanitize configuration
 
-$CFG::iprelay_addr = $ENV{'NOVABOOT_IPRELAY'} if $ENV{'NOVABOOT_IPRELAY'};
-if ($iprelay && $iprelay ne "on" && $iprelay ne "off") { $CFG::iprelay_addr = $iprelay; }
-
 if (defined $config_name_opt && scalar(@ARGV) > 1) { die "You cannot use --name with multiple scripts"; }
 
 if ($qemu) { $CFG::qemu = $qemu; }
@@ -180,9 +176,6 @@ if (defined $grub2_config) {
     $grub2_config ||= "grub.cfg";
 }
 
-if ($on_opt) { $iprelay="on"; }
-if ($off_opt) { $iprelay="off"; }
-
 ## Parse the novaboot script(s)
 my @scripts;
 my $file;
@@ -381,7 +374,7 @@ if (exists $variables->{WVDESC}) {
 
 my $IPRELAY;
 if (defined $iprelay) {
-    $CFG::iprelay_addr =~ /([.0-9]+)(:([0-9]+))?/;
+    $iprelay =~ /([.0-9]+)(:([0-9]+))?/;
     my $addr = $1;
     my $port = $3 || 23;
     my $paddr   = sockaddr_in($port, inet_aton($addr));
@@ -459,11 +452,12 @@ if (defined $iprelay) {
     }
 }
 
-if ($iprelay && ($iprelay eq "on" || $iprelay eq "off")) {
+if ($iprelay && (defined $on_opt || defined $off_opt)) {
      relay(1, 1); # Press power button
-    if ($iprelay eq "on") {
+    if (defined $on_opt) {
        usleep(100000);         # Short press
     } else {
+       print "novaboot: Switching the target off...\n";
        usleep(6000000);        # Long press to switch off
     }
     print $IPRELAY relay(1, 0);
@@ -749,7 +743,7 @@ Create a bootloader configuration file (currently supported
 bootloaders are GRUB, GRUB2 and Pulsar) and copy it with all other
 files needed for booting to another, perhaps remote, location.
 
- ./script --server --iprelay
+ ./script --server --iprelay=192.168.1.2
 
 This command copies files to a TFTP server specified in the
 configuration file and uses TCP/IP-controlled relay to reset the test
@@ -1018,22 +1012,17 @@ itself.
 
 =over 8
 
-=item --iprelay[=addr or cmd]
-
-If no I<cmd> is given, use IP relay to reset the machine and to get
-the serial output. The IP address of the relay is given by I<addr>
-parameter if specified or by $iprelay_addr variable in the
-configuration file.
+=item --iprelay=I<addr[:port]>
 
-If I<cmd> is one of "on" or "off", the IP relay is used to press power
-button for a short (in case of "on") or long (in case of "off") time.
-Then, novaboot exits.
+Use IP relay to reset the machine and to get the serial output. The IP
+address of the relay is given by I<addr> parameter.
 
 Note: This option is expected to work with HWG-ER02a IP relays.
 
 =item --on, --off
 
-Synonym for --iprelay=on/off.
+Switch on/off the target machine. Currently works only with
+B<--iprelay>.
 
 =item -Q, --qemu=I<qemu-binary>
 
@@ -1216,11 +1205,6 @@ one(s).
 
 Defining this variable has the same meaning as B<--bender> option.
 
-=item NOVABOOT_IPRELAY
-
-The IP address (and optionally the port) of the IP relay. This
-overrides $iprelay_addr variable from the configuration file.
-
 =back
 
 =head1 AUTHORS