From a0e2c70ebad15c49513f034ce2f05919e5470bc3 Mon Sep 17 00:00:00 2001 From: Johannes 'josch' Schauer Date: Sun, 24 Feb 2019 11:05:18 +0100 Subject: [PATCH] make_mirror.sh: only rm oldcachedir if it exists --- make_mirror.sh | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/make_mirror.sh b/make_mirror.sh index 8bc4517..bde5c95 100755 --- a/make_mirror.sh +++ b/make_mirror.sh @@ -403,7 +403,13 @@ done if [ -e $oldcachedir/debian-unstable.qcow ]; then rm --one-file-system $oldcachedir/debian-unstable.qcow fi -rm --one-file-system --recursive $oldcachedir/debian/pool/main -rm --one-file-system --recursive $oldcachedir/debian-security/pool/updates/main +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 -find $oldcachedir -depth -print0 | xargs -0 rmdir +if [ -e $oldcachedir ]; then + find $oldcachedir -depth -print0 | xargs -0 rmdir +fi