From 1480338c5a3da5b6494565ab955ab67a15f19dd3 Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Thu, 31 Oct 2013 21:52:24 +0100 Subject: 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. --- bin/app-init | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) (limited to 'bin') 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 " + echo "usage: $usage_app [-s group.name=value] -d dir " } 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 "$@" -- cgit v1.2.3