From a533caa9447c78fd007dfb7ada15c41390e97e05 Mon Sep 17 00:00:00 2001 From: Ondrej Kubik Date: Sat, 4 Nov 2017 18:56:35 +0000 Subject: rearranging helper scripts in snap-src Signed-off-by: Ondrej Kubik --- snap-src/bin/config | 44 ++++++++++++++++++++++++++++++++++++ snap-src/bin/mongodb-backup | 23 +++++++++++++++++++ snap-src/bin/mongodb-control | 31 ++++++++++++++++++++++++++ snap-src/bin/mongodb-restore | 16 ++++++++++++++ snap-src/bin/wekan-control | 26 ++++++++++++++++++++++ snap-src/bin/wekan-help | 48 ++++++++++++++++++++++++++++++++++++++++ snap-src/bin/wekan-read-settings | 36 ++++++++++++++++++++++++++++++ snap-src/config | 44 ------------------------------------ snap-src/mongodb-backup | 23 ------------------- snap-src/mongodb-control | 31 -------------------------- snap-src/mongodb-restore | 16 -------------- snap-src/wekan-control | 26 ---------------------- snap-src/wekan-help | 48 ---------------------------------------- snap-src/wekan-read-settings | 36 ------------------------------ snapcraft.yaml | 8 ------- 15 files changed, 224 insertions(+), 232 deletions(-) create mode 100755 snap-src/bin/config create mode 100755 snap-src/bin/mongodb-backup create mode 100755 snap-src/bin/mongodb-control create mode 100755 snap-src/bin/mongodb-restore create mode 100755 snap-src/bin/wekan-control create mode 100755 snap-src/bin/wekan-help create mode 100755 snap-src/bin/wekan-read-settings delete mode 100755 snap-src/config delete mode 100755 snap-src/mongodb-backup delete mode 100755 snap-src/mongodb-control delete mode 100755 snap-src/mongodb-restore delete mode 100755 snap-src/wekan-control delete mode 100755 snap-src/wekan-help delete mode 100755 snap-src/wekan-read-settings diff --git a/snap-src/bin/config b/snap-src/bin/config new file mode 100755 index 00000000..dbf8402c --- /dev/null +++ b/snap-src/bin/config @@ -0,0 +1,44 @@ +#!/bin/sh + +# store here all configuration options for wekan snap +# read configured settings first +SETTINGS_FILE="$SNAP_COMMON/wekan_settings.sh" +[ -f $SETTINGS_FILE ] && . $SETTINGS_FILE + +# list of supported keys +keys="MONGODB_BIND_UNIX_SOCKET MONGODB_BIND_IP MONGODB_PORT MAIL_URL MAIL_FROM ROOT_URL PORT DISABLE_MONGODB" + +# default values +DESCRIPTION_MONGODB_BIND_UNIX_SOCKET="mongodb binding unix socket:\n"\ +"\t\t\t Default behaviour will preffer binding over unix socket, to disable unix socket binding set value to 'nill' string\n"\ +"\t\t\t To bind to instance of mongo provided through contect interface set to relative path to the socket inside shared directory" +DEFAULT_MONGODB_BIND_UNIX_SOCKET="$SNAP_DATA/share" +KEY_MONGODB_BIND_UNIX_SOCKET="mongodb-bind-unix-socket" + +DESCRIPTION_MONGODB_PORT="mongodb binding port: eg 27017 when using localhost" +DEFAULT_MONGODB_PORT="27019" +KEY_MONGODB_PORT='mongodb-port' + +DESCRIPTION_MONGODB_BIND_IP="mongodb binding ip address: eg 127.0.0.1 for localhost\n\t\tIf not defined default unix socket is used instead" +DEFAULT_MONGODB_BIND_IP="" +KEY_MONGODB_BIND_IP="mongodb-bind-ip" + +DESCRIPTION_MAIL_URL="wekan mail binding" +DEFAULT_MAIL_URL="smtp://user:pass@mailserver.examples.com:25/" +KEY_MAIL_URL="mail-url" + +DESCRIPTION_MAIL_FROM="wekan's admin mail from name email address" +DEFAULT_MAIL_FROM="wekan-admin@example.com" +KEY_MAIL_FROM="mail-from" + +DESCRIPTION_ROOT_URL="wekan's root url, eg http://127.0.0.1, https://example.com, https://wekan.example.com, http://example.com/wekan" +DEFAULT_ROOT_URL="http://127.0.0.1" +KEY_ROOT_URL="root-url" + +DESCRIPTION_PORT="port wekan is exposed at" +DEFAULT_PORT="8080" +KEY_PORT="port" + +DESCRIPTION_DISABLE_MONGODB="Disable mongodb service: use only if binding to database outside of the snap. Valid values: [true,false]" +DEFAULT_DISABLE_MONGODB="false" +KEY_DISABLE_MONGODB="disable-mongodb" diff --git a/snap-src/bin/mongodb-backup b/snap-src/bin/mongodb-backup new file mode 100755 index 00000000..bef8bf9b --- /dev/null +++ b/snap-src/bin/mongodb-backup @@ -0,0 +1,23 @@ +#!/bin/bash + +# get wekan/mongo settings +source $SNAP/bin/wekan-read-settings + +# make sure we have set minimum env variables for locale +if [ -z "$LANG" ]; then + export LANG=en_US.UTF-8 +fi + +export LC_ALL=C + +if [ -z $1 ]; then + DATE=`/bin/date +%Y%m%dT%H%M%S` + mkdir -p $SNAP_COMMON/db-backups/ + ARCHIVE=$SNAP_COMMON/db-backups/wekan-$DATE.backup +else + ARCHIVE=$1 +fi +# start mongodb backup +[ "x" == "x${MONGODB_BIND_IP}" ] && MONGODB_BIND_IP="127.0.0.1" + echo "using bind ip" +mongodump --host $MONGODB_BIND_IP --port $MONGODB_PORT -d wekan --gzip --archive=${ARCHIVE} diff --git a/snap-src/bin/mongodb-control b/snap-src/bin/mongodb-control new file mode 100755 index 00000000..08af132d --- /dev/null +++ b/snap-src/bin/mongodb-control @@ -0,0 +1,31 @@ +#!/bin/bash + +# get wekan/mongo settings +source $SNAP/bin/wekan-read-settings + +if [ "true" == "${DISABLE_MONGODB}" ]; then + echo "mongodb is disabled. Not starting it" + exit 0 +fi + +# make sure we have set minimum env variables for locale +if [ -z "$LANG" ]; then + export LANG=en_US.UTF-8 +fi + +export LC_ALL=C + +# start mongo deamon +BIND_OPTIONS="" +if [ "nill" != "$MONGODB_BIND_UNIX_SOCKET" ] && [ "x" != "x${MONGODB_BIND_UNIX_SOCKET}" ]; then + BIND_OPTIONS+=" --unixSocketPrefix $MONGODB_BIND_UNIX_SOCKET" +fi +if [ "x" != "x${MONGODB_BIND_IP}" ]; then + BIND_OPTIONS+=" --bind_ip $MONGODB_BIND_IP" +fi +if [ "x" != "x${MONGODB_PORT}" ]; then + BIND_OPTIONS+=" --port $MONGODB_PORT" +fi +echo "mongodb bind options: $BIND_OPTIONS" + +mongod --dbpath $SNAP_COMMON --logpath $SNAP_COMMON/mongodb.log --logappend --journal $BIND_OPTIONS diff --git a/snap-src/bin/mongodb-restore b/snap-src/bin/mongodb-restore new file mode 100755 index 00000000..c1c82775 --- /dev/null +++ b/snap-src/bin/mongodb-restore @@ -0,0 +1,16 @@ +#!/bin/bash + +# get wekan/mongo settings +source $SNAP/bin/wekan-read-settings + +# make sure we have set minimum env variables for locale +if [ -z "$LANG" ]; then + export LANG=en_US.UTF-8 +fi + +export LC_ALL=C + +# start mongodb backup +[ "x" == "x${MONGODB_BIND_IP}" ] && MONGODB_BIND_IP="127.0.0.1" +echo "using bind ip" +mongorestore --host $MONGODB_BIND_IP --port $MONGODB_PORT -d wekan --gzip --archive=$1 diff --git a/snap-src/bin/wekan-control b/snap-src/bin/wekan-control new file mode 100755 index 00000000..905642ed --- /dev/null +++ b/snap-src/bin/wekan-control @@ -0,0 +1,26 @@ +#!/bin/bash + +SYSTEMD_WEKAN_SERVICE="snap.${SNAP_NAME}.wekan" +SYSTEMD_MONGODB_SERVICE="snap.${SNAP_NAME}.mongodb" + +# get wekan/mongo settings +source $SNAP/bin/wekan-read-settings + +export NODE_PATH=$SNAP/bin +# if possible we prefer to bind over unix socket +if [ "nill" != "$MONGODB_BIND_UNIX_SOCKET" ] && [ "x" != "x$MONGODB_BIND_UNIX_SOCKET" ]; then + if [ -d $MONGODB_BIND_UNIX_SOCKET ]; then + export MONGO_URL="mongodb://$MONGODB_BIND_UNIX_SOCKET/mongodb-${MONGODB_PORT}.sock/wekan" + else + export MONGO_URL="mongodb://$SNAP_DATA/shared/$MONGODB_BIND_UNIX_SOCKET/wekan" + fi +else + [ "x" == "x$MONGODB_BIND_IP" ] && MONGODB_BIND_IP="127.0.0.1" + export MONGO_URL="mongodb://$MONGODB_BIND_IP:$MONGODB_PORT/wekan" +fi + +echo -e "MONGO_URL=$MONGO_URL" +APPLICATION_DIRECTORY=$SNAP +APPLICATION_START=main.js +cd $APPLICATION_DIRECTORY +$NODE_PATH/node $APPLICATION_START diff --git a/snap-src/bin/wekan-help b/snap-src/bin/wekan-help new file mode 100755 index 00000000..bbf0e138 --- /dev/null +++ b/snap-src/bin/wekan-help @@ -0,0 +1,48 @@ +#!/bin/bash + +source $SNAP/bin/config &>/dev/null + +echo -e "Wekan: The open-source Trello-like kanban.\n" +echo -e "Make sure you have connected all interfaces, check more by calling $ snap interfaces" +echo -e "\n" +echo -e "${SNAP_NAME} has two services, to check status/restart/stop use systemd commands" +echo -e "mongodb service:" +echo -e "\t$ sudo systemctl status/start/stop/restart snap.$SNAP_NAME.mongodb" +echo -e "wekan service" +echo -e "\t$ sudo systemctl status/start/stop/restart snap.$SNAP_NAME.wekan" +echo -e "\n" +echo -e "To make backup of wekan's database use: $ ${SNAP_NAME}.database-backup [backup file]" +echo -e "\t backup file is optional parameter, if not passed backup is created in directory:" +echo -e "\t\t${SNAP_COMMON}/db-backups" +echo -e "To list existing backups in default directory: $ ${SNAP_NAME}.database-list-backups" +echo -e "To restore wekan's database use: ${SNAP_NAME}.database-restore " +echo -e "\n" +echo -e "wekan can be configured to share mongodb with other services using content interface" +echo -e "\t-sharing mongodb from $SNAP_NAME to other snap(s):" +echo -e "\t\t-connect mongodb-slot with plug from corresponding snap(s)" +echo -e "\t\t-configure corresponding service to use mongodb unix socket in shared directory, socket file name is: mongodb-$MONGODB_PORT.sock" +echo -e "\t-sharing mongodb from other snap to $SNAP_NAME:" +echo -e "\t\t-connect mongodb-plug with slot from snap providing mongodb" +echo -e "\t\t-disable mongodb in $SNAP_NAME by calling: $ snap set $SNAP_NAME set disable-mongodb='true'" +echo -e "\t\t-set mongodb-bind-unix-socket to point to serving mongodb. Use relative path inside shared directory, e.g run/mongodb-27017.sock" +echo -e "\n" +# parse config file for supported settings keys +echo -e "wekan supports settings keys" +echo -e "values can be changed by calling\n$ snap set $SNAP_NAME =''" +echo -e "list of supported keys:" +for key in ${keys[@]} +do + default_value="DEFAULT_$key" + description="DESCRIPTION_$key" + snappy_key="KEY_$key" + echo -e "\t${!snappy_key}: ${!description}" + if [ "x" == "x${!key}" ]; then + echo -e "\t\tNo value set, using default value: '${!default_value}'" + else + echo -e "\t\tCurrent value set to: '${!key}', (default value: '${!default_value}')" + fi +done +echo -e "\nFor changes to take effect restart wekan service," +echo -e "if mongodb key was change also restart mongodb service, before restarting wekan" +echo -e "to restart mongodb: $ sudo systemctl restart snap.$SNAP_NAME.mongodb" +echo -e "to restart wekan: $ sudo systemctl restart snap.$SNAP_NAME.wekan" 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 diff --git a/snap-src/config b/snap-src/config deleted file mode 100755 index dbf8402c..00000000 --- a/snap-src/config +++ /dev/null @@ -1,44 +0,0 @@ -#!/bin/sh - -# store here all configuration options for wekan snap -# read configured settings first -SETTINGS_FILE="$SNAP_COMMON/wekan_settings.sh" -[ -f $SETTINGS_FILE ] && . $SETTINGS_FILE - -# list of supported keys -keys="MONGODB_BIND_UNIX_SOCKET MONGODB_BIND_IP MONGODB_PORT MAIL_URL MAIL_FROM ROOT_URL PORT DISABLE_MONGODB" - -# default values -DESCRIPTION_MONGODB_BIND_UNIX_SOCKET="mongodb binding unix socket:\n"\ -"\t\t\t Default behaviour will preffer binding over unix socket, to disable unix socket binding set value to 'nill' string\n"\ -"\t\t\t To bind to instance of mongo provided through contect interface set to relative path to the socket inside shared directory" -DEFAULT_MONGODB_BIND_UNIX_SOCKET="$SNAP_DATA/share" -KEY_MONGODB_BIND_UNIX_SOCKET="mongodb-bind-unix-socket" - -DESCRIPTION_MONGODB_PORT="mongodb binding port: eg 27017 when using localhost" -DEFAULT_MONGODB_PORT="27019" -KEY_MONGODB_PORT='mongodb-port' - -DESCRIPTION_MONGODB_BIND_IP="mongodb binding ip address: eg 127.0.0.1 for localhost\n\t\tIf not defined default unix socket is used instead" -DEFAULT_MONGODB_BIND_IP="" -KEY_MONGODB_BIND_IP="mongodb-bind-ip" - -DESCRIPTION_MAIL_URL="wekan mail binding" -DEFAULT_MAIL_URL="smtp://user:pass@mailserver.examples.com:25/" -KEY_MAIL_URL="mail-url" - -DESCRIPTION_MAIL_FROM="wekan's admin mail from name email address" -DEFAULT_MAIL_FROM="wekan-admin@example.com" -KEY_MAIL_FROM="mail-from" - -DESCRIPTION_ROOT_URL="wekan's root url, eg http://127.0.0.1, https://example.com, https://wekan.example.com, http://example.com/wekan" -DEFAULT_ROOT_URL="http://127.0.0.1" -KEY_ROOT_URL="root-url" - -DESCRIPTION_PORT="port wekan is exposed at" -DEFAULT_PORT="8080" -KEY_PORT="port" - -DESCRIPTION_DISABLE_MONGODB="Disable mongodb service: use only if binding to database outside of the snap. Valid values: [true,false]" -DEFAULT_DISABLE_MONGODB="false" -KEY_DISABLE_MONGODB="disable-mongodb" diff --git a/snap-src/mongodb-backup b/snap-src/mongodb-backup deleted file mode 100755 index bef8bf9b..00000000 --- a/snap-src/mongodb-backup +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash - -# get wekan/mongo settings -source $SNAP/bin/wekan-read-settings - -# make sure we have set minimum env variables for locale -if [ -z "$LANG" ]; then - export LANG=en_US.UTF-8 -fi - -export LC_ALL=C - -if [ -z $1 ]; then - DATE=`/bin/date +%Y%m%dT%H%M%S` - mkdir -p $SNAP_COMMON/db-backups/ - ARCHIVE=$SNAP_COMMON/db-backups/wekan-$DATE.backup -else - ARCHIVE=$1 -fi -# start mongodb backup -[ "x" == "x${MONGODB_BIND_IP}" ] && MONGODB_BIND_IP="127.0.0.1" - echo "using bind ip" -mongodump --host $MONGODB_BIND_IP --port $MONGODB_PORT -d wekan --gzip --archive=${ARCHIVE} diff --git a/snap-src/mongodb-control b/snap-src/mongodb-control deleted file mode 100755 index 08af132d..00000000 --- a/snap-src/mongodb-control +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/bash - -# get wekan/mongo settings -source $SNAP/bin/wekan-read-settings - -if [ "true" == "${DISABLE_MONGODB}" ]; then - echo "mongodb is disabled. Not starting it" - exit 0 -fi - -# make sure we have set minimum env variables for locale -if [ -z "$LANG" ]; then - export LANG=en_US.UTF-8 -fi - -export LC_ALL=C - -# start mongo deamon -BIND_OPTIONS="" -if [ "nill" != "$MONGODB_BIND_UNIX_SOCKET" ] && [ "x" != "x${MONGODB_BIND_UNIX_SOCKET}" ]; then - BIND_OPTIONS+=" --unixSocketPrefix $MONGODB_BIND_UNIX_SOCKET" -fi -if [ "x" != "x${MONGODB_BIND_IP}" ]; then - BIND_OPTIONS+=" --bind_ip $MONGODB_BIND_IP" -fi -if [ "x" != "x${MONGODB_PORT}" ]; then - BIND_OPTIONS+=" --port $MONGODB_PORT" -fi -echo "mongodb bind options: $BIND_OPTIONS" - -mongod --dbpath $SNAP_COMMON --logpath $SNAP_COMMON/mongodb.log --logappend --journal $BIND_OPTIONS diff --git a/snap-src/mongodb-restore b/snap-src/mongodb-restore deleted file mode 100755 index c1c82775..00000000 --- a/snap-src/mongodb-restore +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash - -# get wekan/mongo settings -source $SNAP/bin/wekan-read-settings - -# make sure we have set minimum env variables for locale -if [ -z "$LANG" ]; then - export LANG=en_US.UTF-8 -fi - -export LC_ALL=C - -# start mongodb backup -[ "x" == "x${MONGODB_BIND_IP}" ] && MONGODB_BIND_IP="127.0.0.1" -echo "using bind ip" -mongorestore --host $MONGODB_BIND_IP --port $MONGODB_PORT -d wekan --gzip --archive=$1 diff --git a/snap-src/wekan-control b/snap-src/wekan-control deleted file mode 100755 index 905642ed..00000000 --- a/snap-src/wekan-control +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash - -SYSTEMD_WEKAN_SERVICE="snap.${SNAP_NAME}.wekan" -SYSTEMD_MONGODB_SERVICE="snap.${SNAP_NAME}.mongodb" - -# get wekan/mongo settings -source $SNAP/bin/wekan-read-settings - -export NODE_PATH=$SNAP/bin -# if possible we prefer to bind over unix socket -if [ "nill" != "$MONGODB_BIND_UNIX_SOCKET" ] && [ "x" != "x$MONGODB_BIND_UNIX_SOCKET" ]; then - if [ -d $MONGODB_BIND_UNIX_SOCKET ]; then - export MONGO_URL="mongodb://$MONGODB_BIND_UNIX_SOCKET/mongodb-${MONGODB_PORT}.sock/wekan" - else - export MONGO_URL="mongodb://$SNAP_DATA/shared/$MONGODB_BIND_UNIX_SOCKET/wekan" - fi -else - [ "x" == "x$MONGODB_BIND_IP" ] && MONGODB_BIND_IP="127.0.0.1" - export MONGO_URL="mongodb://$MONGODB_BIND_IP:$MONGODB_PORT/wekan" -fi - -echo -e "MONGO_URL=$MONGO_URL" -APPLICATION_DIRECTORY=$SNAP -APPLICATION_START=main.js -cd $APPLICATION_DIRECTORY -$NODE_PATH/node $APPLICATION_START diff --git a/snap-src/wekan-help b/snap-src/wekan-help deleted file mode 100755 index bbf0e138..00000000 --- a/snap-src/wekan-help +++ /dev/null @@ -1,48 +0,0 @@ -#!/bin/bash - -source $SNAP/bin/config &>/dev/null - -echo -e "Wekan: The open-source Trello-like kanban.\n" -echo -e "Make sure you have connected all interfaces, check more by calling $ snap interfaces" -echo -e "\n" -echo -e "${SNAP_NAME} has two services, to check status/restart/stop use systemd commands" -echo -e "mongodb service:" -echo -e "\t$ sudo systemctl status/start/stop/restart snap.$SNAP_NAME.mongodb" -echo -e "wekan service" -echo -e "\t$ sudo systemctl status/start/stop/restart snap.$SNAP_NAME.wekan" -echo -e "\n" -echo -e "To make backup of wekan's database use: $ ${SNAP_NAME}.database-backup [backup file]" -echo -e "\t backup file is optional parameter, if not passed backup is created in directory:" -echo -e "\t\t${SNAP_COMMON}/db-backups" -echo -e "To list existing backups in default directory: $ ${SNAP_NAME}.database-list-backups" -echo -e "To restore wekan's database use: ${SNAP_NAME}.database-restore " -echo -e "\n" -echo -e "wekan can be configured to share mongodb with other services using content interface" -echo -e "\t-sharing mongodb from $SNAP_NAME to other snap(s):" -echo -e "\t\t-connect mongodb-slot with plug from corresponding snap(s)" -echo -e "\t\t-configure corresponding service to use mongodb unix socket in shared directory, socket file name is: mongodb-$MONGODB_PORT.sock" -echo -e "\t-sharing mongodb from other snap to $SNAP_NAME:" -echo -e "\t\t-connect mongodb-plug with slot from snap providing mongodb" -echo -e "\t\t-disable mongodb in $SNAP_NAME by calling: $ snap set $SNAP_NAME set disable-mongodb='true'" -echo -e "\t\t-set mongodb-bind-unix-socket to point to serving mongodb. Use relative path inside shared directory, e.g run/mongodb-27017.sock" -echo -e "\n" -# parse config file for supported settings keys -echo -e "wekan supports settings keys" -echo -e "values can be changed by calling\n$ snap set $SNAP_NAME =''" -echo -e "list of supported keys:" -for key in ${keys[@]} -do - default_value="DEFAULT_$key" - description="DESCRIPTION_$key" - snappy_key="KEY_$key" - echo -e "\t${!snappy_key}: ${!description}" - if [ "x" == "x${!key}" ]; then - echo -e "\t\tNo value set, using default value: '${!default_value}'" - else - echo -e "\t\tCurrent value set to: '${!key}', (default value: '${!default_value}')" - fi -done -echo -e "\nFor changes to take effect restart wekan service," -echo -e "if mongodb key was change also restart mongodb service, before restarting wekan" -echo -e "to restart mongodb: $ sudo systemctl restart snap.$SNAP_NAME.mongodb" -echo -e "to restart wekan: $ sudo systemctl restart snap.$SNAP_NAME.wekan" diff --git a/snap-src/wekan-read-settings b/snap-src/wekan-read-settings deleted file mode 100755 index aec05bba..00000000 --- a/snap-src/wekan-read-settings +++ /dev/null @@ -1,36 +0,0 @@ -#!/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 diff --git a/snapcraft.yaml b/snapcraft.yaml index 1a85f682..7766f677 100644 --- a/snapcraft.yaml +++ b/snapcraft.yaml @@ -124,11 +124,3 @@ parts: helpers: source: snap-src plugin: dump - organize: - wekan-control: bin/wekan-control - mongodb-control: bin/mongodb-control - wekan-read-settings: bin/wekan-read-settings - wekan-help: bin/wekan-help - mongodb-backup: bin/mongodb-backup - mongodb-restore: bin/mongodb-restore - config: bin/config -- cgit v1.2.3-1-g7c22