diff options
author | Daniel Friesel <derf@derf.homelinux.org> | 2010-04-20 19:31:51 +0200 |
---|---|---|
committer | Daniel Friesel <derf@derf.homelinux.org> | 2010-04-20 19:31:51 +0200 |
commit | e7e98a5f171e8698b5b90f2ec79b6aa390ac0d0a (patch) | |
tree | bec381c8b64ee241484e5ee7def0aca0c60edda7 | |
parent | 3e95ef30eee0176244b04dba8e394c95a1adadd2 (diff) |
Add "force_depend" prereqs directive
-rwxr-xr-x | bin/ct | 18 | ||||
-rw-r--r-- | man/7/caretaker.pod | 5 |
2 files changed, 22 insertions, 1 deletions
@@ -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 diff --git a/man/7/caretaker.pod b/man/7/caretaker.pod index 95b03ab..5236f27 100644 --- a/man/7/caretaker.pod +++ b/man/7/caretaker.pod @@ -203,6 +203,11 @@ Take the same arguments as B<depend>, but are of lower priority. recommend only causes "info" messages, and suggest does not interrupt caretaker to make sure it's read by the user +=item B<force_depend package> I<package> + +Like B<depend>, but installs the package without asking the user for +confirmation. + =back Additionally, the string parameters B<warn> and B<info> can be used to store |