From e7e98a5f171e8698b5b90f2ec79b6aa390ac0d0a Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Tue, 20 Apr 2010 19:31:51 +0200 Subject: Add "force_depend" prereqs directive --- bin/ct | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'bin') diff --git a/bin/ct b/bin/ct index 1403073..e90ea5e 100755 --- a/bin/ct +++ b/bin/ct @@ -473,7 +473,7 @@ function global_hook { } function check_prereqs { - typeset -a -U install maybe_install + typeset -a -U force_install install maybe_install typeset warn info typeset package=$1 @@ -497,6 +497,15 @@ function check_prereqs { install+=$1 } + + function force_depend { + if [[ $1 == 'package' ]] { + is_installed $2 || force_install+=$2 + } else { + warn "force_depend: Only makes sense for packages\n" + } + } + function depend { if [[ $1 == 'package' ]] { is_installed $2 || offer_install $2 @@ -539,6 +548,13 @@ function check_prereqs { read -q '?continue [] ' } + if [[ -n $force_install ]] { + info "${1} forces installation of additional packages: ${(j:, :)force_install}\n" + for package in ${force_install}; { + pkg_add ${package} + } + } + if [[ -n $install ]] { info "$1 requires the following packages: ${(j:, :)install}\n" if confirm_yes "Install them?"; then -- cgit v1.2.3