Fix build script paths to be relative to script location, enabling builds on any machine

This commit is contained in:
2026-01-30 23:18:39 +01:00
parent e9954c8ae8
commit aea6e58f43

View File

@@ -4,9 +4,12 @@
set -e
BUILD_DIR="/srv/netboot/build"
IMAGE_DIR="/srv/netboot/images"
HTTP_DIR="/srv/netboot/http"
# Get the directory where this script is located (works on any machine)
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
BUILD_DIR="$SCRIPT_DIR/build"
IMAGE_DIR="$SCRIPT_DIR/images"
HTTP_DIR="$SCRIPT_DIR/http"
VERSION=$(date +%Y%m%d-%H%M)
echo "Building netboot image version $VERSION"
@@ -204,7 +207,7 @@ echo "Building custom netboot initramfs..."
KERNEL_VERSION=$(ls -1 $BUILD_DIR/rootfs/boot/vmlinuz-* | sed 's|.*/vmlinuz-||' | head -1)
# Use mkinitramfs with custom initramfs directory
INITRAMFS_CONFIG="/srv/netboot/initramfs"
INITRAMFS_CONFIG="$SCRIPT_DIR/initramfs"
if [ -d "$INITRAMFS_CONFIG" ]; then
mkinitramfs -d "$INITRAMFS_CONFIG" \
-k "$KERNEL_VERSION" \