]> rtime.felk.cvut.cz Git - novaboot.git/commitdiff
Add --prefix - a more generic variant of --grub-prefix
authorMichal Sojka <sojkam1@fel.cvut.cz>
Wed, 23 Jul 2014 10:02:56 +0000 (12:02 +0200)
committerMichal Sojka <sojkam1@fel.cvut.cz>
Wed, 23 Jul 2014 10:02:56 +0000 (12:02 +0200)
--grub-prefix is now alias to --prefix.

README.md
novaboot

index cba7c4e3613ec745d193b062ef4aa3ad1a88d153..8150f9c2b37283de4f51084f069d7fdad182ddb0 100644 (file)
--- 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
index 76b48bcbf060cccc3f7c12459d1d83759ac2bad4..d5a1228603a720a5cd6735819cff61ece43a3249 100755 (executable)
--- 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<preable> 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<prefix>
+=item --prefix=I<prefix>
 
-Specifies I<prefix> that is put in front of every file name in GRUB's
-F<menu.lst>. The default value is the absolute path to the build directory.
+Specifies I<prefix> (e.g. F</srv/tftp>) that is put in front of every
+file name in generated bootloader configuration files (or in U-Boot
+commands).
 
 If the I<prefix> contains string $NAME, it will be replaced with the
 name of the novaboot script (see also B<--name>).
 
+If the I<prefix> 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<filename>]
 
 Generate GRUB2 menuentry in I<filename>. If I<filename> is not