2022-05-24 11:16:24 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
set -eu
|
|
|
|
|
2022-10-16 13:20:59 +00:00
|
|
|
if [ "${MMDEBSTRAP_VERBOSITY:-1}" -ge 3 ]; then
|
2022-05-24 11:16:24 +00:00
|
|
|
set -x
|
|
|
|
fi
|
|
|
|
|
|
|
|
rootdir="$1"
|
|
|
|
|
|
|
|
if [ ! -e "$rootdir/run/mmdebstrap/file-mirror-automount" ]; then
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
|
|
|
xargsopts="--null --no-run-if-empty -I {} --max-args=1"
|
|
|
|
|
2022-05-29 07:31:12 +00:00
|
|
|
case $MMDEBSTRAP_MODE in
|
|
|
|
root|unshare)
|
|
|
|
echo "unmounting the following mountpoints:" >&2 ;;
|
|
|
|
*)
|
|
|
|
echo "removing the following directories:" >&2 ;;
|
|
|
|
esac
|
2022-05-24 11:16:24 +00:00
|
|
|
|
|
|
|
cat "$rootdir/run/mmdebstrap/file-mirror-automount" \
|
|
|
|
| xargs $xargsopts echo " $rootdir/{}"
|
|
|
|
|
2022-05-29 07:31:12 +00:00
|
|
|
case $MMDEBSTRAP_MODE in
|
|
|
|
root|unshare)
|
|
|
|
cat "$rootdir/run/mmdebstrap/file-mirror-automount" \
|
|
|
|
| xargs $xargsopts umount "$rootdir/{}"
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
cat "$rootdir/run/mmdebstrap/file-mirror-automount" \
|
|
|
|
| xargs $xargsopts rm -r "$rootdir/{}"
|
|
|
|
;;
|
|
|
|
esac
|
2022-05-24 11:16:24 +00:00
|
|
|
|
|
|
|
rm "$rootdir/run/mmdebstrap/file-mirror-automount"
|
|
|
|
rmdir --ignore-fail-on-non-empty "$rootdir/run/mmdebstrap"
|