diff options
-rw-r--r-- | src/main/java/org/openslx/taskmanager/tasks/CompileIPxeNew.java | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/src/main/java/org/openslx/taskmanager/tasks/CompileIPxeNew.java b/src/main/java/org/openslx/taskmanager/tasks/CompileIPxeNew.java index a4b4ada..8f95f87 100644 --- a/src/main/java/org/openslx/taskmanager/tasks/CompileIPxeNew.java +++ b/src/main/java/org/openslx/taskmanager/tasks/CompileIPxeNew.java @@ -6,6 +6,7 @@ import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; +import java.nio.file.StandardCopyOption; import java.util.Collections; import java.util.HashMap; import java.util.Map; @@ -44,6 +45,16 @@ public class CompileIPxeNew extends AbstractTask private static final String[] FILES_DL = { "bin-i386-pcbios/ipxe.usb", "bin-i386-pcbios/ipxe.hd", "bin-i386-pcbios/ipxe.lkrn", "bin-x86_64-efi/ipxe.usb", "bin-x86_64-efi/ipxe.efi", "bin-x86_64-efi/snp.usb", "bin-x86_64-efi/snp.efi" }; + + /** + * Source directory for our iPXE config + */ + private static final String CONFIG_SRC_DIR = "/opt/openslx/ipxe-bwlp-config"; + + /** + * Destination directory for iPXE config + */ + private static final String CONFIG_DST_DIR = "/opt/openslx/ipxe/src/config/local/bwlp"; /** * Combination of the two, mapping each file to false. @@ -123,6 +134,11 @@ public class CompileIPxeNew extends AbstractTask } else if (cpus > 256) { // Sanity check in case it (apparently) reports nonsense cpus = 4; } + // Copy over config again + if ( !copyBwlpConfig() ) { + status.addError( "Aborting as config could not be copied to " + CONFIG_DST_DIR ); + return false; + } // Use NO_WERROR so older commits compile on newer gcc versions if ( 0 != Exec.syncAt( 600, new ProcLogger(), "/opt/openslx/ipxe/src", join( "nice", "make", "-j" + cpus, "NO_WERROR=1", "CONFIG=bwlp", @@ -165,6 +181,31 @@ public class CompileIPxeNew extends AbstractTask return true; } + private boolean copyBwlpConfig() + { + File srcDir = new File( CONFIG_SRC_DIR ); + File[] files = srcDir.listFiles(); + if ( files == null ) + return false; + File dstDir = new File( CONFIG_DST_DIR ); + try { + Files.createDirectories( dstDir.toPath() ); + } catch ( Exception e ) { + status.addError( e.getMessage() ); + return false; + } + for ( File file : files ) { + if ( !file.isFile() || !file.getName().endsWith( ".h" ) ) + continue; + try { + Files.copy( file.toPath(), new File( dstDir, file.getName() ).toPath(), StandardCopyOption.REPLACE_EXISTING ); + } catch ( Exception e ) { + status.addError( "Cannot copy: " + e.getMessage() ); + } + } + return true; + } + private String[] join(Object... stuff) { int num = 0; |