From a681ff350ec43fecb002f51b43ba305eca3d22ec Mon Sep 17 00:00:00 2001 From: Michal Sojka Date: Tue, 16 Dec 2014 13:30:13 +0100 Subject: [PATCH] Add --no-final-eol option --- README.md | 8 ++++++++ novaboot | 16 +++++++++++++--- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 031d56a..6f26ec1 100644 --- a/README.md +++ b/README.md @@ -583,6 +583,14 @@ interactive work with the target. Example: `--expect='Continue?' --sendcont='yes\n'` +- --final-eol, --no-final-eol + + By default, **novaboot** always prints an end-of-line character at the + end of its execution in order to ensure that the output of programs + started after novaboot appears at the beginning of the line. When this + is not desired **--no-final-eol** option can be used to override this + behavior. + # NOVABOOT SCRIPT SYNTAX The syntax tries to mimic POSIX shell syntax. The syntax is defined diff --git a/novaboot b/novaboot index 3c653c3..1153458 100755 --- a/novaboot +++ b/novaboot @@ -120,19 +120,20 @@ read_config($_) foreach $cfg or @cfgs; 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); +my ($amt, @append, $bender, @chainloaders, $concat, $config_name_opt, $dhcp_tftp, $dump_opt, $dump_config, @exiton, $exiton_timeout, @expect_raw, $final_eol, $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); +# Default values of certain command line options %uboot_addr = ( 'kernel' => '${kernel_addr_r}', 'ramdisk' => '${ramdisk_addr_r}', 'fdt' => '${fdt_addr_r}', ); - $rsync_flags = ''; $rom_prefix = 'rom://'; $stty = 'raw -crtscts -onlcr 115200'; $reset = 1; # Reset target by default $interaction = 1; # Perform target interaction by default +$final_eol = 1; my @expect_seen = (); sub handle_expect @@ -169,6 +170,7 @@ my %opt_spec; "expect=s" => \&handle_expect, "expect-re=s" => \&handle_expect, "expect-raw=s" => sub { my ($n, $v) = @_; unshift(@expect_raw, eval($v)); }, + "final-eol!" => \$final_eol, "gen-only" => \$gen_only, "grub|g:s" => \$grub_config, "grub-preamble=s"=> \$grub_preamble, @@ -1172,7 +1174,7 @@ if (defined $dhcp_tftp || defined $tftp) { } # Always finish novaboot output with newline -print "\n"; +print "\n" if $final_eol; ## Documentation @@ -1820,6 +1822,14 @@ Similar to B<--send> but continue expecting more input. Example: C<--expect='Continue?' --sendcont='yes\n'> +=item --final-eol, --no-final-eol + +By default, B always prints an end-of-line character at the +end of its execution in order to ensure that the output of programs +started after novaboot appears at the beginning of the line. When this +is not desired B<--no-final-eol> option can be used to override this +behavior. + =back =head1 NOVABOOT SCRIPT SYNTAX -- 2.39.2