From aea6e58f43f9b602bc54dcb484a41d9b1d665281 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torbj=C3=B8rn=20Lindahl?= Date: Fri, 30 Jan 2026 23:18:39 +0100 Subject: [PATCH] Fix build script paths to be relative to script location, enabling builds on any machine --- build-image.sh | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/build-image.sh b/build-image.sh index 363ec3f..ffaed62 100755 --- a/build-image.sh +++ b/build-image.sh @@ -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" \