feat: add factory reset UKI

This commit is contained in:
Lars Sjöström 2025-03-14 07:52:35 +01:00
parent 2c2d212e25
commit 1fcc45dd32
No known key found for this signature in database
2 changed files with 24 additions and 5 deletions
pkgs

View file

@ -74,21 +74,40 @@ $systemd/usr/bin/ukify build \
--os-release @rootfs/etc/os-release \
--cmdline "$kernelCmdLine roothash=$roothash" \
-o patos_${version}.efi
cat <<EOF > reset-os-release
NAME=PatOS
PRETTY_NAME=PatOS Factory Reset
IMAGE_ID=patos
ID=patos
IMAGE_VERSION=${version}
VERSION=${version}
VERSION_ID=patos
EOF
$systemd/usr/bin/ukify build \
--linux $kernel/bzImage \
--initrd $initrd/initrd.xz \
--os-release @./reset-os-release \
--cmdline "$kernelCmdLine roothash=$roothash systemd.factory_reset=yes" \
-o patos_factory_reset.efi
rm -rf rootfs
cp patos_${version}.efi boot/
cp patos_factory_reset.efi boot/
cp ${systemd}/usr/lib/systemd/boot/efi/systemd-bootx64.efi boot/
echo "timeout 1" > boot/loader.conf
echo "timeout 2" > boot/loader.conf
# Final partitioning
cat <<EOF > final.repart.d/10-esp.conf
[Partition]
Type=esp
Format=vfat
SizeMinBytes=96M
SizeMaxBytes=96M
SizeMinBytes=160M
SizeMaxBytes=160M
CopyFiles=/boot/systemd-bootx64.efi:/EFI/BOOT/BOOTX64.EFI
CopyFiles=/boot/patos_${version}.efi:/EFI/Linux/patos_${version}.efi
CopyFiles=/boot/patos_factory_reset.efi:/EFI/Linux/patos_factory_reset.efi
CopyFiles=/boot/loader.conf:/loader/loader.conf
EOF

View file

@ -52,8 +52,8 @@ cat <<EOF > $out/etc/repart.d/10-esp.conf
[Partition]
Type=esp
Format=vfat
SizeMaxBytes=96M
SizeMinBytes=96M
SizeMaxBytes=160M
SizeMinBytes=160M
EOF
cat <<EOF > $out/etc/repart.d/20-root-a.conf