diff options
author | Trygve Laugstøl <trygvis@inamo.no> | 2013-10-31 21:52:24 +0100 |
---|---|---|
committer | Trygve Laugstøl <trygvis@inamo.no> | 2013-11-01 19:58:08 +0100 |
commit | 1480338c5a3da5b6494565ab955ab67a15f19dd3 (patch) | |
tree | df68073fad776481251093fd60a901fa7c905bec /bin/app-init | |
parent | 40eaf2303f013321b923c5bb616f0579a01a9884 (diff) | |
download | app.sh-1480338c5a3da5b6494565ab955ab67a15f19dd3.tar.gz app.sh-1480338c5a3da5b6494565ab955ab67a15f19dd3.tar.bz2 app.sh-1480338c5a3da5b6494565ab955ab67a15f19dd3.tar.xz app.sh-1480338c5a3da5b6494565ab955ab67a15f19dd3.zip |
app-init: Adding '-s' option to set a configuration option before the
resolver is executed and app is installed. The configuration will be
available when the app's hooks are executed.
o Running the documentation though aspell.
Diffstat (limited to 'bin/app-init')
-rwxr-xr-x | bin/app-init | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/bin/app-init b/bin/app-init index bc4a0b2..bff92cf 100755 --- a/bin/app-init +++ b/bin/app-init @@ -9,13 +9,15 @@ export APPSH_HOME=$(cd $(dirname "$0")/.. && pwd) # HEADER END usage_text() { - echo "usage: $usage_app -d dir <resolver> <resolver args>" + echo "usage: $usage_app [-s group.name=value] -d dir <resolver> <resolver args>" } dir= prepend_config= append_config= -while getopts "d:C:c:" opt +declare -A conf +conf=() +while getopts "d:C:c:s:" opt do case $opt in d) @@ -41,6 +43,19 @@ do shift 2 OPTIND=1 ;; + s) + keyvalue=$OPTARG + re="^$key_expr\\.$key_expr=.*$" + if [[ ! $keyvalue =~ $re ]] + then + usage "Invalid -s argument." + fi + key="${keyvalue%%=*}" + value="${keyvalue#*=}" + conf[$key]="$value" + shift 2 + OPTIND=1 + ;; esac done @@ -77,6 +92,12 @@ trap '[[ $ok == yes ]] || rm -rf "$clean_dir"' EXIT cd "$dir" +for key in "${!conf[@]}" +do + app-conf set $key "${conf[$key]}" +done +unset IFS + app-conf set app.resolver "$resolver_name" "$resolver" init "$@" |