diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-13 14:14:39 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-13 14:14:39 +0000 |
commit | ee17e45964b786b48b455959dfe68715971893fb (patch) | |
tree | 118f40aa65dc838499053413b05adfd00f839c62 /hooks/file-mirror-automount/customize00.sh | |
parent | Initial commit. (diff) | |
download | mmdebstrap-ee17e45964b786b48b455959dfe68715971893fb.tar.xz mmdebstrap-ee17e45964b786b48b455959dfe68715971893fb.zip |
Adding upstream version 1.4.3.upstream/1.4.3
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'hooks/file-mirror-automount/customize00.sh')
-rwxr-xr-x | hooks/file-mirror-automount/customize00.sh | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/hooks/file-mirror-automount/customize00.sh b/hooks/file-mirror-automount/customize00.sh new file mode 100755 index 0000000..b6b9b46 --- /dev/null +++ b/hooks/file-mirror-automount/customize00.sh @@ -0,0 +1,41 @@ +#!/bin/sh +# +# shellcheck disable=SC2086 + +set -eu + +if [ "${MMDEBSTRAP_VERBOSITY:-1}" -ge 3 ]; then + 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" + +case $MMDEBSTRAP_MODE in + root|unshare) + echo "unmounting the following mountpoints:" >&2 ;; + *) + echo "removing the following directories:" >&2 ;; +esac + +< "$rootdir/run/mmdebstrap/file-mirror-automount" \ + xargs $xargsopts echo " $rootdir/{}" + +case $MMDEBSTRAP_MODE in + root|unshare) + < "$rootdir/run/mmdebstrap/file-mirror-automount" \ + xargs $xargsopts umount "$rootdir/{}" + ;; + *) + < "$rootdir/run/mmdebstrap/file-mirror-automount" \ + xargs $xargsopts rm -r "$rootdir/{}" + ;; +esac + +rm "$rootdir/run/mmdebstrap/file-mirror-automount" +rmdir --ignore-fail-on-non-empty "$rootdir/run/mmdebstrap" |