diff options
author | Daniel Friesel <derf@derf.homelinux.org> | 2009-01-22 10:19:03 +0100 |
---|---|---|
committer | Daniel Friesel <derf@derf.homelinux.org> | 2009-01-22 10:19:03 +0100 |
commit | 06f7f3a98baa4c2e4802889121f194b1f7c98b28 (patch) | |
tree | cc99df6ffb283e9eecb9ccaee0797b0f27fae103 /bin/pkg | |
parent | 7acc5b09c7b0bee6edd22caa7a682cf1e84d191b (diff) |
pkg: check_prereqs: Added recommends and suggests, aliased depend to require
Diffstat (limited to 'bin/pkg')
-rwxr-xr-x | bin/pkg | 38 |
1 files changed, 33 insertions, 5 deletions
@@ -396,8 +396,8 @@ function check_prereqs { cd $PDIR/$package wrap_info $1 info "checking prerequisites\n" - typeset -a install - typeset warn + typeset -a -U install maybe_install + typeset warn info function is_installed { [[ -d $PDIR/$1 ]] @@ -418,29 +418,57 @@ function check_prereqs { $* || warn+="Requirement failed: $*\n" } } + function depend { + require $* + } + + function suggest { + if [[ $1 == 'package' ]] { + is_installed $2 || info "$package suggests package $2\n" + } else { + $* || info "Suggest failed: $*\n" + } + } + + function recommend { + if [[ $1 == 'package' ]] { + is_installed $2 || maybe_install+=$2 + } else { + $* || info+="Suggest failed: $*\n" + } + } { source prereqs } always { if (( TRY_BLOCK_ERROR )) { - warn 'Error in prereqs script' + warn "Error in prereqs script\n" TRY_BLOCK_ERROR=0 } } - if [[ -n $warn ]] { + if [[ -n $warn || -n $info ]] { warn $warn + info $info read -q } if [[ -n $install ]] { - info "$1 requires the following packages: $install\n" + info "$1 requires the following packages: ${(j:, :)install}\n" if (confirm_yes "Install them?") { for i in $install; { pkg_add $i } } } + if [[ -n $maybe_install ]] { + info "$1 recommends the following packages: ${(j:, :)maybe_install}\n" + if (confirm_no "Install them?") { + for i in $maybe_install; { + pkg_add $i + } + } + } } # Write a package's documentation to .collected |