From a51de5f2ba853a64fc9842e337cb25e000fdbbc1 Mon Sep 17 00:00:00 2001 From: Thomas Bächler Date: Sun, 16 Aug 2009 15:45:00 +0200 Subject: Make ftpdir-cleanup NOT delete all packages if databas extraction fails --- misc-scripts/ftpdir-cleanup | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'misc-scripts') diff --git a/misc-scripts/ftpdir-cleanup b/misc-scripts/ftpdir-cleanup index 9331a4e..222811b 100755 --- a/misc-scripts/ftpdir-cleanup +++ b/misc-scripts/ftpdir-cleanup @@ -58,7 +58,18 @@ for arch in ${ARCHES[@]}; do exit 1 fi - bsdtar xf "$ftppath/$reponame.db.tar.$DB_COMPRESSION" + if [ ! -f "$ftppath/$reponame.db.tar.$DB_COMPRESSION" ]; then + echo "" + echo "ERROR: The file \"$ftppath/$reponame.db.tar.$DB_COMPRESSION\" could not be found, aborting." + echo "" + exit 1 + fi + + if ! bsdtar xf "$ftppath/$reponame.db.tar.$DB_COMPRESSION"; then + echo "" + echo "ERROR: Command failed: bsdtar xf \"$ftppath/$reponame.db.tar.$DB_COMPRESSION\"" + exit 1 + fi for pkg in *; do filename=$(grep -A1 '^%FILENAME%$' "${pkg}/desc" | tail -n1) -- cgit v1.2.3-24-g4f1b