From 2295f52d4fa2882f4ad0ae724a3b1f3d7fa89f98 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Mon, 3 Nov 2008 15:10:04 +0100 Subject: bin/pkg: Add $PKG_USER --- bin/pkg | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'bin') 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' ]] { -- cgit v1.2.3