From 3ef4cde2e6659a6e6858c9b3502c2605c8b03e9c Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Fri, 27 Jun 2008 23:47:42 +0200 Subject: bin/pkg: Automatically get the repo type --- bin/pkg | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'bin/pkg') diff --git a/bin/pkg b/bin/pkg index 7576280..1089b7c 100755 --- a/bin/pkg +++ b/bin/pkg @@ -119,9 +119,9 @@ confirm_no () { vcs_add () { cd "$PDIR" - case "$1" in - git) git clone "$2" ;; - hg|'') hg clone "$2" ;; + case vcs_type "$1" in + git) git clone "$1" ;; + hg) hg clone "$1" ;; *) die "Cannot handle repository format '$1'\n" ;; esac } @@ -136,6 +136,10 @@ vcs_log () { [ -d .git ] && {git log ; return} } +vcs_type () { + grep ^"$1" $PDIR/.list-remote | cut -d ' ' -f 2 +} + vcs_upgrade () { [ -d .hg ] && {hg pull --update ; return} [ -d .git ] && {git pull ; return} @@ -324,7 +328,7 @@ pkg_update () { if ([ "$PKG_PROTO" = 'ssh' ]) { scp $PKG_HOST:$(echo $PKG_ROOT | cut -d / -f 4- | sed 's!~/!!')/.list .remote-list } elif ([ "$PKG_PROTO" = 'file' ]) { - cp $PKG_ROOT/.list . + cp $PKG_ROOT/.list .list-remote } core/include/pkglist $PDIR } -- cgit v1.2.3