summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@derf.homelinux.org>2008-06-27 23:47:42 +0200
committerDaniel Friesel <derf@derf.homelinux.org>2008-06-27 23:47:42 +0200
commit3ef4cde2e6659a6e6858c9b3502c2605c8b03e9c (patch)
tree4cfb2e0090eb4cd5460e2030cc3e393df24ed264
parent8555ec255addb1ea54d7cbb1eb824cfa976b279a (diff)
bin/pkg: Automatically get the repo type
-rwxr-xr-xbin/pkg12
1 files changed, 8 insertions, 4 deletions
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
}