20-propagator-rescue-hash-grub 349 Bytes
Newer Older
Alexey Shabalin's avatar
Alexey Shabalin committed
1
#!/bin/sh
2
# postprocess grub configuration
Alexey Shabalin's avatar
Alexey Shabalin committed
3 4 5 6
# to add rescue image hash, if any
# (for propagator in forensic mode)

cd "$WORKDIR"
7
cfg='boot/grub/grub.cfg'
Alexey Shabalin's avatar
Alexey Shabalin committed
8

9
[ -f "$cfg" ] || exit 0
Alexey Shabalin's avatar
Alexey Shabalin committed
10 11 12 13

find -maxdepth 1 -type f -name rescue \
| while read image; do
	rescue_hash="$(sha256sum -b "$image" | cut -f1 -d' ')"
14
	sed -i "s,@rescue_hash@,$rescue_hash," $cfg
Alexey Shabalin's avatar
Alexey Shabalin committed
15
done