2015-05-02 16:36:51 +02:00
|
|
|
#!/bin/bash
|
2017-03-18 19:12:51 +01:00
|
|
|
set -eu
|
2016-06-18 00:06:53 +02:00
|
|
|
app=$YNH_APP_INSTANCE_NAME
|
|
|
|
|
2016-06-18 10:36:18 +02:00
|
|
|
|
2017-06-17 00:22:16 +02:00
|
|
|
# The main logic is to
|
|
|
|
# - install in a src-new folder
|
|
|
|
# - upgrade dependencies
|
|
|
|
# - if everything OK, rename src-new to src
|
|
|
|
|
2016-06-18 10:36:18 +02:00
|
|
|
# Installation paths
|
|
|
|
INSTALL_DIR=/opt/yunohost/ihatemoney
|
|
|
|
PIP=${INSTALL_DIR}/venv/bin/pip
|
2017-06-17 00:22:16 +02:00
|
|
|
NEW_REQUIREMENTS=${INSTALL_DIR}/src-new/requirements.txt
|
2016-06-18 10:36:18 +02:00
|
|
|
|
2017-06-17 18:26:59 +02:00
|
|
|
domain=$(ynh_app_setting_get "$app" domain)
|
|
|
|
|
2016-06-18 00:06:53 +02:00
|
|
|
# Source YunoHost helpers
|
|
|
|
. /usr/share/yunohost/helpers
|
|
|
|
|
2017-06-17 00:22:16 +02:00
|
|
|
# Source local utils
|
|
|
|
source _common.sh
|
|
|
|
|
2016-06-18 00:06:53 +02:00
|
|
|
# Optionaly upgrade arg to typed boolean form
|
|
|
|
|
|
|
|
is_public=$(ynh_app_setting_get "$app" is_public)
|
2016-06-18 10:36:18 +02:00
|
|
|
|
|
|
|
if [ $is_public = "No" ];
|
2016-06-18 00:06:53 +02:00
|
|
|
then
|
2016-06-18 10:36:18 +02:00
|
|
|
is_public=0
|
|
|
|
else
|
|
|
|
is_public=1
|
2016-06-18 00:06:53 +02:00
|
|
|
fi
|
2015-05-02 16:36:51 +02:00
|
|
|
|
2016-06-18 10:36:18 +02:00
|
|
|
ynh_app_setting_set "$app" is_public "$is_public"
|
|
|
|
|
2015-05-02 16:36:51 +02:00
|
|
|
# Upgrade code
|
2017-06-17 00:22:16 +02:00
|
|
|
fetch_and_extract ${INSTALL_DIR}/src-new/ ihatemoney
|
2015-05-02 16:36:51 +02:00
|
|
|
|
2017-06-17 00:22:16 +02:00
|
|
|
fix_permissions ${INSTALL_DIR}/src-new/
|
2016-06-18 10:36:18 +02:00
|
|
|
|
|
|
|
# Upgrade dependencies
|
2017-06-17 00:22:16 +02:00
|
|
|
sudo ${PIP} install -r ${NEW_REQUIREMENTS}
|
|
|
|
|
|
|
|
# Everything went ok ? Let's keep this code.
|
|
|
|
sudo rm -rf ${INSTALL_DIR}/src
|
|
|
|
sudo mv ${INSTALL_DIR}/src-new ${INSTALL_DIR}/src
|
|
|
|
|
|
|
|
# Re-create settings symlink
|
|
|
|
sudo ln -s /etc/ihatemoney/settings.py ${INSTALL_DIR}/src/budget/settings.py
|
2016-06-18 10:36:18 +02:00
|
|
|
|
2015-05-02 16:36:51 +02:00
|
|
|
# Settings are not very likely to change, and that script may be
|
|
|
|
# adapted to handle it in case.
|
|
|
|
|
|
|
|
# Restart backend
|
|
|
|
sudo supervisorctl restart budget
|