make_mirror.sh: create debootstrap directory with mktemp

if debootstrap is run without qemu and make_mirror.sh is aborted the
partly debootstrapped directory is left over. To avoid debootstrapping
into the same directory (and failing at it) we generate a new temporary
directory every time with mktemp
This commit is contained in:
Johannes 'josch' Schauer 2020-05-01 23:59:45 +02:00
parent af4e77903b
commit c462a080c3
Signed by: josch
GPG key ID: F2CBA5C78FBD83E1

View file

@ -558,15 +558,17 @@ fi
mirror="http://127.0.0.1/debian" mirror="http://127.0.0.1/debian"
for dist in stable testing unstable; do for dist in stable testing unstable; do
for variant in minbase buildd -; do for variant in minbase buildd -; do
echo running debootstrap --no-merged-usr --variant=$variant $dist /tmp/debian-$dist-debootstrap $mirror echo "running debootstrap --no-merged-usr --variant=$variant $dist \${TEMPDIR} $mirror"
cat << END > shared/test.sh cat << END > shared/test.sh
#!/bin/sh #!/bin/sh
set -eu set -eu
export LC_ALL=C.UTF-8 export LC_ALL=C.UTF-8
export SOURCE_DATE_EPOCH=$SOURCE_DATE_EPOCH export SOURCE_DATE_EPOCH=$SOURCE_DATE_EPOCH
debootstrap --no-merged-usr --variant=$variant $dist /tmp/debian-$dist-debootstrap $mirror tmpdir="\$(mktemp -d)"
tar --sort=name --mtime=@$SOURCE_DATE_EPOCH --clamp-mtime --numeric-owner --one-file-system --xattrs -C /tmp/debian-$dist-debootstrap -c . > "$newcache/debian-$dist-$variant.tar" chmod 755 "\$tmpdir"
rm -r /tmp/debian-$dist-debootstrap debootstrap --no-merged-usr --variant=$variant $dist "\$tmpdir" $mirror
tar --sort=name --mtime=@$SOURCE_DATE_EPOCH --clamp-mtime --numeric-owner --one-file-system --xattrs -C "\$tmpdir" -c . > "$newcache/debian-$dist-$variant.tar"
rm -r "\$tmpdir"
END END
if [ "$HAVE_QEMU" = "yes" ]; then if [ "$HAVE_QEMU" = "yes" ]; then
cachedir=$newcachedir ./run_qemu.sh cachedir=$newcachedir ./run_qemu.sh