diff options
Diffstat (limited to 'FUNCTIONS')
-rwxr-xr-x | FUNCTIONS | 36 |
1 files changed, 34 insertions, 2 deletions
@@ -663,13 +663,45 @@ function default_kde3_build() { } + +#--- +## Select SCM branch. If no parameter is given, it assumes a single scm branch. +## +## Saves selected branch in ${SPELL}_BRANCH, and auto-update setting on +## ${SPELL}_AUTOUPDATE. +## +## Usage: +## . ${GRIMOIRE}/FUNCTIONS && +## prepare_select_branch [branch] ... +#--- +function prepare_select_branch() { + local spell=$(get_up_spell_name) && + local branch="$spell"_BRANCH && + + if [[ $# > 1 ]]; then + config_query_list $branch "Select one of the available branches:" "$@" + else + eval $branch=\""${1:-scm}"\" + fi && + + if [[ "${!branch/-*}" = scm ]]; then + config_query "$spell"_AUTOUPDATE 'Automatically update on every system update?' n + fi +} + +#--- +## Get uppercase spell name with _ instead of - +#--- +function get_up_spell_name() { + echo ${1:-$SPELL} | tr "a-z-" "A-Z_" +} + # Move SPELL_OPTS to OPTS # basicly generic OPTS="$SPELL_OPTS $OPTS" function prepare_opts() { # this is here so that config_query_option can be used without # extra junk - local up_spell_name=$(echo $SPELL | tr "a-z" "A-Z") && - local up_spell_name=$(echo $up_spell_name | tr "-" "_") && + local up_spell_name=$(get_up_spell_name) && local tempopts="${up_spell_name}_OPTS" && OPTS="${!tempopts} $OPTS" } |