diff options
Diffstat (limited to 'loader-postinst.sh')
-rwxr-xr-x | loader-postinst.sh | 43 |
1 files changed, 14 insertions, 29 deletions
diff --git a/loader-postinst.sh b/loader-postinst.sh index a705b2e..091baaf 100755 --- a/loader-postinst.sh +++ b/loader-postinst.sh @@ -31,14 +31,14 @@ fi if [[ -d /boot/loader/entries ]]; then EFI_DIR="/boot" -elif [[ -f /boot/efi/loader/entries ]]; then +elif [[ -d /boot/efi/loader/entries ]]; then EFI_DIR="/boot/efi" fi if ! [[ $EFI_DIR ]] ; then - echo "Can't install new kernel for loader: no directory 'loader/entries found!" >&2 - echo "Please create the directory 'loader/entries' in your EFI partition." >&2 - exit 1 + echo "Did not install new kernel and loader entry." >&2 + echo "Please create the directory 'loader/entries/' in your EFI system partition." >&2 + exit 0 fi if [[ -f ${KERNEL_IMAGE/vmlinuz/initrd} ]]; then @@ -55,57 +55,42 @@ if [[ -f /etc/kernel/cmdline ]]; then done < /etc/kernel/cmdline fi if ! [[ $BOOT_OPTIONS ]]; then - echo "Can't load default kernel command line parameters from /etc/kernel/cmdline!" >&2 + echo "Can't determine the kernel command line parameters." >&2 echo "Please specify the kernel command line in /etc/kernel/cmdline!" >&2 exit 1 fi [[ -f /etc/os-release ]] && . /etc/os-release if ! [[ $ID ]]; then - echo "Can't determine the ID of your distribution. Please populate /etc/os-release!" >&2 + 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 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 populate /etc/machine-id!" >&2 + 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 exit 1 fi -ROOT_DEV=$(while read a a a a mp a a a dev a; do - if [[ $mp = "/" ]]; then - echo $dev - break - fi -done < /proc/self/mountinfo) - -if [[ $ROOT_DEV ]]; then - ROOT_LABEL=$(blkid -p -o udev -u filesystem $ROOT_DEV | - while read line; do - if [[ $line == ID_FS_LABEL* ]]; then - echo ${line##ID_FS_LABEL=} - break - fi - done) -fi - mkdir -p "${EFI_DIR}/${ID}/${MACHINE_ID}" cp --preserve "$KERNEL_IMAGE" "${EFI_DIR}/${ID}/${MACHINE_ID}/" [[ $INITRD_IMAGE ]] && cp --preserve "$INITRD_IMAGE" "${EFI_DIR}/${ID}/${MACHINE_ID}/" { - echo "title $NAME $VERSION_ID ($KERNEL_VERSION) $ROOT_LABEL ${ROOT_DEV##/dev/} ${MACHINE_ID:0:8}" - echo "options $BOOT_OPTIONS" - echo "linux /$ID/$MACHINE_ID/${KERNEL_IMAGE##*/}" - [[ $INITRD_IMAGE ]] && echo "initrd /${ID}/${MACHINE_ID}/${INITRD_IMAGE##*/}" + echo "title $PRETTY_NAME" + echo "title-version $KERNEL_VERSION" + echo "title-machine ${MACHINE_ID:0:8}" + echo "options $BOOT_OPTIONS" + echo "linux /$ID/$MACHINE_ID/${KERNEL_IMAGE##*/}" + [[ $INITRD_IMAGE ]] && echo "initrd /${ID}/${MACHINE_ID}/${INITRD_IMAGE##*/}" } > "${EFI_DIR}/loader/entries/${ID}-${KERNEL_VERSION}-${MACHINE_ID}.conf" if ! [[ -f ${EFI_DIR}/loader/loader.conf ]]; then { - echo "default $ID-" + echo "default $ID-*" } > "${EFI_DIR}/loader/loader.conf" fi |