1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/ihatemoney_ynh.git synced 2024-09-03 19:26:15 +02:00
ihatemoney_ynh/scripts/upgrade

45 lines
1.2 KiB
Text
Raw Normal View History

2015-05-02 16:36:51 +02:00
#!/bin/bash
2017-03-18 19:12:51 +01:00
set -eu
app=$YNH_APP_INSTANCE_NAME
2016-06-18 10:36:18 +02:00
# Installation paths
INSTALL_DIR=/opt/yunohost/ihatemoney
PIP=${INSTALL_DIR}/venv/bin/pip
REQUIREMENTS=${INSTALL_DIR}/src/budget/requirements.txt
# Source YunoHost helpers
. /usr/share/yunohost/helpers
# 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" ];
then
2016-06-18 10:36:18 +02:00
is_public=0
else
is_public=1
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
2016-06-18 10:36:18 +02:00
sudo rsync -a --delete-after ../sources/ ${INSTALL_DIR}/src/
sudo find ${INSTALL_DIR}/src/ -type f | while read LINE; do sudo chmod 640 "$LINE" ; done
sudo find ${INSTALL_DIR}/src/ -type d | while read LINE; do sudo chmod 755 "$LINE" ; done
2015-05-02 16:36:51 +02:00
sudo chown -R ihatemoney:ihatemoney /opt/yunohost/ihatemoney/src
sudo chown -R www-data:www-data /opt/yunohost/ihatemoney/src/budget/static
2016-06-18 10:36:18 +02:00
# Re-create settings symlink
sudo ln -s /etc/ihatemoney/settings.py /opt/yunohost/ihatemoney/src/budget/settings.py
# Upgrade dependencies
sudo ${PIP} install -r ${REQUIREMENTS}
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