diff options
author | Ondrej Kubik <ondrej.kubik@canonical.com> | 2017-11-04 18:56:35 +0000 |
---|---|---|
committer | Ondrej Kubik <ondrej.kubik@canonical.com> | 2018-02-21 22:29:23 +0000 |
commit | a533caa9447c78fd007dfb7ada15c41390e97e05 (patch) | |
tree | ca10260f0cced29df3048e9d371e29c26bfb4923 /snap-src/bin/wekan-read-settings | |
parent | 26f66f3cf05d3ab3dd633d02399cea5aa5a99c00 (diff) | |
download | wekan-a533caa9447c78fd007dfb7ada15c41390e97e05.tar.gz wekan-a533caa9447c78fd007dfb7ada15c41390e97e05.tar.bz2 wekan-a533caa9447c78fd007dfb7ada15c41390e97e05.zip |
rearranging helper scripts in snap-src
Signed-off-by: Ondrej Kubik <ondrej.kubik@canonical.com>
Diffstat (limited to 'snap-src/bin/wekan-read-settings')
-rwxr-xr-x | snap-src/bin/wekan-read-settings | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/snap-src/bin/wekan-read-settings b/snap-src/bin/wekan-read-settings new file mode 100755 index 00000000..aec05bba --- /dev/null +++ b/snap-src/bin/wekan-read-settings @@ -0,0 +1,36 @@ +#!/bin/sh + +# read wekan config +source $SNAP/bin/config + +# TODO: uncomment following, once snapctl can be called from outside the hooks +# for key in ${keys[@]} +# do +# # snappy is picky about key syntax, using mapping +# MAP_KEY="KEY_$key" +# SNAPPY_KEY= +# if value=$(snapctl get ${!MAP_KEY}); then +# echo "$key='$value'" +# export $key=$value +# else +# # use default value +# default_value="DEFAULT_$key" +# echo "using default value: $key='${!default_value}'" +# export $key=${!default_value} +# fi +# done + +# TODO: get rid of this workaround once above can be used +# loop through all values, and if not defined, use default value +for key in ${keys[@]} +do + if [ "x" == "x${!key}" ]; then + # use default value + default_value="DEFAULT_$key" + echo "using default value: $key='${!default_value}'" + export $key=${!default_value} + # echo "export $key='${!def_value}'" >> $SETTINGS_FILE + else + echo "$key='${!key}'" + fi +done |