summaryrefslogtreecommitdiffstats
path: root/snap/hooks
diff options
context:
space:
mode:
authorLauri Ojansivu <x@xet7.org>2017-06-27 17:19:04 +0300
committerLauri Ojansivu <x@xet7.org>2017-06-27 17:19:04 +0300
commit0fe247070a7d778fe1cd5e8e9e6734cd63a992fa (patch)
treee988dbe174411da3a15470017c41ddcefde663ae /snap/hooks
parent60495e4765363b95e8e1859406d80c5588062e14 (diff)
parentaca2692214f6dd3a260668204cd0588fe95b60dd (diff)
downloadwekan-0fe247070a7d778fe1cd5e8e9e6734cd63a992fa.tar.gz
wekan-0fe247070a7d778fe1cd5e8e9e6734cd63a992fa.tar.bz2
wekan-0fe247070a7d778fe1cd5e8e9e6734cd63a992fa.zip
Merge branch 'kubiko-devel' into devel
Add snapcraft build support from source. Thanks to kubiko ! This can be used together with launchpad build system for continuous integration. Intention is to push snaps build from devel branch to edge channel, which can be installed by calling: $ snap install -edge wekan device will keep automatically updating to revisions as they are released to edge channel.
Diffstat (limited to 'snap/hooks')
-rwxr-xr-xsnap/hooks/configure32
1 files changed, 32 insertions, 0 deletions
diff --git a/snap/hooks/configure b/snap/hooks/configure
new file mode 100755
index 00000000..1e2b0ec7
--- /dev/null
+++ b/snap/hooks/configure
@@ -0,0 +1,32 @@
+#!/bin/bash
+
+# read wekan config
+. $SNAP/bin/config
+
+# create run dir, we're going to use it for unix socket
+mkdir -p $SNAP_DATA/share
+mkdir -p $SNAP_DATA/shared
+
+# settings were altered by user, safest way to get them applied is to restart service
+
+# TODO: remove this workaround once it's not needed
+# for the moment we can't read settings outside of the hook,
+# so store all settings in helpper script which is then picked by main wrapper
+echo -e "#!/bin/sh\n" > $SETTINGS_FILE
+for key in ${keys[@]}
+do
+ # snappy is picky about key syntax, using mapping
+ MAP_KEY="KEY_$key"
+ if value=$(snapctl get ${!MAP_KEY}); then
+ echo "export $key='$value'" >> $SETTINGS_FILE
+ elif [ -d "${!key}" ]; then
+ # store back value from SETTINGS_FILE
+ echo "export $key='${!key}'" >> $SETTINGS_FILE
+ fi
+done
+
+# set file executable
+chmod 755 $SETTINGS_FILE
+# we can't use snapctl to restart service, may be one day ....
+
+echo "Setting has been updated, restart service."