void-packages/srcpkgs/lilo/files/kernel.d/lilo.post-remove

30 lines
603 B
Plaintext
Raw Normal View History

2015-02-14 16:57:45 +01:00
#!/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}"