Compare commits

..

No commits in common. "7282ad8025237d374bb58daeee591cb27f27b1c3" and "4e7e835bd9ffbe1fe1e00b4edb88186062bcda4f" have entirely different histories.

5 changed files with 13 additions and 87 deletions

View File

@ -1,6 +1,6 @@
#!/bin/fish #!/bin/fish
cp ./src/snap-pac-uki.fish /usr/local/bin/snap-pac-uki cp ./pacman/snap-pac-uki-create.fish /usr/local/bin
echo "installed creation script." echo "installed creation script."
cp ./pacman/* /usr/share/libalpm/hooks/ cp ./pacman/hooks/* /usr/share/libalpm/hooks/
echo "installed pacman hooks." echo "installed pacman hooks."

View File

@ -1,12 +0,0 @@
[Trigger]
Operation = Upgrade
Operation = Install
Operation = Remove
Type = Package
Target = *
[Action]
Description = Performing pre UKI creation...
When = PreTransaction
Exec = /usr/local/bin/snap-pac-uki snapshots
AbortOnFail

View File

@ -1,11 +0,0 @@
[Trigger]
Operation = Upgrade
Operation = Install
Operation = Remove
Type = Package
Target = *
[Action]
Description = Performing post UKI creation...
When = PostTransaction
Exec = /usr/local/bin/snap-pac-uki snapshots

View File

@ -1,11 +0,0 @@
[Trigger]
Operation = Upgrade
Operation = Install
Operation = Remove
Type = Package
Target = *
[Action]
Description = Performing post UKI creation...
When = PostTransaction
Exec = /usr/local/bin/snap-pac-uki current

View File

@ -70,7 +70,13 @@ function create_uki -d "creates a new uki" -a variant id
--add-section .splash="$prefix/usr/share/systemd/bootctl/splash-arch.bmp" --change-section-vma .splash=0x40000 \ --add-section .splash="$prefix/usr/share/systemd/bootctl/splash-arch.bmp" --change-section-vma .splash=0x40000 \
--add-section .linux="$prefix/boot/vmlinuz-linux" --change-section-vma .linux=0x2000000 \ --add-section .linux="$prefix/boot/vmlinuz-linux" --change-section-vma .linux=0x2000000 \
--add-section .initrd="$prefix/boot/initramfs-linux$fallback.img" --change-section-vma .initrd=0x3000000 \ --add-section .initrd="$prefix/boot/initramfs-linux$fallback.img" --change-section-vma .initrd=0x3000000 \
"$prefix/usr/lib/systemd/boot/efi/linuxx64.efi.stub" "$bd/arch-linux$fallback$snid.efi" "$prefix/usr/lib/systemd/boot/efi/linuxx64.efi.stub" "$bp/arch-linux$fallback$snid.efi"
end
function add_efi_entry -d "adds an efi boot entry for a snapshot uki" -a id
efibootmgr -q -C -d $CFG_EFI_DEV -p $CFG_EFI_PART \
-l "$EFI_PATH\arch-linux-$id.efi" \
-L "Arch Linux (Snapshot $id)"
end end
function create_snapshot_uki -d "creates an uki for a snapshot" -a id function create_snapshot_uki -d "creates an uki for a snapshot" -a id
@ -81,43 +87,16 @@ function create_snapshot_uki -d "creates an uki for a snapshot" -a id
else if test -d $bd else if test -d $bd
rm -rf "$bd/*" rm -rf "$bd/*"
else else
mkdir -p $bd mkdir $bd
end end
# prepare files # prepare files
sed "s/BUILD_ID=.*/BUILD_ID=\"snapshot $id\"/;s/PRETTY_NAME=\"\(.*\)\"/PRETTY_NAME=\"\1 (Snapshot $id)\"/" <"$CFG_SNAPSHOT_PATH/$id/snapshot/usr/lib/os-release" >"$bd/os-release" sed "s/BUILD_ID=.*/BUILD_ID=\"snapshot $id\"/;s/PRETTY_NAME=\"\(.*\)\"/PRETTY_NAME=\"\1 (Snapshot $id)\"" <"$CFG_SNAPSHOT_PATH/$id/snapshot/usr/lib/os-release" >"$bd/os-release"
sed "s/SNAPSHOT/$CFG_SNAPSHOT_SUBVOL\/$id\/snapshot/" <"$CFG_SNAPSHOT_PATH/$id/snapshot/etc/snap-pac-uki/kernel-cmd" >"$bd/kernel-cmd" sed "s/SNAPSHOT/$CFG_SNAPSHOT_SUBVOL/" <"$CFG_SNAPSHOT_PATH/$id/snapshot/etc/snap-pac-uki/kernel-cmd" >"$bd/kernel-cmd"
# create uki # create uki
create_uki snapshot $id create_uki snapshot $id
end add_efi_entry $id
function create_current_uki -d "creates an uki for the current system"
# create build directory
set bd "$CFG_BUILD_DIR/current"
if test -f $bd
error "build dir for snapshot $id is a file"
else if test -d $bd
rm -rf "$bd/*"
else
mkdir -p $bd
end
# create default
cp "/usr/lib/os-release" "$bd/os-release"
sed "s/SNAPSHOT/$CFG_DEFAULT_SUBVOL/" <"/etc/snap-pac-uki/kernel-cmd" >"$bd/kernel-cmd"
create_uki rolling
# create fallbac
sed "s/BUILD_ID=.*/BUILD_ID=fallback/;s/PRETTY_NAME=\"\(.*\)\"/PRETTY_NAME=\"\1 (Fallback)\"/" <"/usr/lib/os-release" >"$bd/os-release-fallback"
sed "s/SNAPSHOT/$CFG_DEFAULT_SUBVOL/" <"/etc/snap-pac-uki/kernel-cmd-fallback" >"$bd/kernel-cmd-fallback"
create_uki fallback
end
function add_efi_entry -d "adds an efi boot entry for a snapshot uki" -a id
efibootmgr -q -C -d $CFG_EFI_DEV -p $CFG_EFI_PART \
-l "$CFG_EFI_PATH\arch-linux-$id.efi" \
-L "Arch Linux (Snapshot $id)"
end end
function main function main
@ -129,28 +108,9 @@ function main
case "snapshots" case "snapshots"
find_tasks find_tasks
for id in $TASK_UKI for id in $TASK_UKI
echo "==> found snapshot without uki: $id"
create_snapshot_uki $id create_snapshot_uki $id
echo " -> created uki for snapshot $id"
cp "$CFG_BUILD_DIR/$id/arch-linux-$id.efi" "$CFG_UKI_DIR"
echo " -> copied uki for snapshot $id into uki directory"
add_efi_entry $id
echo " -> created efi boot entry for uki of snapshot $id"
end end
case "current"
echo "==> creating current ukis"
create_current_uki
echo " -> created ukis"
cp "$CFG_BUILD_DIR/current/arch-linux.efi" "$CFG_UKI_DIR"
cp "$CFG_BUILD_DIR/current/arch-linux-fallback.efi" "$CFG_UKI_DIR"
echo " -> copied ukis into uki directory"
case "*" case "*"
error "unknown command" error "unknown command"
end end