From bbf00cc90ed8d1bf3bbed1f78acca71b2d624ee2 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Tue, 1 Nov 2011 09:55:26 -0500 Subject: db-repo-{add, remove}: allow specifying multiple packages This allows invoking these commands for more than one package at a time which is incredibly more efficient as the database doesn't need to be locked, unpacked, modified, changed, and unlocked for every single passed package name or file if you have more than one. Signed-off-by: Dan McGee --- db-repo-add | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'db-repo-add') diff --git a/db-repo-add b/db-repo-add index 8d4a56d..9661b91 100755 --- a/db-repo-add +++ b/db-repo-add @@ -3,14 +3,14 @@ . "$(dirname $0)/db-functions" . "$(dirname $0)/config" -if [ $# -ne 3 ]; then - msg "usage: $(basename $0) " +if [ $# -lt 3 ]; then + msg "usage: $(basename $0) ..." exit 1 fi repo="$1" arch="$2" -pkgfile="$3" +pkgfiles=(${@:3}) ftppath="$FTP_BASE/$repo/os" @@ -28,12 +28,14 @@ for tarch in ${tarches[@]}; do repo_lock $repo $tarch || exit 1 done -msg "Adding $pkgfile to [$repo]..." - for tarch in ${tarches[@]}; do - if [ ! -f "${pkgfile}" ]; then - die "Package file ${pkgfile} not found" - fi - arch_repo_add "${repo}" "${tarch}" ${pkgfile} + for pkgfile in ${pkgfiles[@]}; do + if [[ ! -f $pkgfile ]]; then + die "Package file $pkgfile not found" + else + msg "Adding $pkgfile to [$repo]..." + fi + done + arch_repo_add "${repo}" "${tarch}" ${pkgfiles[@]} repo_unlock $repo $tarch done -- cgit v1.2.3