diff --git a/Dockerfile.build b/Dockerfile.build index 3120545..5a10d4b 100644 --- a/Dockerfile.build +++ b/Dockerfile.build @@ -1,7 +1,8 @@ FROM --platform=linux/amd64 ubuntu:jammy ENV DEBIAN_FRONTEND=noninteractive -RUN apt-get update && apt-get -y install wget fdisk libarchive-tools xorriso cd-boot-images-amd64 +RUN apt-get update && apt-get -y install wget fdisk libarchive-tools xorriso cd-boot-images-amd64 git RUN mkdir /app && wget -O /app/ubuntu.iso https://releases.ubuntu.com/jammy/ubuntu-22.04.5-live-server-amd64.iso COPY build-ytl-image /app/ COPY mangle-image /app/ +COPY commit_hash /app/ COPY templates/ /app/templates/ diff --git a/Makefile b/Makefile index 836b892..329ccea 100644 --- a/Makefile +++ b/Makefile @@ -1,10 +1,12 @@ -INSTALL_IMAGE = "ytl-install-22.iso" +INSTALL_IMAGE = "app/ytl-install-22.iso" VM_NAME = YTL Linux VM_DISK_SIZE = 51200 VM_MEMORY_SIZE = 4096 docker: mkdir -p bin + pwd + git rev-parse --short HEAD > commit_hash -docker rm ytl-linux-builder docker build -t ytl-linux-build-img:latest -f Dockerfile.build . docker run -w /app --name ytl-linux-builder ytl-linux-build-img:latest ./build-ytl-image diff --git a/mangle-image b/mangle-image index 876a058..5d9a6fa 100755 --- a/mangle-image +++ b/mangle-image @@ -9,6 +9,11 @@ set -e # The main repository checkout is in the current working directory. WORKDIR="$1" +if [ -f commit_hash ]; then + COMMIT_HASH=$(cat commit_hash) +else + COMMIT_HASH="$(git rev-parse --short HEAD)" +fi ######################################### # Step 2: UEFI boot mode / GRUB @@ -18,7 +23,7 @@ sed -i '/Install Ubuntu Server/iINCLUDE_YTL_MENU' "$WORKDIR"/boot/grub/grub.cfg sed -i '/INCLUDE_YTL_MENU/r templates/ytl-grub.cfg' "$WORKDIR"/boot/grub/grub.cfg sed -i '/INCLUDE_YTL_MENU/d' "$WORKDIR"/boot/grub/grub.cfg sed -i "s|##AUTOINSTALL_URL##|$AUTOINSTALL_URL|" "$WORKDIR"/boot/grub/grub.cfg - +sed -i "s/##COMMIT_HASH##/$COMMIT_HASH/" "$WORKDIR"/boot/grub/grub.cfg # disable timeout to avoid installation loops and accidents sed -i 's/timeout=[[:digit:]]\+/timeout=-1/' "$WORKDIR"/boot/grub/grub.cfg diff --git a/templates/ytl-grub.cfg b/templates/ytl-grub.cfg index 80e2e30..f6039a2 100644 --- a/templates/ytl-grub.cfg +++ b/templates/ytl-grub.cfg @@ -1,4 +1,4 @@ -menuentry "Install YTL Ubuntu Server" { +menuentry "Install YTL Ubuntu Server | ##COMMIT_HASH##" { set gfxpayload=keep linux /casper/vmlinuz quiet nomodeset --- autoinstall ds=nocloud-net\;s=##AUTOINSTALL_URL## initrd /casper/initrd