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

22 lines
425 B
Bash

#!/bin/sh
#
# Kernel hook for gummiboot.
#
# Arguments passed to this script: $1 pkgname, $2 version.
#
PKGNAME="$1"
VERSION="$2"
boot="$ROOTDIR/boot"
entries="$boot/loader/entries"
name="void-$VERSION"
entry="$entries/$name.conf"
loader="$boot/loader/loader.conf"
[ -d "$boot" ] || exit 0
rm -f "$entry"
# No default entry if the removed entry was the default:
[ -e "$loader" ] && sed -i "/^default $name\$/d" "$loader"