diff options
author | Thomas Bächler <thomas@archlinux.org> | 2009-08-16 15:45:00 +0200 |
---|---|---|
committer | Thomas Bächler <thomas@archlinux.org> | 2009-08-16 15:45:00 +0200 |
commit | a51de5f2ba853a64fc9842e337cb25e000fdbbc1 (patch) | |
tree | bdc0b8867aadd2fe6f59925fd55031eaf79380e5 | |
parent | 5fa1331e0949f4cbdc6cbe0a6946e3fd185979b7 (diff) | |
download | dbscripts-a51de5f2ba853a64fc9842e337cb25e000fdbbc1.tar.gz dbscripts-a51de5f2ba853a64fc9842e337cb25e000fdbbc1.tar.xz |
Make ftpdir-cleanup NOT delete all packages if databas extraction fails
-rwxr-xr-x | misc-scripts/ftpdir-cleanup | 13 |
1 files changed, 12 insertions, 1 deletions
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) |