summaryrefslogtreecommitdiff
path: root/db-remove
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2010-08-08 16:03:11 +0200
committerPierre Schmitz <pierre@archlinux.de>2010-08-08 16:03:11 +0200
commit830c4d84d13712974ffd392cdcc58b038c0dcfd9 (patch)
tree43ebdbef0d019de1d6dfda8a1f4a98dc94284375 /db-remove
parent8a377f398ef5a01f8b52695597152c49d7a64f96 (diff)
Source PKGBUILD in subshells
This patch sources a PKGBUILD in a subshells instead of directly. This way we don't polute our scope or overwrite our vars which might lead to unexpected behavior.
Diffstat (limited to 'db-remove')
-rwxr-xr-xdb-remove22
1 files changed, 11 insertions, 11 deletions
diff --git a/db-remove b/db-remove
index 5d61c97..5a55849 100755
--- a/db-remove
+++ b/db-remove
@@ -10,12 +10,12 @@ fi
packagebase="$1"
reponame="$2"
-_arch="$3"
+arch="$3"
ftppath="$FTP_BASE/$reponame/os"
-svnrepo="$reponame-$_arch"
+svnrepo="$reponame-$arch"
-repo_lock $reponame $_arch || exit 1
+repo_lock $reponame $arch || exit 1
echo -n "Removing $packagebase from $reponame..."
cd "$WORKDIR"
@@ -24,7 +24,7 @@ cd checkout
/usr/bin/svn up -q $packagebase
if [ -d "$packagebase/repos/$svnrepo" ]; then
- . "$packagebase/repos/$svnrepo/PKGBUILD"
+ pkgname=($(. "$packagebase/repos/$svnrepo/PKGBUILD"; echo ${pkgname[@]}))
/usr/bin/svn rm --force -q "$packagebase/repos/$svnrepo"
/usr/bin/svn commit -q -m "$(basename $0): $packagebase removed by $(id -un)"
else
@@ -33,23 +33,23 @@ fi
cd "$WORKDIR"
-if [ "$_arch" == "any" ]; then
+if [ "$arch" == "any" ]; then
arches="i686 x86_64"
else
- arches="$_arch"
+ arches="$arch"
fi
# copy the db file into our working area
-for arch in $arches; do
- if [ ! -f "$ftppath/$arch/$reponame$DBEXT" ]; then
- die "No database found at '$ftppath/$arch', nothing more to do"
+for tarch in $arches; do
+ if [ ! -f "$ftppath/$tarch/$reponame$DBEXT" ]; then
+ die "No database found at '$ftppath/$tarch', nothing more to do"
fi
- /usr/bin/repo-remove -q "$ftppath/$arch/$reponame$DBEXT" ${pkgname[@]} >/dev/null
+ /usr/bin/repo-remove -q "$ftppath/$tarch/$reponame$DBEXT" ${pkgname[@]} >/dev/null
done
echo 'done'
-repo_unlock $reponame $_arch || exit 1
+repo_unlock $reponame $arch || exit 1
# vim: set ts=4 sw=4 noet ft=sh: