- -t, --target=_target_
This option serves as a user configurable shortcut for other novaboot
- options. The effect of this option is the same as the options stored
- in the `%targets` configuration variable under key _target_. See
- also ["CONFIGURATION FILE"](#configuration-file).
+ options. The effect of this option is the same as specifying the
+ options stored in the `%targets` configuration variable under key
+ _target_. See also ["CONFIGURATION FILE"](#configuration-file).
+
+ When this option is not given, novaboot tries to determine the target
+ to use from either **NOVABOOT\_TARGET** environment variable or from
+ **$default\_target** configuration file variable.
## Script preprocessing phase
- $default\_target
Default target (see below) to use when no target is explicitly
- specified on command line with the **--target** option.
+ specified with the **--target** command line option or
+ **NOVABOOT\_TARGET** environment variable.
- %targets
Name of the novaboot configuration directory. When not specified
`/etc/novaboot.d` is used.
+- NOVABOOT\_TARGET
+
+ Name of the novaboot target to use. This overrides the value of
+ **$default\_target** from the configuration file and can be overriden
+ with the **--target** command line option.
+
- NOVABOOT\_BENDER
Defining this variable has the same meaning as **--bender** option.
## Command line handling
-my $explicit_target;
+my $explicit_target = $ENV{'NOVABOOT_TARGET'};
GetOptions ("target|t=s" => \$explicit_target);
my ($amt, @append, $bender, @chainloaders, $concat, $config_name_opt, $dhcp_tftp, $dump_opt, $dump_config, @exiton, $exiton_timeout, @expect_raw, $gen_only, $grub_config, $grub_prefix, $grub_preamble, $grub2_prolog, $grub2_config, $help, $ider, $interaction, $iprelay, $iso_image, $interactive, $kernel_opt, $make, $man, $no_file_gen, $off_opt, $on_opt, $pulsar, $pulsar_root, $qemu, $qemu_append, $qemu_flags_cmd, $remote_cmd, $remote_expect, $remote_expect_silent, $reset, $reset_cmd, $rom_prefix, $rsync_flags, @scriptmod, $scons, $serial, $server, $stty, $tftp, $tftp_port, $uboot, %uboot_addr, $uboot_cmd, @uboot_init);
=item -t, --target=I<target>
This option serves as a user configurable shortcut for other novaboot
-options. The effect of this option is the same as the options stored
-in the C<%targets> configuration variable under key I<target>. See
-also L</"CONFIGURATION FILE">.
+options. The effect of this option is the same as specifying the
+options stored in the C<%targets> configuration variable under key
+I<target>. See also L</"CONFIGURATION FILE">.
+
+When this option is not given, novaboot tries to determine the target
+to use from either B<NOVABOOT_TARGET> environment variable or from
+B<$default_target> configuration file variable.
=back
=item $default_target
Default target (see below) to use when no target is explicitly
-specified on command line with the B<--target> option.
+specified with the B<--target> command line option or
+B<NOVABOOT_TARGET> environment variable.
=item %targets
Name of the novaboot configuration directory. When not specified
F</etc/novaboot.d> is used.
+=item NOVABOOT_TARGET
+
+Name of the novaboot target to use. This overrides the value of
+B<$default_target> from the configuration file and can be overriden
+with the B<--target> command line option.
+
=item NOVABOOT_BENDER
Defining this variable has the same meaning as B<--bender> option.
WVPASS sh -c "./script --target=t1 2>&1 |tee output"
WVPASS grep -q "Error in target definition" output
+WVSTART Different ways of specifying target
+cat > .novaboot <<'EOF'
+%targets = ('t1' => '--remote-cmd="echo Target1 > t"',
+ 't2' => '--remote-cmd="echo Target2 > t"',
+ 't3' => '--remote-cmd="echo Target3 > t"');
+$default_target = 't1';
+EOF
+WVPASSSH 'novaboot /dev/null'
+WVPASS test "$(cat t)" = Target1
+WVPASSSH 'NOVABOOT_TARGET=t2 novaboot /dev/null'
+WVPASS test "$(cat t)" = Target2
+WVPASSSH 'NOVABOOT_TARGET=t2 novaboot --target t3 /dev/null'
+WVPASS test "$(cat t)" = Target3
+
# Hi-lock: (("^.*\\(?:WVSTART\\).*$" (0 (quote hi-black-b) t)))