From 5218cde3f394f2ab4d6f6cc763bc9267a0b69f07 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Mon, 19 May 2008 23:01:50 +0200 Subject: bin/pkg: Added experimental dependency support --- bin/pkg | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'bin/pkg') diff --git a/bin/pkg b/bin/pkg index a88a691..7f2b1d5 100755 --- a/bin/pkg +++ b/bin/pkg @@ -15,11 +15,26 @@ if [ ! -d $PDIR ]; then exit 100 fi +check_deps () { + [ -r $PDIR/$1/.deps ] || return 0 + DEPS=($(cat $PDIR/$1/.deps)) + for dep in DEPS; { + if [ ! -d $PDIR/$dep ]; then + echo -n "$1 depends on $dep. Install dependency? [Y/n] " + read + if [ ! "$REPLY" = 'n' ]; then + "$0" add "$dep" + fi + fi + } +} + pkg_add () { if [ -d $PDIR/$1 ]; then echo_status "Package already installed!" return 100 fi + check_deps "$1" cd $PDIR || return 255 echo_status 'Retrieving package...' hg $HG_OPTIONS clone $PKG_ROOT/$1 || return 255 @@ -50,6 +65,7 @@ pkg_update () { cd $PDIR for i in *(/); { echo_status "Updating package $i..." + check_deps "$1" cd $i hg $HG_OPTIONS fetch checklinks $CL_OPTIONS -- cgit v1.2.3