From 7480b18c2fcdd674b13fd098ac5c3b9dcdc4dadd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6ren=20Tempel?= Date: Sat, 14 Feb 2015 16:57:45 +0100 Subject: [PATCH] lilo: add kernel hooks --- srcpkgs/lilo/files/kernel.d/lilo.post-install | 35 +++++++++++++++++++ srcpkgs/lilo/files/kernel.d/lilo.post-remove | 29 +++++++++++++++ srcpkgs/lilo/files/lilo.conf | 29 +++++++++++++++ srcpkgs/lilo/template | 19 +++++++--- 4 files changed, 108 insertions(+), 4 deletions(-) create mode 100644 srcpkgs/lilo/files/kernel.d/lilo.post-install create mode 100644 srcpkgs/lilo/files/kernel.d/lilo.post-remove create mode 100644 srcpkgs/lilo/files/lilo.conf diff --git a/srcpkgs/lilo/files/kernel.d/lilo.post-install b/srcpkgs/lilo/files/kernel.d/lilo.post-install new file mode 100644 index 0000000000..dd4d2c7075 --- /dev/null +++ b/srcpkgs/lilo/files/kernel.d/lilo.post-install @@ -0,0 +1,35 @@ +#!/bin/sh +# +# Kernel hook for LILO. +# +# Arguments passed to this script: $1 pkgname, $2 version. +# +PKGNAME="${1}" +VERSION="${2}" + +boot="${ROOTDIR}/boot" +etc="${ROOTDIR}/etc" +entries="${etc}/lilo.d" +name="void-${VERSION}" +entry="${entries}/${name}.conf" + +[ -d "${boot}" ] && [ -d "${etc}" ] || exit 0 +mkdir -p "${entries}" + +cat <<-EOF > "${entry}" +image = /${boot}/vmlinuz-${VERSION} + label = "${name}" + initrd = /${boot}/initramfs-${VERSION}.img +EOF + +# Replace existing default entry with this one +echo "default=${name}" > "${entries}/default.conf" + +conf="$(mktemp)" +cat "${etc}/lilo.conf" "${entries}"/*.conf > "${conf}" + +[ -x "$(command -v lilo)" ] && \ + lilo -C "${conf}" + +# Remove temporary config file +rm -f "${conf}" diff --git a/srcpkgs/lilo/files/kernel.d/lilo.post-remove b/srcpkgs/lilo/files/kernel.d/lilo.post-remove new file mode 100644 index 0000000000..7d7bab1767 --- /dev/null +++ b/srcpkgs/lilo/files/kernel.d/lilo.post-remove @@ -0,0 +1,29 @@ +#!/bin/sh +# +# Kernel hook for LILO. +# +# Arguments passed to this script: $1 pkgname, $2 version. +# +PKGNAME="${1}" +VERSION="${2}" + +boot="${ROOTDIR}/boot" +etc="${ROOTDIR}/etc" +entries="${etc}/lilo.d" +name="void-${VERSION}" +entry="${entries}/${name}.conf" + +[ -d "${boot}" ] && [ -d "${etc}" ] || exit 0 +rm -f "${entry}" + +# No default entry if the removed one was the default +sed "/^default=${name}\$/d" -i "${entries}/default.conf" + +conf="$(mktemp)" +cat "${etc}/lilo.conf" "${entries}"/*.conf > "${conf}" + +[ -x "$(command -v lilo)" ] && \ + lilo -C "${conf}" + +# Remove temporary config file +rm -f "${conf}" diff --git a/srcpkgs/lilo/files/lilo.conf b/srcpkgs/lilo/files/lilo.conf new file mode 100644 index 0000000000..1828438ca3 --- /dev/null +++ b/srcpkgs/lilo/files/lilo.conf @@ -0,0 +1,29 @@ +# Example lilo(8) configuration. +# See lilo.conf(5) for more information. + +# Additional kernel parameter. +append="quiet" + +# Specifies the boot device. +boot="/dev/sda" + +# Devices which should be mounted as root. +root="/dev/sda2" + +# Enables map compaction. +compact + +# Prompt to start one certain kernel from the displayed menu. +prompt + +# Time to wait before booting the default kernel. +timeout=100 + +# Allow use of partitions above 1024 cylinders. +lba32 + +# Mount the root file system read-only. +read-only + +# Images are configured in /etc/lilo.d/*.conf +# End of file diff --git a/srcpkgs/lilo/template b/srcpkgs/lilo/template index 6f0fc1f8d7..46de6997dc 100644 --- a/srcpkgs/lilo/template +++ b/srcpkgs/lilo/template @@ -1,10 +1,11 @@ # Template file for 'lilo' pkgname=lilo version=24.1 -revision=1 +revision=2 only_for_archs="i686 x86_64" hostmakedepends="bin86" makedepends="device-mapper-devel" +make_dirs="/etc/lilo.d 0755 root root" conf_files="/etc/lilo.conf" short_desc="Standard Linux boot loader" maintainer="Sören Tempel " @@ -21,12 +22,22 @@ pre_build() { do_build() { # LILO needs LC_ALL=C - LC_ALL=C make CC=$CC all + export LC_ALL=C + make CC=${CC} all } do_install() { make DESTDIR=${DESTDIR} install - rm -r ${DESTDIR}/etc/initramfs ${DESTDIR}/etc/kernel mv ${DESTDIR}/sbin/* ${DESTDIR}/usr/sbin - mv ${DESTDIR}/etc/lilo.conf_example ${DESTDIR}/etc/lilo.conf + + # Setup config files + rm ${DESTDIR}/etc/lilo.conf_example + vinstall ${FILESDIR}/lilo.conf 600 etc + + # Setup kernel hooks + rm -rf ${DESTDIR}/etc/initramfs ${DESTDIR}/etc/kernel + vinstall ${FILESDIR}/kernel.d/lilo.post-install 750 \ + etc/kernel.d/post-install 50-lilo + vinstall ${FILESDIR}/kernel.d/lilo.post-remove 750 \ + etc/kernel.d/post-remove 50-lilo }