Compare commits
2 Commits
4e7e835bd9
...
7282ad8025
Author | SHA1 | Date | |
---|---|---|---|
7282ad8025 | |||
1f33307608 |
@ -1,6 +1,6 @@
|
|||||||
#!/bin/fish
|
#!/bin/fish
|
||||||
cp ./pacman/snap-pac-uki-create.fish /usr/local/bin
|
cp ./src/snap-pac-uki.fish /usr/local/bin/snap-pac-uki
|
||||||
echo "installed creation script."
|
echo "installed creation script."
|
||||||
|
|
||||||
cp ./pacman/hooks/* /usr/share/libalpm/hooks/
|
cp ./pacman/* /usr/share/libalpm/hooks/
|
||||||
echo "installed pacman hooks."
|
echo "installed pacman hooks."
|
||||||
|
12
pacman/01_snap-pac-uki_pre.hook
Normal file
12
pacman/01_snap-pac-uki_pre.hook
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
[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
|
11
pacman/zzy_snap-pac-uki_post.hook
Normal file
11
pacman/zzy_snap-pac-uki_post.hook
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
[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
|
11
pacman/zzz_snap-pac-uki_current.hook
Normal file
11
pacman/zzz_snap-pac-uki_current.hook
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
[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
|
@ -70,13 +70,7 @@ 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" "$bp/arch-linux$fallback$snid.efi"
|
"$prefix/usr/lib/systemd/boot/efi/linuxx64.efi.stub" "$bd/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
|
||||||
@ -87,16 +81,43 @@ 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 $bd
|
mkdir -p $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/" <"$CFG_SNAPSHOT_PATH/$id/snapshot/etc/snap-pac-uki/kernel-cmd" >"$bd/kernel-cmd"
|
sed "s/SNAPSHOT/$CFG_SNAPSHOT_SUBVOL\/$id\/snapshot/" <"$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
|
||||||
add_efi_entry $id
|
end
|
||||||
|
|
||||||
|
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
|
||||||
@ -108,9 +129,28 @@ 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
|
||||||
|
Loading…
Reference in New Issue
Block a user