You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
mkimage-profiles-kometa/bld/scripts.d/20-propagator-rescue-hash-grub

16 lines
349 B

3 years ago
#!/bin/sh
# postprocess grub configuration
# to add rescue image hash, if any
# (for propagator in forensic mode)
cd "$WORKDIR"
cfg='boot/grub/grub.cfg'
[ -f "$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," $cfg
done