void-packages/srcpkgs/refind/files/kernel.post-remove
Doan Tran Cong Danh 7b1cb97f79 refind: eliminate ed dependency
post-install now depends on
- coreutils (df, mkdir, mktemp, mv, touch)
- awk

post-remove depends on:
- sed
2019-11-24 13:24:32 +01:00

25 lines
549 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="${REFIND_CONF:-/boot/EFI/refind/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"