From 27dbb6fe4ab4ea49ea60809d4b1cdb98587e2b72 Mon Sep 17 00:00:00 2001 From: Michal Sojka Date: Wed, 23 Jul 2014 12:02:56 +0200 Subject: [PATCH] Add --prefix - a more generic variant of --grub-prefix --grub-prefix is now alias to --prefix. --- README.md | 14 +++++++++++--- novaboot | 25 ++++++++++++++++++------- 2 files changed, 29 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index cba7c4e..8150f9c 100644 --- a/README.md +++ b/README.md @@ -201,14 +201,22 @@ running `scons` or `make`. GRUB or GRUB2 config files. This is useful for specifying GRUB's timeout. -- --grub-prefix=_prefix_ +- --prefix=_prefix_ - Specifies _prefix_ that is put in front of every file name in GRUB's - `menu.lst`. The default value is the absolute path to the build directory. + Specifies _prefix_ (e.g. `/srv/tftp`) that is put in front of every + file name in generated bootloader configuration files (or in U-Boot + commands). If the _prefix_ contains string $NAME, it will be replaced with the name of the novaboot script (see also **--name**). + If the _prefix_ contains string $BUILDDIR, it will be replaced with + the build directory (see also **--build-dir**). + +- --grub-prefix + + Alias for **--prefix**. + - --grub2\[=_filename_\] Generate GRUB2 menuentry in _filename_. If _filename_ is not diff --git a/novaboot b/novaboot index 76b48bc..d5a1228 100755 --- a/novaboot +++ b/novaboot @@ -149,7 +149,7 @@ my %opt_spec; "gen-only" => \$gen_only, "grub|g:s" => \$grub_config, "grub-preamble=s"=> \$grub_preamble, - "grub-prefix=s" => \$grub_prefix, + "prefix|grub-prefix=s" => \$grub_prefix, "grub2:s" => \$grub2_config, "grub2-prolog=s" => \$grub2_prolog, "ider" => \$ider, @@ -747,6 +747,7 @@ if (defined $builddir) { ## File generation phase my (%files_iso, $menu_iso, $filename); my $config_name = ''; +my $prefix = ''; foreach my $script (@scripts) { $filename = $$script{filename}; @@ -763,9 +764,11 @@ foreach my $script (@scripts) { print "novaboot: Entering directory `$builddir'\n"; } - my $prefix; - ($prefix = $grub_prefix) =~ s/\$NAME/$config_name/ if defined $grub_prefix; - $prefix ||= $builddir; + if ($grub_prefix) { + $prefix = $grub_prefix; + $prefix =~ s/\$NAME/$config_name/; + $prefix =~ s/\$BUILDDIR/$builddir/; + } # TODO: use $grub_prefix as first parameter if some switch is given generate_configs('', $generated, $filename); @@ -1306,14 +1309,22 @@ Specifies the I that is at the beginning of the generated GRUB or GRUB2 config files. This is useful for specifying GRUB's timeout. -=item --grub-prefix=I +=item --prefix=I -Specifies I that is put in front of every file name in GRUB's -F. The default value is the absolute path to the build directory. +Specifies I (e.g. F) that is put in front of every +file name in generated bootloader configuration files (or in U-Boot +commands). If the I contains string $NAME, it will be replaced with the name of the novaboot script (see also B<--name>). +If the I contains string $BUILDDIR, it will be replaced with +the build directory (see also B<--build-dir>). + +=item --grub-prefix + +Alias for B<--prefix>. + =item --grub2[=I] Generate GRUB2 menuentry in I. If I is not -- 2.39.2