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" \