summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorDaniel Friesel <derf@derf.homelinux.org>2008-11-03 15:10:04 +0100
committerDaniel Friesel <derf@derf.homelinux.org>2008-11-03 15:10:04 +0100
commit2295f52d4fa2882f4ad0ae724a3b1f3d7fa89f98 (patch)
treee006786ba773679760a4e5bd43f17cab0f6d129c /bin
parentf769ffd2656ae3920d417c458098907e8d1060c9 (diff)
bin/pkg: Add $PKG_USER
Diffstat (limited to 'bin')
-rwxr-xr-xbin/pkg12
1 files changed, 9 insertions, 3 deletions
diff --git a/bin/pkg b/bin/pkg
index 427f13f..613e843 100755
--- a/bin/pkg
+++ b/bin/pkg
@@ -94,9 +94,15 @@ if [[ ${PKG_ROOT#ssh} != $PKG_ROOT ]] {
false
}
-# Host
+# user@host
if [[ $PKG_PROTO = 'ssh' ]] {
PKG_HOST=${${PKG_ROOT#'ssh://'}%%/*}
+ if [[ $PKG_HOST == *@* ]] {
+ PKG_USER=${PKG_HOST%%@*}
+ PKG_HOST=${PKG_HOST#*@}
+ } else {
+ PKG_USER=$USERNAME
+ }
}
# Remote path
@@ -216,9 +222,9 @@ function list_type_local {
function list_update_remote {
export PDIR
if [[ $PKG_PROTO = 'ssh' ]] {
- ssh $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" > .list-remote
if [[ ${#$(cat .list-remote)} == 0 ]] {
- scp -q $PKG_HOST:$PKG_PATH/.list .list-remote
+ scp -q $PKG_USER@$PKG_HOST:$PKG_PATH/.list .list-remote
warn "The pkglist version on your packages_root is outdated, please update\n"
}
} elif [[ $PKG_PROTO = 'file' ]] {