X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fkernel-install%2Fkernel-install;h=16c06e08421da98de928095d4db4e7b743ce165d;hb=c170f3a41bc69ad1eab2dba40cede865f2532bbc;hp=1a694578a1c563f5f62c93a019aa12a91da117c0;hpb=61f99b60644cbf92c35627937868cd62557898b1;p=elogind.git diff --git a/src/kernel-install/kernel-install b/src/kernel-install/kernel-install index 1a694578a..16c06e084 100644 --- a/src/kernel-install/kernel-install +++ b/src/kernel-install/kernel-install @@ -28,14 +28,14 @@ KERNEL_IMAGE="$3" [[ -f /etc/os-release ]] && . /etc/os-release if ! [[ $ID ]]; then echo "Can't determine the name of your distribution. Please create /etc/os-release." >&2 - echo "See http://www.freedesktop.org/software/systemd/man/os-release.html" >&2 + echo "See man:os-release(5)" >&2 exit 1 fi [[ -f /etc/machine-id ]] && read MACHINE_ID < /etc/machine-id if ! [[ $MACHINE_ID ]]; then echo "Can't determine your machine id. Please create /etc/machine-id!" >&2 - echo "See http://www.freedesktop.org/software/systemd/man/machine-id.html" >&2 + echo "See man:machine-id(5)" >&2 exit 1 fi @@ -67,7 +67,9 @@ if ! ( [[ $COMMAND ]] && [[ $KERNEL_VERSION ]] && [[ $KERNEL_IMAGE ]] ); then exit 1 fi -BOOT_DIR="/boot/$MACHINE_ID/$KERNEL_VERSION" +BOOT_DIR="/${MACHINE_ID}/${KERNEL_VERSION}" +BOOT_DIR_ABS="/boot${BOOT_DIR}" +LOADER_ENTRY="/boot/loader/entries/${MACHINE_ID}-${KERNEL_VERSION}.conf" ret=0 dropindirs_sort() @@ -99,15 +101,15 @@ readarray -t PLUGINS < <( case "$COMMAND" in add) - mkdir -p "$BOOT_DIR" || exit 1 + mkdir -p "$BOOT_DIR_ABS" || exit 1 for f in "${PLUGINS[@]}"; do - [[ -x $f ]] && "$f" add "$KERNEL_VERSION" "$BOOT_DIR" + [[ -x $f ]] && "$f" add "$KERNEL_VERSION" "$BOOT_DIR_ABS" ((ret+=$?)) done - if ! cp --preserve "$KERNEL_IMAGE" "$BOOT_DIR"/linux; then - echo "Can't copy '$KERNEL_IMAGE to '$BOOT_DIR/linux'!" >&2 + if ! cp --preserve "$KERNEL_IMAGE" "$BOOT_DIR_ABS"/linux; then + echo "Can't copy '$KERNEL_IMAGE to '$BOOT_DIR_ABS/linux'!" >&2 fi [[ -d /boot/loader/entries ]] || mkdir -p /boot/loader/entries @@ -116,28 +118,28 @@ case "$COMMAND" in echo "title $PRETTY_NAME" echo "version $KERNEL_VERSION" echo "machine-id $MACHINE_ID" - echo "options $BOOT_OPTIONS" + echo "options ${BOOT_OPTIONS[@]}" echo "linux $BOOT_DIR/linux" - [[ -f "${BOOT_DIR}"/initrd ]] && \ + [[ -f "${BOOT_DIR_ABS}"/initrd ]] && \ echo "initrd $BOOT_DIR/initrd" : - } > "/boot/loader/entries/${ID}-${KERNEL_VERSION}-${MACHINE_ID}.conf" + } > $LOADER_ENTRY ((ret+=$?)) - if ! [[ -f "/boot/loader/entries/${ID}-${KERNEL_VERSION}-${MACHINE_ID}.conf" ]]; then - echo "Could not create '/boot/loader/entries/${ID}-${KERNEL_VERSION}-${MACHINE_ID}.conf'!" >&2 + if ! [[ -f $LOADER_ENTRY ]]; then + echo "Could not create '$LOADER_ENTRY'!" >&2 fi ;; remove) for f in "${PLUGINS[@]}"; do - [[ -x $f ]] && "$f" remove "$KERNEL_VERSION" "$BOOT_DIR" + [[ -x $f ]] && "$f" remove "$KERNEL_VERSION" "$BOOT_DIR_ABS" ((ret+=$?)) done - rm -fr "$BOOT_DIR" - rm -f "/boot/loader/entries/${ID}-${KERNEL_VERSION}-${MACHINE_ID}.conf" + rm -fr "$BOOT_DIR_ABS" + rm -f "$LOADER_ENTRY" ;; *)