finish rewrite
This commit is contained in:
parent
4e7e835bd9
commit
1f33307608
@ -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 .linux="$prefix/boot/vmlinuz-linux" --change-section-vma .linux=0x2000000 \
|
||||
--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"
|
||||
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)"
|
||||
"$prefix/usr/lib/systemd/boot/efi/linuxx64.efi.stub" "$bd/arch-linux$fallback$snid.efi"
|
||||
end
|
||||
|
||||
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
|
||||
rm -rf "$bd/*"
|
||||
else
|
||||
mkdir $bd
|
||||
mkdir -p $bd
|
||||
end
|
||||
|
||||
# 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/SNAPSHOT/$CFG_SNAPSHOT_SUBVOL/" <"$CFG_SNAPSHOT_PATH/$id/snapshot/etc/snap-pac-uki/kernel-cmd" >"$bd/kernel-cmd"
|
||||
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"
|
||||
|
||||
# create uki
|
||||
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
|
||||
|
||||
function main
|
||||
@ -108,9 +129,28 @@ function main
|
||||
case "snapshots"
|
||||
find_tasks
|
||||
for id in $TASK_UKI
|
||||
echo "==> found snapshot without 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
|
||||
|
||||
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 "*"
|
||||
error "unknown command"
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user