diff options
author | Ludwig Nussel <ludwig.nussel@suse.de> | 2023-01-05 15:31:13 +0100 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2023-01-10 13:49:31 +0100 |
commit | 5fe34dbfeb3aca9240e94b03ddb5109743498610 (patch) | |
tree | c90aea1a1239a4db600eb4d0ed84fc741941405e /src/kernel-install | |
parent | 5afaf4071208e1b836e2c6693752e2fb3161d1c5 (diff) | |
download | systemd-5fe34dbfeb3aca9240e94b03ddb5109743498610.tar.gz |
kernel-install: refactor some variables
In preparation for plugin support
Diffstat (limited to 'src/kernel-install')
-rwxr-xr-x | src/kernel-install/90-loaderentry.install.in | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/src/kernel-install/90-loaderentry.install.in b/src/kernel-install/90-loaderentry.install.in index 4e936d95f4..0992c641f0 100755 --- a/src/kernel-install/90-loaderentry.install.in +++ b/src/kernel-install/90-loaderentry.install.in @@ -39,13 +39,17 @@ else ENTRY_DIR="${ENTRY_DIR_ABS#"$BOOT_MNT"}" fi +KERNEL_DEST="$ENTRY_DIR_ABS/linux" +KERNEL_ENTRY="$ENTRY_DIR/linux" +LOADER_ENTRY="$BOOT_ROOT/loader/entries/$ENTRY_TOKEN-$KERNEL_VERSION.conf" + case "$COMMAND" in remove) [ "$KERNEL_INSTALL_VERBOSE" -gt 0 ] && \ - echo "Removing $BOOT_ROOT/loader/entries/$ENTRY_TOKEN-$KERNEL_VERSION*.conf" + echo "Removing ${LOADER_ENTRY%.conf}*.conf" exec rm -f \ - "$BOOT_ROOT/loader/entries/$ENTRY_TOKEN-$KERNEL_VERSION.conf" \ - "$BOOT_ROOT/loader/entries/$ENTRY_TOKEN-$KERNEL_VERSION+"*".conf" + "$LOADER_ENTRY" \ + "${LOADER_ENTRY%.conf}"*".conf" ;; add) ;; @@ -97,9 +101,7 @@ if [ -f "$TRIES_FILE" ]; then echo "$TRIES_FILE does not contain an integer." >&2 exit 1 fi - LOADER_ENTRY="$BOOT_ROOT/loader/entries/$ENTRY_TOKEN-$KERNEL_VERSION+$TRIES.conf" -else - LOADER_ENTRY="$BOOT_ROOT/loader/entries/$ENTRY_TOKEN-$KERNEL_VERSION.conf" + LOADER_ENTRY="${LOADER_ENTRY%.conf}+$TRIES.conf" fi if ! [ -d "$ENTRY_DIR_ABS" ]; then @@ -107,11 +109,11 @@ if ! [ -d "$ENTRY_DIR_ABS" ]; then exit 1 fi -install -m 0644 "$KERNEL_IMAGE" "$ENTRY_DIR_ABS/linux" || { - echo "Error: could not copy '$KERNEL_IMAGE' to '$ENTRY_DIR_ABS/linux'." >&2 +install -m 0644 "$KERNEL_IMAGE" "$KERNEL_DEST" || { + echo "Error: could not copy '$KERNEL_IMAGE' to '$KERNEL_DEST'." >&2 exit 1 } -chown root:root "$ENTRY_DIR_ABS/linux" || : +chown root:root "$KERNEL_DEST" || : shift "$INITRD_OPTIONS_SHIFT" # All files listed as arguments, and staged files starting with "initrd" are installed as initrds. @@ -148,7 +150,7 @@ mkdir -p "${LOADER_ENTRY%/*}" || { fi [ -n "$SORT_KEY" ] && echo "sort-key $SORT_KEY" echo "options $BOOT_OPTIONS" - echo "linux $ENTRY_DIR/linux" + echo "linux $KERNEL_ENTRY" have_initrd= for initrd in "${@}" "${KERNEL_INSTALL_STAGING_AREA}"/initrd*; do |