diff --git a/build-iso.sh b/build-iso.sh index ca52040..ccf8d53 100755 --- a/build-iso.sh +++ b/build-iso.sh @@ -138,17 +138,21 @@ GRUBENTRY mv "$WORK_DIR/grub_merged.cfg" "$GRUB_CFG" fi +EFI_LINE=$(fdisk -l "$UBUNTU_ISO" | grep "EFI System") +EFI_START=$(echo "$EFI_LINE" | awk '{print $(NF-5)}') +EFI_END=$(echo "$EFI_LINE" | awk '{print $(NF-4)}') +EFI_COUNT=$((EFI_END - EFI_START + 1)) + # ── Repack ISO ───────────────────────────────────────────────────────────────── -info "Repacking ISO → $OUTPUT_ISO ..." xorriso -as mkisofs \ -r -V "Ubuntu-AutoInstall" -o "$OUTPUT_ISO" \ -J -joliet-long \ - --grub2-mbr "$WORK_DIR/mbr_template.bin" \ + --grub2-mbr --interval:local_fs:0s-15s:zero_mbrpt,zero_gpt:"$UBUNTU_ISO" \ --protective-msdos-label \ -partition_offset 16 \ --mbr-force-bootable \ -append_partition 2 28732ac11ff8d211ba4b00a0c93ec93b \ - --interval:local_fs:1s-300s::"$UBUNTU_ISO" \ + --interval:local_fs:${EFI_START}d-${EFI_END}d::"$UBUNTU_ISO" \ -appended_part_as_gpt \ -iso_mbr_part_type a2a0d0ebe5b9334487c068b6b72699c7 \ -c '/boot.catalog' \ @@ -156,8 +160,9 @@ xorriso -as mkisofs \ -no-emul-boot -boot-load-size 4 -boot-info-table \ --grub2-boot-info \ -eltorito-alt-boot \ - -e '--interval:appended_partition_2:::' \ + -e "--interval:appended_partition_2_start_${EFI_START}s_size_${EFI_COUNT}d:all::" \ -no-emul-boot \ + -boot-load-size $EFI_COUNT \ "$WORK_DIR/iso" info "Done! ✓" diff --git a/deployment/post-install.sh b/deployment/post-install.sh index f2ff014..91b14e7 100755 --- a/deployment/post-install.sh +++ b/deployment/post-install.sh @@ -127,7 +127,7 @@ function displaylink_driver() { } function zscaler() { - apt install /home/${TARGET_USER}/zscaler-client_3.7.1.71-1_amd64.deb -y + apt install /home/${TARGET_USER}/nocloud/zscaler-client_3.7.1.71-1_amd64.deb -y echo zscaler >>/tmp/installer } diff --git a/qemu.sh b/qemu.sh new file mode 100644 index 0000000..1afccb3 --- /dev/null +++ b/qemu.sh @@ -0,0 +1,31 @@ +set -ex +last_autoinstaller=$(ls -t1 autoinstall-2026* | head -n1) + +echo " ....... $last_autoinstaller" +sleep 1 + +# qemu-system-x86_64 \ +# -m 2048 \ +# -enable-kvm \ +# -drive file=${last_autoinstaller},format=raw,if=none,id=usbdisk \ +# -device usb-ehci \ +# -device usb-storage,drive=usbdisk \ +# -bios /usr/share/ovmf/OVMF.fd + +_cdrom="" +if [[ "$1" = "cdrom" ]]; then + _cdrom="-drive file=${last_autoinstaller},format=raw,if=none,id=usbdisk + -device usb-ehci \ + -device usb-storage,drive=usbdisk \ + " +fi + +# Create a virtual disk first +# qemu-img create -f qcow2 /tmp/test-disk.qcow2 20G + +# Boot the ISO as USB with the virtual disk as install target +qemu-system-x86_64 \ + -m 4096 \ + -enable-kvm \ + -drive file=/tmp/test-disk.qcow2,format=qcow2 $_cdrom \ + -bios /usr/share/ovmf/OVMF.fd diff --git a/templates/user-data.tmpl b/templates/user-data.tmpl index e0d114b..68d0d30 100644 --- a/templates/user-data.tmpl +++ b/templates/user-data.tmpl @@ -1,6 +1,7 @@ #cloud-config autoinstall: version: 1 + timezone: Europe/Budapest # Network configuration – Ethernet + optional Wi‑Fi network: @@ -14,8 +15,9 @@ autoinstall: # ─── IDENTITY ────────────────────────────────────────────────────────────── identity: - hostname: nokia + hostname: nokia-l13g4-sisu username: alfoldi + realname: "Zsolt Alfoldi" password: "${USER_PASSWORD_HASH}" # ─── SSH ─────────────────────────────────────────────────────────────────── @@ -66,6 +68,17 @@ autoinstall: encoding: b64 content: "${NOKIA_CLIENT_KEY_B64}" + - path: /home/${TARGET_USER}/first_install.sh + permissions: "0755" + owner: ${TARGET_USER}:${TARGET_USER} + content: | + if [[ $EUID -ne 0 ]]; then + echo "This script must be run as root" + exit 1 + fi + chown ${TARGET_USER}:${TARGET_USER} -R /home/${TARGET_USER}/nocloud/ + bash -x /home/${TARGET_USER}/nocloud/post-install.sh main + # - path: /etc/himmelblau/himmelblau.conf # owner: ${TARGET_USER}:${TARGET_USER} # content: | @@ -178,7 +191,7 @@ autoinstall: - bash -x /cdrom/nocloud/wifi.sh - mkdir -p /target/home/${TARGET_USER}/nocloud - cp /cdrom/nocloud/* /target/home/${TARGET_USER}/nocloud/ - - chown ${TARGET_USER}:${TARGET_USER} -R /target/home/${TARGET_USER}/nocloud/ + - curtin in-target -- systemctl disable systemd-networkd-wait-online.service updates: all shutdown: poweroff