mkimage-profiles/features.in/grub/scripts.d/20-propagator-rescue-hash-grub
Anton Midyukov 86f52450a1 grub: generate grub.cfg for grub-efi and ieee1275boot
These changes allow you to create two independent config at the same
time or separately. It will be possible to add support for grub-pc in
the future.
2020-04-03 22:56:58 +07:00

19 lines
487 B
Bash
Executable File

#!/bin/sh
# postprocess isolinux configuration
# to add rescue image hash, if any
# (for propagator in forensic mode)
cd "$WORKDIR"
[ -f boot/grub/grub.cfg -o -f EFI/BOOT/grub.cfg ] || exit 0
cfgs=
[ ! -f boot/grub/grub.cfg ] || cfgs+='boot/grub/grub.cfg '
[ ! -f EFI/BOOT/grub.cfg ] || cfgs+='EFI/BOOT/grub.cfg'
find -maxdepth 1 -type f -name rescue \
| while read image; do
rescue_hash="$(sha256sum -b "$image" | cut -f1 -d' ')"
sed -i "s,@rescue_hash@,$rescue_hash," $cfgs
done