/usr/sbin/update-gummiboot is in gummiboot 48-1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 | #!/bin/sh
#
# Copyright (C) 2014 Julian Andres Klode <jak@debian.org>
#
#
set -e
set -u
# Load PRETTY_NAME and MACHINE_ID
. /etc/os-release
MACHINE_ID=$(cat /etc/machine-id)
# Kernel
if [ "$#" -lt 1 ]; then
KERNEL="$(uname -r)"
else
KERNEL="$1"
fi
# Default options
GUMMIBOOT_EFI="/boot/efi"
GUMMIBOOT_ROOT=""
GUMMIBOOT_OPTIONS="ro quiet"
# TODO: This needs to be done more clever
determine_root() {
sed 's/#.*//g' /etc/fstab | awk '($2 == "/") {print $1}'
}
install_kernel() {
install -D /boot/vmlinuz-$KERNEL $GUMMIBOOT_EFI/$MACHINE_ID/$KERNEL/linux
if [ -e /boot/initrd.img-$KERNEL ]; then
install -D /boot/initrd.img-$KERNEL $GUMMIBOOT_EFI/$MACHINE_ID/$KERNEL/initrd
fi
}
install_entry() {
dir="$GUMMIBOOT_EFI/loader/entries/"
entry="$dir/$MACHINE_ID-$KERNEL.conf"
options="root=$GUMMIBOOT_ROOT $GUMMIBOOT_OPTIONS"
[ -e $dir ] || mkdir -p $dir
cat > $entry << EOF
title $PRETTY_NAME
version $KERNEL
machine-id $MACHINE_ID
options $options
linux /$MACHINE_ID/$KERNEL/linux
EOF
if [ -e $GUMMIBOOT_EFI/$MACHINE_ID/$KERNEL/initrd ]; then
echo "initrd /$MACHINE_ID/$KERNEL/initrd" >> $entry
fi
}
if [ -e /etc/default/gummiboot ]; then
. /etc/default/gummiboot
fi
if [ -z "$GUMMIBOOT_ROOT" ] ; then
GUMMIBOOT_ROOT="$(determine_root)"
fi
do_install() {
if [ -z "$GUMMIBOOT_ROOT" ]; then
echo "ERROR: Cannot determine root partition, please set it in one of:" >&2
echo " /etc/fstab" >&2
echo " /etc/default/gummiboot" >&2
exit 1
fi
echo "Install $KERNEL to ESP" >&2
install_kernel
install_entry
}
do_remove() {
echo "Remove $KERNEL from ESP" >&2
rm -r $GUMMIBOOT_EFI/$MACHINE_ID/$KERNEL/ || true
rm $GUMMIBOOT_EFI/loader/entries/$MACHINE_ID-$KERNEL.conf || true
}
if [ -e /boot/vmlinuz-$KERNEL ]; then
do_install
else
do_remove
fi
|