summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAbhishek Dasgupta <abhidg@gmail.com>2009-03-20 16:26:15 +0100
committerAbhishek Dasgupta <abhidg@gmail.com>2009-03-20 16:26:15 +0100
commit67e112955482397bae1971fa60e1634a92ec361c (patch)
tree4233afa6c9b3936b512631a30d6eab5ee135c309
parent60f7e2bf28bed7d18438d9378e19a82e8b6a2d24 (diff)
downloaddbscripts-67e112955482397bae1971fa60e1634a92ec361c.tar.gz
dbscripts-67e112955482397bae1971fa60e1634a92ec361c.tar.xz
'any' architecture support for db-move, db-remove
Also: changed empty variable '$ftpdir' in db-remove to '$ftppath/$architecture'
-rwxr-xr-xdb-move54
-rwxr-xr-xdb-remove36
2 files changed, 56 insertions, 34 deletions
diff --git a/db-move b/db-move
index e4f2fef..0759ba2 100755
--- a/db-move
+++ b/db-move
@@ -17,8 +17,8 @@ _arch="$4"
export CARCH="$_arch"
-ftppath_from="$FTP_BASE/$repofrom/os/$_arch/"
-ftppath_to="$FTP_BASE/$repoto/os/$_arch/"
+ftppath_from="$FTP_BASE/$repofrom/os/"
+ftppath_to="$FTP_BASE/$repoto/os/"
svnrepo_from="$repofrom-$_arch"
svnrepo_to="$repoto-$_arch"
svnpath="$(get_svnpath $repoto)"
@@ -67,7 +67,7 @@ if [ -d "$packagename/repos/$svnrepo_from" ]; then
. "$packagename/repos/$svnrepo_from/$BUILDSCRIPT"
_pkgfile="$pkgname-$pkgver-$pkgrel-$_arch$PKGEXT"
- if [ ! -f "$ftppath_from/$_pkgfile" ]; then
+ if [ ! -f "$ftppath_from/${_arch}/$_pkgfile" ]; then
die "error: package file '$_pkgfile' not found in repo '$repofrom'"
fi
@@ -86,23 +86,37 @@ if [ -d "$packagename/repos/$svnrepo_from" ]; then
[ -d build/ ] || mkdir build
cd build/
- # copy the db file into our working area
- if [ -f "$ftppath_from/$repofrom.db.tar.$DB_COMPRESSION" ]; then
- /bin/cp "$ftppath_from/$repofrom.db.tar.$DB_COMPRESSION" .
- /usr/bin/repo-remove -q "$repofrom.db.tar.$DB_COMPRESSION" $packagename || die "Error in repo-remove"
- #use '*' to move the old DB too
- mv $repofrom.db.tar.$DB_COMPRESSION* $ftppath_from
- echo " Package files will be cleaned up automatically"
- fi
-
- if [ -f "$ftppath_to/$repoto.db.tar.$DB_COMPRESSION" ]; then
- /bin/cp "$ftppath_to/$repoto.db.tar.$DB_COMPRESSION" .
- fi
-
- /bin/cp "$ftppath_from/$_pkgfile" .
- /usr/bin/repo-add -q "$repoto.db.tar.$DB_COMPRESSION" $_pkgfile || die "Error in repo-add"
- #use '*' to move the old DB too
- mv $repoto.db.tar.$DB_COMPRESSION* $_pkgfile $ftppath_to
+ if [ "${_arch}" == "any" ]; then
+ arches="i686 x86_64"
+ else
+ arches="${_arch}"
+ fi
+
+ for architecture in $arches; do
+ # copy the db file into our working area
+ if [ -f "$ftppath_from/$architecture/$repofrom.db.tar.$DB_COMPRESSION" ]; then
+ /bin/cp "$ftppath_from/$architecture/$repofrom.db.tar.$DB_COMPRESSION" .
+ /usr/bin/repo-remove -q "$repofrom.db.tar.$DB_COMPRESSION" $packagename || die "Error in repo-remove"
+ #use '*' to move the old DB too
+ mv $repofrom.db.tar.$DB_COMPRESSION* "$ftppath_from/$architecture"
+ echo " Package files will be cleaned up automatically"
+ fi
+
+ if [ -f "$ftppath_to/$architecture/$repoto.db.tar.$DB_COMPRESSION" ]; then
+ /bin/cp "$ftppath_to/$architecture/$repoto.db.tar.$DB_COMPRESSION" .
+ fi
+
+ /bin/cp "$ftppath_from/$architecture/$_pkgfile" .
+ /usr/bin/repo-add -q "$repoto.db.tar.$DB_COMPRESSION" $_pkgfile || die "Error in repo-add"
+ #use '*' to move the old DB too
+ mv $repoto.db.tar.$DB_COMPRESSION* $ftppath_to/$architecture
+ if [ "${_arch}" == "any" ]; then
+ mv ${_pkgfile} $ftppath_to/any
+ ln -s $ftppath_to/any/${_pkgfile} $ftppath_to/$architecture/
+ else
+ mv ${_pkgfile} $ftppath_to/$architecture
+ fi
+ done
else
die "Error: $packagename is not in repo $repofrom"
fi
diff --git a/db-remove b/db-remove
index 501c70a..4763f3d 100755
--- a/db-remove
+++ b/db-remove
@@ -15,7 +15,7 @@ arch="$3"
export CARCH="$arch"
-ftppath="$FTP_BASE/$reponame/os/$arch/"
+ftppath="$FTP_BASE/$reponame/os"
svnrepo="$reponame-$arch"
svnpath="$(get_svnpath $reponame)"
@@ -65,21 +65,29 @@ fi
cd "$WORKDIR"
[ -d build/ ] || mkdir build
-# copy the db file into our working area
-if [ -f "$ftppath/$reponame.db.tar.$DB_COMPRESSION" ]; then
- /bin/cp "$ftppath/$reponame.db.tar.$DB_COMPRESSION" build/
+if [ "$arch" == "any" ]; then
+ arches="i686 x86_64"
else
- echo "No database found at '$ftpdir', nothing more to do"
- exit 0
+ arches="$arch"
fi
-echo " Removing from $reponame DB file"
-cd build/
-/usr/bin/repo-remove -q "$reponame.db.tar.$DB_COMPRESSION" $packagename
-
-/bin/cp "$reponame.db.tar.$DB_COMPRESSION" "$ftppath/"
-
-echo "Package files will be cleaned up automatically"
-
+# copy the db file into our working area
+for architecture in $arches; do
+ if [ -f "$ftppath/$architecture/$reponame.db.tar.$DB_COMPRESSION" ]; then
+ /bin/cp "$ftppath/$architecture/$reponame.db.tar.$DB_COMPRESSION" build/
+ else
+ echo "No database found at '$ftppath/$architecture', nothing more to do"
+ exit 0
+ fi
+
+ echo " Removing from $reponame DB file ($architecture)"
+ cd build/
+ /usr/bin/repo-remove -q "$reponame.db.tar.$DB_COMPRESSION" $packagename
+
+ /bin/mv "$reponame.db.tar.$DB_COMPRESSION" "$ftppath/$architecture"
+
+ echo "Package files will be cleaned up automatically"
+ cd ..
+done
cleanup
# vim: set ts=4 sw=4 noet ft=sh: