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
This commit is contained in:
Harald Sitter
2023-11-12 01:29:02 +01:00
parent 3e9b1f68f9
commit 779cdabbb1
2 changed files with 17 additions and 16 deletions

View File

@@ -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

View File

@@ -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