Cleaned up creation script
This commit is contained in:
parent
f1ff8615b6
commit
64ad4e635e
@ -2,13 +2,11 @@
|
|||||||
|
|
||||||
# get id and type of last snapshot
|
# get id and type of last snapshot
|
||||||
set -l config "root"
|
set -l config "root"
|
||||||
set -l snapshots (snapper -c $config --jsonout ls | jq -c ".$config")
|
set -l snapshot (snapper -c $config --jsonout ls | jq -c ".$config | last")
|
||||||
set -l last (echo $snapshots | jq -c "last")
|
set -l id (echo $snapshot | jq ".number")
|
||||||
set -l id (echo $last | jq ".number")
|
|
||||||
set -l type (echo $last | jq ".type")
|
|
||||||
|
|
||||||
if not contains $type '"pre"' '"post"'
|
if not contains (echo $snapshot | jq -r ".type") "pre" "post"
|
||||||
echo "Last snapshot has type \"$type\", therefore no UKI is created."
|
echo "==> last snapshot type is neither 'pre' nor 'post'; no UKI creation"
|
||||||
exit
|
exit
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -17,15 +15,16 @@ end
|
|||||||
set -l ukis (ls /boot/EFI/Linux/ | grep "snap-pac-uki-[1-9][0-9]*\.efi" | grep -o '[1-9][0-9]*')
|
set -l ukis (ls /boot/EFI/Linux/ | grep "snap-pac-uki-[1-9][0-9]*\.efi" | grep -o '[1-9][0-9]*')
|
||||||
|
|
||||||
if contains $id $ukis
|
if contains $id $ukis
|
||||||
echo "UKI already exists"
|
echo "==> UKI already exists; no UKI creation"
|
||||||
exit
|
exit
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
# prepare uki creation
|
# prepare uki creation
|
||||||
mkdir -p "/tmp/snap-pac-uki/$id"
|
set -l buildpath "/tmp/snap-pac-uki/$id"
|
||||||
rm -rf "/tmp/snap-pac-uki/$id/*"
|
mkdir -p $buildpath
|
||||||
cd "/tmp/snap-pac-uki/$id"
|
rm -rf "$buildpath/*"
|
||||||
|
cd $buildpath
|
||||||
|
|
||||||
sed "s/BUILD_ID=.*/BUILD_ID=\"Snapshot $id\"/" </usr/lib/os-release >./os-release
|
sed "s/BUILD_ID=.*/BUILD_ID=\"Snapshot $id\"/" </usr/lib/os-release >./os-release
|
||||||
|
|
||||||
@ -36,10 +35,12 @@ grep options /boot/loader/entries/00-arch.conf | \
|
|||||||
|
|
||||||
|
|
||||||
# create uki
|
# create uki
|
||||||
|
set -l ukipath "/boot/EFI/Linux/snap-pac-uki-$id.efi"
|
||||||
objcopy \
|
objcopy \
|
||||||
--add-section .osrel="./os-release" --change-section-vma .osrel=0x20000 \
|
--add-section .osrel="./os-release" --change-section-vma .osrel=0x20000 \
|
||||||
--add-section .cmdline="./kernel-parameters" --change-section-vma .cmdline=0x30000 \
|
--add-section .cmdline="./kernel-parameters" --change-section-vma .cmdline=0x30000 \
|
||||||
--add-section .splash="/usr/share/systemd/bootctl/splash-arch.bmp" --change-section-vma .splash=0x40000 \
|
--add-section .splash="/usr/share/systemd/bootctl/splash-arch.bmp" --change-section-vma .splash=0x40000 \
|
||||||
--add-section .linux="/boot/vmlinuz-linux" --change-section-vma .linux=0x2000000 \
|
--add-section .linux="/boot/vmlinuz-linux" --change-section-vma .linux=0x2000000 \
|
||||||
--add-section .initrd="/boot/initramfs-linux.img" --change-section-vma .initrd=0x3000000 \
|
--add-section .initrd="/boot/initramfs-linux.img" --change-section-vma .initrd=0x3000000 \
|
||||||
"/usr/lib/systemd/boot/efi/linuxx64.efi.stub" "/boot/EFI/Linux/snap-pac-uki-$id.efi"
|
"/usr/lib/systemd/boot/efi/linuxx64.efi.stub" $ukipath
|
||||||
|
echo "==> created UKI: $ukipath"
|
||||||
|
Loading…
Reference in New Issue
Block a user