void-packages/srcpkgs/refind/files/kernel.post-remove

27 lines
600 B
Bash
Executable File

#!/bin/sh
#
# Kernel hook for refind.
#
# Arguments passed to this script: $1 pkgname, $2 version.
#
PKGNAME="$1"
VERSION="$2"
. "${ROOTDIR}/etc/default/refind-kernel-hook.conf"
if [ "z$UPDATE_REFIND_CONF" != "z1" ]; then
exit 0;
fi
# Default refind.conf
: "${REFIND_CONF:=boot/EFI/refind/refind.conf}"
# Make sure paths are relative
REFIND_CONF="${REFIND_CONF#/}"
[ -f "$REFIND_CONF" ] || exit 0
tmpfile=$(mktemp /tmp/refind.XXXXXXX)
zversion=$(echo $VERSION | sed 's/[.]/[.]/g')
sed "/^menuentry \"Void Linux $zversion\" [{]\$/,/[}]/d" "$REFIND_CONF" >"$tmpfile"
mv "$tmpfile" "$REFIND_CONF"