diff options
Diffstat (limited to 'src/kernel-install')
-rwxr-xr-x | src/kernel-install/90-loaderentry.install.in | 2 | ||||
-rwxr-xr-x | src/kernel-install/test-kernel-install.sh | 32 |
2 files changed, 33 insertions, 1 deletions
diff --git a/src/kernel-install/90-loaderentry.install.in b/src/kernel-install/90-loaderentry.install.in index 0992c641f0..e8e8cf37c3 100755 --- a/src/kernel-install/90-loaderentry.install.in +++ b/src/kernel-install/90-loaderentry.install.in @@ -32,7 +32,7 @@ MACHINE_ID="$KERNEL_INSTALL_MACHINE_ID" ENTRY_TOKEN="$KERNEL_INSTALL_ENTRY_TOKEN" BOOT_ROOT="$KERNEL_INSTALL_BOOT_ROOT" -BOOT_MNT="$(stat -c %m "$BOOT_ROOT")" +[ -n "$BOOT_MNT" ] || BOOT_MNT="$(stat -c %m "$BOOT_ROOT")" if [ "$BOOT_MNT" = '/' ]; then ENTRY_DIR="$ENTRY_DIR_ABS" else diff --git a/src/kernel-install/test-kernel-install.sh b/src/kernel-install/test-kernel-install.sh index 2e44063668..f16bb9f50f 100755 --- a/src/kernel-install/test-kernel-install.sh +++ b/src/kernel-install/test-kernel-install.sh @@ -9,6 +9,8 @@ plugin="${2:?}" D="$(mktemp --tmpdir --directory "test-kernel-install.XXXXXXXXXX")" +export _KERNEL_INSTALL_BOOTCTL="$PROJECT_BUILD_ROOT/bootctl" + # shellcheck disable=SC2064 trap "rm -rf '$D'" EXIT INT QUIT PIPE mkdir -p "$D/boot" @@ -31,6 +33,7 @@ EOF export KERNEL_INSTALL_CONF_ROOT="$D/sources" export KERNEL_INSTALL_PLUGINS="$plugin" export BOOT_ROOT="$D/boot" +export BOOT_MNT="$D/boot" export MACHINE_ID='3e0484f3634a418b8e6a39e8828b03e3' "$kernel_install" -v add 1.1.1 "$D/sources/linux" "$D/sources/initrd" @@ -82,3 +85,32 @@ grep -qE '^initrd .*/the-token/1.1.1/initrd' "$entry" grep -qE 'image' "$BOOT_ROOT/the-token/1.1.1/linux" grep -qE 'initrd' "$BOOT_ROOT/the-token/1.1.1/initrd" + +if test -x "$_KERNEL_INSTALL_BOOTCTL"; then + echo "Testing bootctl" + e2="${entry%+*}_2.conf" + cp "$entry" "$e2" + export SYSTEMD_ESP_PATH=/ + + # create file that is not referenced. Check if cleanup removes + # it but leaves the rest alone + :> "$BOOT_ROOT/the-token/1.1.2/initrd" + "$_KERNEL_INSTALL_BOOTCTL" --root="$BOOT_ROOT" cleanup + test ! -e "$BOOT_ROOT/the-token/1.1.2/initrd" + test -e "$BOOT_ROOT/the-token/1.1.2/linux" + test -e "$BOOT_ROOT/the-token/1.1.1/linux" + test -e "$BOOT_ROOT/the-token/1.1.1/initrd" + # now remove duplicated entry and make sure files are left over + "$_KERNEL_INSTALL_BOOTCTL" --root="$BOOT_ROOT" unlink "${e2##*/}" + test -e "$BOOT_ROOT/the-token/1.1.1/linux" + test -e "$BOOT_ROOT/the-token/1.1.1/initrd" + test -e "$entry" + test ! -e "$e2" + # remove last entry referencing those files + entry_id="${entry##*/}" + entry_id="${entry_id%+*}.conf" + "$_KERNEL_INSTALL_BOOTCTL" --root="$BOOT_ROOT" unlink "$entry_id" + test ! -e "$entry" + test ! -e "$BOOT_ROOT/the-token/1.1.1/linux" + test ! -e "$BOOT_ROOT/the-token/1.1.1/initrd" +fi |