2015-02-14 22:24:10 +01:00

36 lines
724 B
Bash

#!/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}"