summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Rettberg2019-03-05 09:44:10 +0100
committerSimon Rettberg2019-03-05 09:44:10 +0100
commit9f9fff3228db723be772a84ad20dd9d0ebb178de (patch)
tree9c82edebb27237a103dfef4967925615f316b47d
parentFix typo (diff)
downloadtmlite-bwlp-9f9fff3228db723be772a84ad20dd9d0ebb178de.tar.gz
tmlite-bwlp-9f9fff3228db723be772a84ad20dd9d0ebb178de.tar.xz
tmlite-bwlp-9f9fff3228db723be772a84ad20dd9d0ebb178de.zip
[*IPxe*] Copy legacy files with .0 appended (compat)
-rw-r--r--src/main/java/org/openslx/taskmanager/tasks/CompileIPxeLegacy.java5
-rw-r--r--src/main/java/org/openslx/taskmanager/tasks/CompileIPxeNew.java23
2 files changed, 24 insertions, 4 deletions
diff --git a/src/main/java/org/openslx/taskmanager/tasks/CompileIPxeLegacy.java b/src/main/java/org/openslx/taskmanager/tasks/CompileIPxeLegacy.java
index 7002be6..6e2e297 100644
--- a/src/main/java/org/openslx/taskmanager/tasks/CompileIPxeLegacy.java
+++ b/src/main/java/org/openslx/taskmanager/tasks/CompileIPxeLegacy.java
@@ -159,7 +159,10 @@ public class CompileIPxeLegacy extends AbstractTask
status.error = "Warning: could not create bootstick image";
}
try {
- FileUtils.copyFile( new File( "/opt/openslx/ipxe/src/bin/undionly.kkkpxe" ), new File( "/srv/openslx/tftp/ipxelinux.0" ) );
+ // Delete first in case it was a symlink
+ File dest = new File( "/srv/openslx/tftp/ipxelinux.0" );
+ FileUtils.deleteQuietly( dest );
+ FileUtils.copyFile( new File( "/opt/openslx/ipxe/src/bin/undionly.kkkpxe" ), dest );
} catch ( Exception e ) {
status.error = e.toString();
return false;
diff --git a/src/main/java/org/openslx/taskmanager/tasks/CompileIPxeNew.java b/src/main/java/org/openslx/taskmanager/tasks/CompileIPxeNew.java
index 2afa636..c4c0f3c 100644
--- a/src/main/java/org/openslx/taskmanager/tasks/CompileIPxeNew.java
+++ b/src/main/java/org/openslx/taskmanager/tasks/CompileIPxeNew.java
@@ -3,6 +3,9 @@ package org.openslx.taskmanager.tasks;
import java.io.File;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
@@ -34,9 +37,10 @@ public class CompileIPxeNew extends AbstractTask
/**
* Files which should be copied to the TFTP dir so they're available for netboot
*/
- private static final String[] FILES_NET = { "bin-i386-pcbios/undionly.kpxe", "bin-i386-pcbios/undionly.kkpxe",
+ private static final String[] FILES_NET = { "bin-i386-pcbios/ipxe.pxe",
+ "bin-i386-pcbios/undionly.kpxe", "bin-i386-pcbios/undionly.kkpxe",
"bin-i386-pcbios/undionly.kkkpxe", "bin-x86_64-efi/ipxe.efi", "bin-x86_64-efi/snponly.efi" };
-
+
/**
* Files which should be moved to the websrv so they're available for download
*/
@@ -123,13 +127,26 @@ public class CompileIPxeNew extends AbstractTask
}
// NETBOOT
for ( String f : FILES_NET ) {
+ String destName = new File( f ).getName();
+ if ( f.contains( "-pcbios" ) ) {
+ // Append .0 to filename, otherwise older pxelinux won't be able to chain to us
+ destName += ".0";
+ }
try {
FileUtils.copyFile( new File( "/opt/openslx/ipxe/src", f ),
- new File( "/srv/openslx/tftp", new File( f ).getName() ) );
+ new File( "/srv/openslx/tftp", destName ) );
} catch ( Exception e ) {
status.addError( "Cannot copy " + f + " to TFTP dir: " + e.toString() );
}
}
+ // Change ipxelinux.0 so old DHCP entries keep working
+ Path link = Paths.get( "/srv/openslx/tftp/ipxelinux.0" );
+ FileUtils.deleteQuietly( link.toFile() );
+ try {
+ Files.createSymbolicLink( link, Paths.get( "undionly.kpxe.0" ) );
+ } catch ( Exception e1 ) {
+ status.addError( "Could not create ipxelinux.0 symlink" );
+ }
// DOWNLOAD
for ( String f : FILES_DL ) {
try {