diff options
author | Ondrej Kubik <ondrej.kubik@canonical.com> | 2017-11-04 19:20:37 +0000 |
---|---|---|
committer | Ondrej Kubik <ondrej.kubik@canonical.com> | 2018-02-21 22:29:23 +0000 |
commit | 3665a9131c4f0bac07727a5f908905e9a6348535 (patch) | |
tree | df9827d96dc0f36d9c7243b4c03e19cc324ed7f3 /snap/hooks/configure | |
parent | f7fe44fcdf56ef5a761924865c6d5869539b6410 (diff) | |
download | wekan-3665a9131c4f0bac07727a5f908905e9a6348535.tar.gz wekan-3665a9131c4f0bac07727a5f908905e9a6348535.tar.bz2 wekan-3665a9131c4f0bac07727a5f908905e9a6348535.zip |
splitting hooks and using snapctl instead of local settings file
Signed-off-by: Ondrej Kubik <ondrej.kubik@canonical.com>
Diffstat (limited to 'snap/hooks/configure')
-rwxr-xr-x | snap/hooks/configure | 28 |
1 files changed, 3 insertions, 25 deletions
diff --git a/snap/hooks/configure b/snap/hooks/configure index 1e2b0ec7..60ce81e8 100755 --- a/snap/hooks/configure +++ b/snap/hooks/configure @@ -1,32 +1,10 @@ #!/bin/bash +exec >> $SNAP_COMMON/hook.log 2>&1 +echo "$(date '+%Y-%m-%d %H:%M:%S') $0: Entering hook" + # 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." |