mkimage-profiles/features.in/grub/scripts.d/20-propagator-rescue-hash-grub

16 lines
349 B
Plaintext
Raw Normal View History

2019-10-30 20:36:22 +03:00
#!/bin/sh
# postprocess grub configuration
2019-10-30 20:36:22 +03:00
# to add rescue image hash, if any
# (for propagator in forensic mode)
cd "$WORKDIR"
cfg='boot/grub/grub.cfg'
2019-10-30 20:36:22 +03:00
[ -f "$cfg" ] || exit 0
2019-10-30 20:36:22 +03:00
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," $cfg
2019-10-30 20:36:22 +03:00
done