summaryrefslogtreecommitdiffstats
path: root/snap-src/wekan-read-settings
diff options
context:
space:
mode:
authorOndrej Kubik <ondrej.kubik@canonical.com>2017-06-26 17:04:27 +0000
committerOndrej Kubik <ondrej.kubik@canonical.com>2017-06-27 13:22:52 +0000
commita538c149768ee565ea1b0db3ef8e3bb2a7759da0 (patch)
tree6f3afd2ad16ab2d8bca3467f1f7c71ae95402185 /snap-src/wekan-read-settings
parent60495e4765363b95e8e1859406d80c5588062e14 (diff)
downloadwekan-a538c149768ee565ea1b0db3ef8e3bb2a7759da0.tar.gz
wekan-a538c149768ee565ea1b0db3ef8e3bb2a7759da0.tar.bz2
wekan-a538c149768ee565ea1b0db3ef8e3bb2a7759da0.zip
Adding snapcraft build support from source
Signed-off-by: Ondrej Kubik <ondrej.kubik@canonical.com>
Diffstat (limited to 'snap-src/wekan-read-settings')
-rwxr-xr-xsnap-src/wekan-read-settings36
1 files changed, 36 insertions, 0 deletions
diff --git a/snap-src/wekan-read-settings b/snap-src/wekan-read-settings
new file mode 100755
index 00000000..aec05bba
--- /dev/null
+++ b/snap-src/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