mkimage-profiles/features.in/syslinux/scripts.d/20-propagator-rescue-hash-syslinux
Anton Midyukov 83109b6bc4 syslinux: Add grub-pc compatibility
Directory syslinux can exist if using memtest feature.
2021-02-15 17:05:54 +07:00

21 lines
519 B
Bash
Executable File

#!/bin/sh
# postprocess isolinux configuration
# to add rescue image hash, if any
# (for propagator in forensic mode)
# validate just in case (see also stage1 Makefile)
if [ -z "$(find $WORKDIR/syslinux/*.cfg)" ]; then
echo "Warning: syslinux/*.cfg not found"
exit 0
fi
cd "$WORKDIR"
grep -qs "@rescue_hash@" syslinux/*.cfg || exit 0
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," syslinux/*.cfg
done