forked from josch/mmdebstrap
add file-mirror-automount hook-dir
parent
cc3150ef04
commit
b99f1d53d5
@ -0,0 +1,26 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -eu
|
||||
|
||||
if [ "$MMDEBSTRAP_VERBOSITY" -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"
|
||||
|
||||
echo "unmounting the following mountpoints:" >&2
|
||||
|
||||
cat "$rootdir/run/mmdebstrap/file-mirror-automount" \
|
||||
| xargs $xargsopts echo " $rootdir/{}"
|
||||
|
||||
cat "$rootdir/run/mmdebstrap/file-mirror-automount" \
|
||||
| xargs $xargsopts umount "$rootdir/{}"
|
||||
|
||||
rm "$rootdir/run/mmdebstrap/file-mirror-automount"
|
||||
rmdir --ignore-fail-on-non-empty "$rootdir/run/mmdebstrap"
|
@ -0,0 +1,20 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -eu
|
||||
|
||||
if [ "$MMDEBSTRAP_VERBOSITY" -ge 3 ]; then
|
||||
set -x
|
||||
fi
|
||||
|
||||
rootdir="$1"
|
||||
|
||||
env APT_CONFIG=$MMDEBSTRAP_APT_CONFIG apt-get indextargets --no-release-info \
|
||||
| sed -ne 's/^Repo-URI: file:\/\+//p' \
|
||||
| sort -u \
|
||||
| while read path; do
|
||||
echo "bind-mounting /$path into the chroot" >&2
|
||||
mkdir -p "$rootdir/run/mmdebstrap"
|
||||
mkdir -p "$rootdir/$path"
|
||||
mount -o ro,bind "/$path" "$rootdir/$path"
|
||||
printf '/%s\0' "$path" >> "$rootdir/run/mmdebstrap/file-mirror-automount"
|
||||
done
|
Loading…
Reference in New Issue