summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron Griffin <aaronmgriffin@gmail.com>2008-05-07 01:34:19 -0400
committerAaron Griffin <aaronmgriffin@gmail.com>2008-05-07 01:34:19 -0400
commitaca168b4f23826d3dd5ad15d22ad9a564f69a40d (patch)
tree299827d7687accd61e55f58a1f4c96504bf09842
parent054f2b100691c83ac9f99bfae0a823144c5460d9 (diff)
Make sure we're actually adding/removing files
We accidentally were calling repo-add/repo-remove with invalid (empty) params. Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
-rwxr-xr-xdb-update49
1 files changed, 30 insertions, 19 deletions
diff --git a/db-update b/db-update
index 791207d..bde0ee9 100755
--- a/db-update
+++ b/db-update
@@ -122,15 +122,20 @@ if [ -n "$ADDPKGS" ]; then
fi
done
- cd "$WORKDIR"
- [ -d build/ ] || mkdir build
+ if [ -n "$to_add" ]; then
+
+ cd "$WORKDIR"
+ [ -d build/ ] || mkdir build
- # copy the db file into our working area
- [ -f "$ftppath/$reponame.db.tar.gz" ] && cp "$ftppath/$reponame.db.tar.gz" build/
- /bin/cp $to_add build/
+ # copy the db file into our working area
+ [ -f "$ftppath/$reponame.db.tar.gz" ] && cp "$ftppath/$reponame.db.tar.gz" build/
+ /bin/cp $to_add build/
- cd build/
- /usr/bin/repo-add "$reponame.db.tar.$DB_COMPRESSION" $to_add
+ cd build/
+ /usr/bin/repo-add "$reponame.db.tar.$DB_COMPRESSION" $to_add
+ else
+ echo "Errors found when adding packages"
+ fi
else
echo "No packages to add"
fi
@@ -162,21 +167,25 @@ if [ -n "$REMPKGS" ]; then
fi
done
- cd "$WORKDIR"
- [ -d build/ ] || mkdir build
+ if [ -n "$to_rem" ]; then
+ cd "$WORKDIR"
+ [ -d build/ ] || mkdir build
- # copy the db file into our working area
- [ -f "$ftppath/$reponame.db.tar.gz" ] && cp "$ftppath/$reponame.db.tar.gz" build/
+ # copy the db file into our working area
+ [ -f "$ftppath/$reponame.db.tar.gz" ] && cp "$ftppath/$reponame.db.tar.gz" build/
- cd build/
- /usr/bin/repo-remove "$reponame.db.tar.$DB_COMPRESSION" $to_rem
+ cd build/
+ /usr/bin/repo-remove "$reponame.db.tar.$DB_COMPRESSION" $to_rem
- for rem in $to_rem; do
- if [ -f "$ftppath/$rem" ]; then
- /bin/rm "$ftppath/$rem"
- /bin/rm "$rem"
- fi
- done
+ for rem in $to_rem; do
+ if [ -f "$ftppath/$rem" ]; then
+ /bin/rm "$ftppath/$rem"
+ /bin/rm "$rem"
+ fi
+ done
+ else
+ echo "Errors found when removing packages"
+ fi
else
echo "No packages to delete"
fi
@@ -188,4 +197,6 @@ if [ $(/bin/ls "$WORKDIR/build/" 2>/dev/null | wc -l) != 0 ]; then
else
echo "Nothing to copy, no work done"
fi
+
+cleanup
# vim: set ts=4 sw=4 noet ft=sh: