summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@derf.homelinux.org>2008-05-20 15:25:32 +0200
committerDaniel Friesel <derf@derf.homelinux.org>2008-05-20 15:25:32 +0200
commitf8e04fc2712d848eca78400c06558d539b533f85 (patch)
treebeb8096376f1c2b0b465407aa66ec88cdf931d9b
parent3c6408f6e6dc3a180a29793700b9ae6d2392b179 (diff)
bin/pkg: Be more flexible
-rwxr-xr-xbin/pkg11
1 files changed, 7 insertions, 4 deletions
diff --git a/bin/pkg b/bin/pkg
index b88f1ec..83cd361 100755
--- a/bin/pkg
+++ b/bin/pkg
@@ -1,10 +1,13 @@
#!/usr/bin/env zsh
PDIR="$HOME/packages"
PKG_ROOT="ssh://derf.homelinux.org/packages"
+VCS_CMD="hg"
+VCS_OPTIONS="--quiet"
+VCS_ADD="clone"
+VCS_UPDATE="fetch"
+CL_OPTIONS-"-q"
local info=$'\e[0;36m'
local reset=$'\e[0m'
-local HG_OPTIONS='--quiet'
-local CL_OPTIONS='-q'
echo_status () {
echo "${info}$*${reset}"
@@ -37,7 +40,7 @@ pkg_add () {
check_deps "$1"
cd $PDIR || return 255
echo_status 'Retrieving package...'
- hg $HG_OPTIONS clone $PKG_ROOT/$1 || return 255
+ $VCS_CMD $VCS_OPTIONS $VCS_ADD $PKG_ROOT/$1 || return 255
if [ -f $1/hooks/post-add ]; then
echo_status 'Executing post-add hook'
. $1/hooks/post-add
@@ -67,7 +70,7 @@ pkg_update () {
echo_status "Updating package $i..."
check_deps "$i"
cd $i
- hg $HG_OPTIONS fetch
+ $VCS_CMD $VCS_OPTIONS $VCS_UPDATE
checklinks $CL_OPTIONS
if [ -f hooks/post-update ]; then
echo_status 'Executing post-update hook'