Browse Source

[contrib] Fix rom-o-matic git version number issues

Fixes issue in which git version number is not displayed on startup
when iPXE is built through rom-o-matic.

Remove special characters from filename generated by rom-o-matic (so
that you get "ipxe-1.0.0+c3b4-undionly.kkpxe" instead of
"ipxe-1.0.0+ (c3b4)-undionly.kkpxe")

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Floris Bos 9 years ago
parent
commit
ee3636370d
1 changed files with 7 additions and 2 deletions
  1. 7
    2
      contrib/rom-o-matic/build.php

+ 7
- 2
contrib/rom-o-matic/build.php View File

@@ -179,7 +179,12 @@ if ( $embedded_script != "" ) {
179 179
 
180 180
 // Make the requested image.  $status is set to 0 on success
181 181
 $make_target = "bin/${nic}.${fmt_extension}";
182
-$make_cmd = "make -C '$build_dir' '$make_target' $emb_script_cmd 2>&1";
182
+$gitversion = exec('git describe --always --abbrev=1 --match "" 2>/dev/null');
183
+if ($gitversion) {
184
+	$gitversion = "GITVERSION=$gitversion";
185
+}
186
+
187
+$make_cmd = "make -C '$build_dir' '$make_target' $gitversion $emb_script_cmd 2>&1";
183 188
 
184 189
 exec ( $make_cmd, $maketxt, $status );
185 190
 
@@ -239,7 +244,7 @@ if ( $status == 0 ) {
239 244
             // Delete build directory as soon as it is not needed
240 245
             rm_build_dir ();
241 246
 
242
-            $output_filename = "ipxe-${version}-${nic}.${fmt_extension}";
247
+            $output_filename = preg_replace('/[^a-z0-9\+\.\-]/i', '', "ipxe-${version}-${nic}.${fmt_extension}");
243 248
 
244 249
             // Try to force IE to handle downloading right.
245 250
             Header ( "Cache-control: private");

Loading…
Cancel
Save