diff options
author | Trygve Laugstøl <trygvis@inamo.no> | 2013-10-27 23:30:49 +0100 |
---|---|---|
committer | Trygve Laugstøl <trygvis@inamo.no> | 2013-10-27 23:30:49 +0100 |
commit | e694d9024cddf4dd54efd828927e3fd5e70b6c3a (patch) | |
tree | dcefc5f39fc837736b9822b7446d2b6eb4e6f802 /bin/app-conf | |
parent | 38d7ffca0b591694c17509d20c8bf55606e60536 (diff) | |
download | app.sh-e694d9024cddf4dd54efd828927e3fd5e70b6c3a.tar.gz app.sh-e694d9024cddf4dd54efd828927e3fd5e70b6c3a.tar.bz2 app.sh-e694d9024cddf4dd54efd828927e3fd5e70b6c3a.tar.xz app.sh-e694d9024cddf4dd54efd828927e3fd5e70b6c3a.zip |
o Removing all old code (X files).
o Making sure APPSH_HOME is 1) exported and, 2) always prepended to
$PATH.
o More documentation on what a zip file actually looks like and how to
create hooks.
Diffstat (limited to 'bin/app-conf')
-rwxr-xr-x | bin/app-conf | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/bin/app-conf b/bin/app-conf index 23b68f7..8f34b57 100755 --- a/bin/app-conf +++ b/bin/app-conf @@ -3,7 +3,7 @@ set -e set -u -APPSH_HOME=$(cd $(dirname "$0")/.. && pwd) +export APPSH_HOME=$(cd $(dirname "$0")/.. && pwd) . $APPSH_HOME/lib/common # HEADER END @@ -22,8 +22,6 @@ APPSH_HOME=$(cd $(dirname "$0")/.. && pwd) PATH=$APPSH_HOME/libexec:$PATH -key_expr="[a-zA-Z][_a-zA-Z0-9]*" - format_conf() { local IFS== while read key value @@ -34,13 +32,11 @@ format_conf() { } assert_valid_config_name() { - local name=$1 - - local x=`echo $name | sed -n "/^$key_expr\\.$key_expr$/p"` - if [ -z "$x" ] + local name=$1; shift + local x="^$key_expr\\.$key_expr$" + if [[ ! $name =~ $x ]] then - echo "Invalid name: $name" >&2 - exit 1 + fatal "Invalid name: $name" fi } @@ -64,7 +60,7 @@ conf_set() { echo "$name=$value" >> "$file.tmp" mv "$file.tmp" "$file" -} +}; shift conf_delete() { local file=$1; shift @@ -82,7 +78,7 @@ conf_import() { echo "Importing config from $src" app-cat-conf -f "$dst" -f "$src" > "$dst.tmp" - mv "$dst.tmp" "$dst" + mv "$dst.tmp" "$dst" } usage_text() { |