summaryrefslogtreecommitdiffstats
path: root/db-update
diff options
context:
space:
mode:
authorAaron Griffin <aaronmgriffin@gmail.com>2008-05-07 07:34:19 +0200
committerAaron Griffin <aaronmgriffin@gmail.com>2008-05-07 07:34:19 +0200
commitaca168b4f23826d3dd5ad15d22ad9a564f69a40d (patch)
tree299827d7687accd61e55f58a1f4c96504bf09842 /db-update
parent054f2b100691c83ac9f99bfae0a823144c5460d9 (diff)
downloaddbscripts-aca168b4f23826d3dd5ad15d22ad9a564f69a40d.tar.gz
dbscripts-aca168b4f23826d3dd5ad15d22ad9a564f69a40d.tar.xz
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>
Diffstat (limited to 'db-update')
-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: