From 5ed9e55f4d6a26452baaffadba407459ff96f295 Mon Sep 17 00:00:00 2001 From: Aaron Griffin Date: Sat, 22 Nov 2008 17:48:58 -0600 Subject: Remove 'copy_helper' as chmodding is fail The chmod doesn't work unless the user is the owner of the file Resorting to umask changes here Signed-off-by: Aaron Griffin --- db-functions | 9 --------- db-move | 6 +++--- db-remove | 4 ++-- db-update | 6 +++--- 4 files changed, 8 insertions(+), 17 deletions(-) diff --git a/db-functions b/db-functions index 8c8c667..740922f 100644 --- a/db-functions +++ b/db-functions @@ -76,13 +76,4 @@ check_pkg_arch () { #check_pkg_arch pkgfile arch fi } -# Simple helper function to ensure we always -# have proper DB permissions -copy_helper () { #copy_helper file dest - /bin/cp $1 $2 || return 1 - dir=$2 - [ -f $dir ] && dir=$(dirname $dir) - /bin/chmod 664 "$dir/$(basename $1)" || return 1 -} - # vim: set ts=4 sw=4 noet ft=sh: diff --git a/db-move b/db-move index 74e0b0b..0e0587c 100755 --- a/db-move +++ b/db-move @@ -83,7 +83,7 @@ if [ -d "$packagename/repos/$svnrepo_from" ]; then # copy the db file into our working area if [ -f "$ftppath_from/$repofrom.db.tar.$DB_COMPRESSION" ]; then - copy_helper "$ftppath_from/$repofrom.db.tar.$DB_COMPRESSION" . + /bin/cp "$ftppath_from/$repofrom.db.tar.$DB_COMPRESSION" . else touch "$repofrom.db.tar.$DB_COMPRESSION" fi @@ -94,12 +94,12 @@ if [ -d "$packagename/repos/$svnrepo_from" ]; then echo " Package files will be cleaned up automatically" if [ -f "$ftppath_to/$repoto.db.tar.$DB_COMPRESSION" ]; then - copy_helper "$ftppath_to/$repoto.db.tar.$DB_COMPRESSION" . + /bin/cp "$ftppath_to/$repoto.db.tar.$DB_COMPRESSION" . else touch "$repoto.db.tar.$DB_COMPRESSION" fi - copy_helper "$ftppath_from/$_pkgfile" . + /bin/cp "$ftppath_from/$_pkgfile" . /usr/bin/repo-add "$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 diff --git a/db-remove b/db-remove index 2e0307d..c5b6819 100755 --- a/db-remove +++ b/db-remove @@ -66,7 +66,7 @@ cd "$WORKDIR" # copy the db file into our working area if [ -f "$ftppath/$reponame.db.tar.$DB_COMPRESSION" ]; then - copy_helper "$ftppath/$reponame.db.tar.$DB_COMPRESSION" build/ + /bin/cp "$ftppath/$reponame.db.tar.$DB_COMPRESSION" build/ else echo "No database found at '$ftpdir', nothing more to do" exit 0 @@ -76,7 +76,7 @@ echo " Removing from $reponame DB file" cd build/ /usr/bin/repo-remove "$reponame.db.tar.$DB_COMPRESSION" $packagename -copy_helper "$reponame.db.tar.$DB_COMPRESSION" "$ftppath/" +/bin/cp "$reponame.db.tar.$DB_COMPRESSION" "$ftppath/" echo "Package files will be cleaned up automatically" diff --git a/db-update b/db-update index d98b60d..c76337a 100755 --- a/db-update +++ b/db-update @@ -73,7 +73,7 @@ cd "$WORKDIR" # copy the db file into our working area if [ -f "$ftppath/$reponame.db.tar.$DB_COMPRESSION" ]; then - copy_helper "$ftppath/$reponame.db.tar.$DB_COMPRESSION" build/ + /bin/cp "$ftppath/$reponame.db.tar.$DB_COMPRESSION" build/ else touch "build/$reponame.db.tar.$DB_COMPRESSION" fi @@ -137,7 +137,7 @@ if [ -n "$ADDPKGS" ]; then if [ -n "$to_add" ]; then cd "$WORKDIR/build/" - for f in $to_add; do copy_helper "$f" .; done + for f in $to_add; do /bin/cp "$f" .; done pkgs="" for pkg in $to_add; do pkgs="$pkgs $(basename $pkg)"; done @@ -155,7 +155,7 @@ fi if [ $(/bin/ls "$WORKDIR/build/" 2>/dev/null | wc -l) != 0 ]; then echo "Copying new files to '$ftppath'" for f in "$WORKDIR/build/"*; do - if ! copy_helper "$f" "$ftppath"; then + if ! /bin/cp "$f" "$ftppath"; then die "error: failure while copying files to $ftppath" fi done -- cgit v1.2.3-54-g00ecf