summaryrefslogtreecommitdiff
path: root/bin/pkg
diff options
context:
space:
mode:
authorDaniel Friesel <derf@derf.homelinux.org>2009-03-14 10:45:48 +0100
committerDaniel Friesel <derf@derf.homelinux.org>2009-03-14 10:45:48 +0100
commitbbc3dd18ff2d758b67b8ea03589dd76f41c25235 (patch)
tree81f47ac094988440ff19e9052ebb24dc661acb7a /bin/pkg
parentfde8afcb22225c12208e51bf4823c3a93cd7389c (diff)
pkg: Don't accidently empty the remote package list
Diffstat (limited to 'bin/pkg')
-rwxr-xr-xbin/pkg10
1 files changed, 8 insertions, 2 deletions
diff --git a/bin/pkg b/bin/pkg
index 035cfab..6c1445d 100755
--- a/bin/pkg
+++ b/bin/pkg
@@ -296,12 +296,18 @@ function list_type_local {
}
function list_update_remote {
+ typeset tmpfile=$(mktemp pkglist.XXXXXX)
+ typeset -i ret=0
export PDIR
if [[ $PKG_PROTO == 'ssh' ]] {
- ssh $PKG_USER@$PKG_HOST "PDIR='$PDIR' $PKG_PATH/core/include/pkglist $PKG_PATH" > .list-remote
+ ssh $PKG_USER@$PKG_HOST "PDIR='$PDIR' $PKG_PATH/core/include/pkglist $PKG_PATH" > $tmpfile || ret=$?
} elif [[ $PKG_PROTO == 'file' ]] {
- $PKG_PATH/core/include/pkglist $PKG_PATH > .list-remote
+ $PKG_PATH/core/include/pkglist $PKG_PATH > $tmpfile || ret=$?
}
+ if (( ret == 0 )) {
+ cp $tmpfile .list-remote
+ }
+ rm $tmpfile
}
function list_update_local {