diff options
-rw-r--r-- | sys-kernel/linux/linux-4.12.12-r2.ebuild (renamed from sys-kernel/linux/linux-4.12.12-r1.ebuild) | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/sys-kernel/linux/linux-4.12.12-r1.ebuild b/sys-kernel/linux/linux-4.12.12-r2.ebuild index 47e48ea..f1df147 100644 --- a/sys-kernel/linux/linux-4.12.12-r1.ebuild +++ b/sys-kernel/linux/linux-4.12.12-r2.ebuild @@ -49,14 +49,26 @@ src_link() { ) } +sysfile() { + if [ -f "${ROOT}/boot/syslinux/syslinux.cfg" ]; then + SYSLINUX="${ROOT}/boot/syslinux/syslinux.cfg" + PFIX=".." + elseif [ -f "${ROOT}/boot/EFI/BOOT/syslinux.cfg" ]; then + SYSLINUX="${ROOT}/boot/EFI/BOOT/syslinux.cfg" + PFIX="../../.." + else + eerror "Can't locate syslinux configuration!" + fi +} + pkg_postinst() { + sysfile # Add label to syslinux config if there is non yet - SYSLINUX="${ROOT}/boot/syslinux/syslinux.cfg" if ! grep -q "^LABEL gentoo-${PV}$" "${SYSLINUX}"; then ARGS="$(grep -E "^# ARGS: " "${SYSLINUX}" | sed 's/^# ARGS: //')" if [ -n "$ARGS" ]; then - sed -i "/^## Dynamic labels ##$/a LABEL gentoo-${PV}\n\tMENU LABEL Gentoo ${PV}\n\tLINUX ../bzlinux-${PV}\n\tAPPEND ${ARGS}\n\tINITRD ../initramfs-gentoo\n" "${SYSLINUX}" || eerror "Adding label to syslinux configuration failed!" - sed -i "/^## Dynamic recovery labels ##$/a LABEL gentoo-${PV}-recovery\n\tMENU LABEL Gentoo ${PV} - Recovery\n\tLINUX ../bzlinux-${PV}\n\tAPPEND ${ARGS} recovery\n\tINITRD ../initramfs-gentoo\n" "${SYSLINUX}" || eerror "Adding recovery label to syslinux configuration failed!" + sed -i "/^## Dynamic labels ##$/a LABEL gentoo-${PV}\n\tMENU LABEL Gentoo ${PV}\n\tLINUX ${PFIX}/bzlinux-${PV}\n\tAPPEND ${ARGS}\n\tINITRD ${PFIX}/initramfs-gentoo\n" "${SYSLINUX}" || eerror "Adding label to syslinux configuration failed!" + sed -i "/^## Dynamic recovery labels ##$/a LABEL gentoo-${PV}-recovery\n\tMENU LABEL Gentoo ${PV} - Recovery\n\tLINUX ${PFIX}/bzlinux-${PV}\n\tAPPEND ${ARGS} recovery\n\tINITRD ${PFIX}/initramfs-gentoo\n" "${SYSLINUX}" || eerror "Adding recovery label to syslinux configuration failed!" else eerror "Adding label to syslinux configuration failed as there are no arguments" fi @@ -65,8 +77,9 @@ pkg_postinst() { } pkg_prerm() { + sysfile # Remove label from syslinux config - sed -i "/^LABEL gentoo-${PV}\(\|-recovery\)$/,/^$/d" /boot/syslinux/syslinux.cfg || eerror "Removing label from syslinux fonfiguration failed!" + sed -i "/^LABEL gentoo-${PV}\(\|-recovery\)$/,/^$/d" "${SYSLINUX}" || eerror "Removing label from syslinux fonfiguration failed!" } pkg_postrm() { |