From 10f0a340483995f0576788043a2b2f2c6cfa486b Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 26 Feb 2013 14:40:56 +0100 Subject: [PATCH] delete loader-postinst.sh --- README | 4 ++ loader-postinst.sh | 109 ----------------------------------------------------- 2 files changed, 4 insertions(+), 109 deletions(-) delete mode 100755 loader-postinst.sh diff --git a/README b/README index ff32956..09f835f 100644 --- a/README +++ b/README @@ -20,3 +20,7 @@ entry is booted right away. Further documentation is available in the gummiboot wiki at: http://freedesktop.org/wiki/Software/gummiboot + +Links: + http://www.freedesktop.org/wiki/Specifications/BootLoaderSpec + http://www.freedesktop.org/software/systemd/man/kernel-install.html diff --git a/loader-postinst.sh b/loader-postinst.sh deleted file mode 100755 index a3c81d9..0000000 --- a/loader-postinst.sh +++ /dev/null @@ -1,109 +0,0 @@ -#!/bin/bash - -# This script is called automatically by new-kernel-pkg as -# /etc/kernel/postinst.d/loader-postinst.sh (Fedora) - -# This program is free software; you can redistribute it and/or modify it -# under the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation; either version 2.1 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# Copyright (C) 2012 Harald Hoyer -# Copyright (C) 2012 Kay Sievers - -if (( $# != 2 )); then - echo "Usage: $0 " >&2 - exit 1 -fi - -KERNEL_VERSION="$1" -KERNEL_IMAGE="$2" - -if ! [[ -f $KERNEL_IMAGE ]]; then - echo "Can't find file $KERNEL_IMAGE!" >&2 - exit 1 -fi - -if [[ -d /boot/loader/entries ]]; then - EFI_DIR="/boot" -elif [[ -d /boot/efi/loader/entries ]]; then - EFI_DIR="/boot/efi" -fi - -if ! [[ $EFI_DIR ]] ; then - 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 - INITRD_IMAGE=${KERNEL_IMAGE/vmlinuz/initrd} -elif [[ -f ${KERNEL_IMAGE/vmlinuz/initrd}.img ]]; then - INITRD_IMAGE=${KERNEL_IMAGE/vmlinuz/initrd}.img -elif [[ -f ${KERNEL_IMAGE/vmlinuz/initramfs}.img ]]; then - INITRD_IMAGE=${KERNEL_IMAGE/vmlinuz/initramfs}.img -fi - -if [[ -f /etc/kernel/cmdline ]]; then - while read line; do - BOOT_OPTIONS+="$line " - done < /etc/kernel/cmdline -fi -if ! [[ $BOOT_OPTIONS ]]; then - while read line; do - BOOT_OPTIONS+="$line " - done < /proc/cmdline -fi -if ! [[ $BOOT_OPTIONS ]]; then - 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 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 create /etc/machine-id!" >&2 - echo "See http://www.freedesktop.org/software/systemd/man/machine-id.html" >&2 - exit 1 -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 $PRETTY_NAME" - echo "version $KERNEL_VERSION" - echo "machine-id $MACHINE_ID" - 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" - -# now cleanup the old entries and files, for which no /lib/modules/$KERNEL_VERSION exists -( - cd ${EFI_DIR}/loader/entries - for conf in ${ID}-*-${MACHINE_ID}.conf; do - KERNEL_VERSION=${conf##$ID-} - KERNEL_VERSION=${KERNEL_VERSION%%-$MACHINE_ID.conf} - [[ $KERNEL_VERSION ]] || continue - [[ -d /lib/modules/${KERNEL_VERSION}/kernel ]] && continue - rm -f "$conf" - rm -f "${EFI_DIR}/${ID}/${MACHINE_ID}/*${KERNEL_VERSION}*" - done -) - -exit 0 -- 2.7.4