diff options
author | Daniel Friesel <derf@derf.homelinux.org> | 2009-03-14 10:45:48 +0100 |
---|---|---|
committer | Daniel Friesel <derf@derf.homelinux.org> | 2009-03-14 10:45:48 +0100 |
commit | bbc3dd18ff2d758b67b8ea03589dd76f41c25235 (patch) | |
tree | 81f47ac094988440ff19e9052ebb24dc661acb7a /bin | |
parent | fde8afcb22225c12208e51bf4823c3a93cd7389c (diff) |
pkg: Don't accidently empty the remote package list
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/pkg | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -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 { |