void-packages/srcpkgs/gummiboot/files/kernel.d/gummiboot.post-install
Eivind Uggedal e83df02215 gummiboot: fix removal of loader entries
Stop using $PKGNAME (linux3.XX) in post-install since post-remove
gets $PKGNAME as linux through vkpurge.
2014-11-06 01:03:27 +01:00

39 lines
846 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
options=$boot/loader/void-options.conf
loader=$boot/loader/loader.conf
[ -d $boot ] || exit 0
mkdir -p $entries
cat <<-EOF > $entry
title Void Linux
version $VERSION
linux /vmlinuz-$VERSION
initrd /initramfs-$VERSION.img
EOF
if [ -r $options ]; then
# Add user provided options from /boot/loader/void-options.conf:
printf 'options %s\n' "$(cat $options | sed '/^#/d;/^$/d')" >> $entry
fi
if grep -q ^default $loader 2>/dev/null; then
# Replace existing default entry with this entry:
sed -i "s/default.*/default $name/" $loader
else
# Add this entry as the default:
printf 'default %s\n' $name >>$loader
fi