make_mirror.sh: only rm oldcachedir if it exists

This commit is contained in:
Johannes 'josch' Schauer 2019-02-24 11:05:18 +01:00
parent c0ac77b01d
commit a0e2c70eba
Signed by: josch
GPG key ID: F2CBA5C78FBD83E1

View file

@ -403,7 +403,13 @@ done
if [ -e $oldcachedir/debian-unstable.qcow ]; then
rm --one-file-system $oldcachedir/debian-unstable.qcow
fi
if [ -e $oldcachedir/debian/pool/main ]; then
rm --one-file-system --recursive $oldcachedir/debian/pool/main
fi
if [ -e $oldcachedir/debian-security/pool/updates/main ]; then
rm --one-file-system --recursive $oldcachedir/debian-security/pool/updates/main
fi
# now the rest should only be empty directories
if [ -e $oldcachedir ]; then
find $oldcachedir -depth -print0 | xargs -0 rmdir
fi