From 779cdabbb1a4670634e583c6bdcfbf1b261e4689 Mon Sep 17 00:00:00 2001 From: Harald Sitter Date: Sun, 12 Nov 2023 01:29:02 +0100 Subject: [PATCH] rejigger outputs with image-id and image-version this changes output paths and names a tad but should be more reliable in the long run --- build.sh | 30 ++++++++++++++---------------- mkosi.postinst | 3 +++ 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/build.sh b/build.sh index 4169650..29842a8 100755 --- a/build.sh +++ b/build.sh @@ -13,31 +13,31 @@ _DATE=$(date +%Y%m%d) _TIME=$(date +%H%M) DATETIME="${_DATE}${_TIME}" VERSION="$DATETIME" -ID=${NAME}_$VERSION -EFI=$ID.efi -TAR=${ID}_root-x86-64.tar -IMG=$ID.raw +OUTPUT=${NAME}_$VERSION +EFI=$OUTPUT.efi +TAR=${OUTPUT}_root-x86-64.tar +IMG=$OUTPUT.raw echo "$VERSION" > ./mkosi.extra/usr/lib/image_version -mkosi --distribution arch --output "$ID" --image-id "$NAME" --image-version "$VERSION" "$@" +mkosi --distribution arch --image-id "$NAME" --image-version "$VERSION" "$@" -rm -rv image/efi/EFI/Linux/ -mkdir -p image/efi/EFI/Linux/ -mv -v image/${NAME}*.efi "image/efi/EFI/Linux/$EFI" -mv -v image/live.efi . +rm -rv ${OUTPUT}/efi/EFI/Linux/ +mkdir -p ${OUTPUT}/efi/EFI/Linux/ +mv -v ${OUTPUT}/${NAME}*.efi "${OUTPUT}/efi/EFI/Linux/$EFI" +mv -v ${OUTPUT}/live.efi . rm -rf "$TAR" ./*.tar -tar -C image/ -cf "$TAR" . +tar -C ${OUTPUT}/ -cf "$TAR" . rm -f "$IMG" ./*.raw touch "$IMG" # The root partition contains the shipable efi image. -systemd-repart --no-pager --empty=allow --size=auto --dry-run=no --root=image --definitions=mkosi.repart --defer-partitions=esp "$IMG" -systemd-dissect --with "$IMG" "$(pwd)/btrfs.sh" $NAME $VERSION $ID +systemd-repart --no-pager --empty=allow --size=auto --dry-run=no --root=${OUTPUT} --definitions=mkosi.repart --defer-partitions=esp "$IMG" +systemd-dissect --with "$IMG" "$(pwd)/btrfs.sh" $NAME $VERSION $OUTPUT # The esp of the image contains the live efi image (divergent cmdline). -cp -v live.efi "image/efi/EFI/Linux/$EFI" -systemd-repart --no-pager --empty=allow --size=auto --dry-run=no --root=image --definitions=mkosi.repart --defer-partitions=root "$IMG" +cp -v live.efi "${OUTPUT}/efi/EFI/Linux/$EFI" +systemd-repart --no-pager --empty=allow --size=auto --dry-run=no --root=${OUTPUT} --definitions=mkosi.repart --defer-partitions=root "$IMG" # TODO before accepting new uploads perform sanity checks on the artifacts (e.g. the tar being well formed) chmod go+r ./*.efi # efi images are 700, make them readable so the server can serve them @@ -46,5 +46,3 @@ scp "$TAR" root@web.local:/var/www/html scp "$IMG" root@web.local:/var/www/html scp "live.efi" root@web.local:/var/www/html ssh root@web.local -- /bin/sh -c "'cd /var/www/html/ && ./update.sh'" - -echo "$VERSION" > version diff --git a/mkosi.postinst b/mkosi.postinst index 6dd99f7..919b30f 100755 --- a/mkosi.postinst +++ b/mkosi.postinst @@ -38,5 +38,8 @@ done # dracut --uefi --no-machineid --kernel-cmdline "native ro" --kver "$kernel_version" systemdOS.efi # kernel-install add --verbose add "$kernel_version" "/usr/lib/modules/$kernel_version/vmlinuz" systemdOS.efi +cd / +rm -fv live.efi dracut --uefi --no-machineid --kernel-cmdline "native ro systemd.volatile=overlay systemd.firstboot=false systemd.hostname=systemdOS systemdOS.live" --kver "$kernel_version" live.efi +rm -rfv systemdOS.efi dracut --uefi --no-machineid --kernel-cmdline "ro" --kver "$kernel_version" systemdOS.efi