criu/test/zdtm/static/binfmt_misc.hook
Pavel Tikhomirov 838a59087d zdtm/static/binfmt_misc: run cleanup hook before restore
In ns flavor for instance the binfmt_misc is not c/r-ed, but without
this cleanup the test will not detect that as it would inherit correct
unchanged binfmt_misc step which was there on dump.

Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
2026-02-17 17:07:29 +00:00

22 lines
409 B
Bash
Executable file

#!/bin/bash
[ "$1" == "--clean" ] || [ "$1" == "--pre-restore" ] || exit 0
name=$(basename -s .hook $0).test
tname=$(mktemp -d binfmt_misc.XXXXXX)
mount -t binfmt_misc none $tname
echo "Cleaning $name: $@"
set +e
if [ -e $tname/${name}_magic ]; then
echo -1 > $tname/${name}_magic
fi
if [ -e $tname/${name}_extension ]; then
echo -1 > $tname/${name}_extension
fi
set -e
umount "$tname"
rmdir "$tname"