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

Add rollback function to upgrade

This commit is contained in:
Jocelyn Delalande 2018-02-17 00:21:07 +01:00
parent d738df4875
commit 05807e6a47

View file

@ -34,6 +34,20 @@ fi
ynh_app_setting_set "$app" is_public "$is_public"
function exit_properly () {
set +e
# Revert to the old venv
if [ -e /opt/yunohost/ihatemoney/venv-old ]
then
sudo mv /opt/yunohost/ihatemoney/venv{-old,}
fi
# Remove downloaded code
sudo rm -rf ${INSTALL_DIR}/src-new/
ynh_die "Upgrade script failed, aborted and rolled back the installation"
}
trap exit_properly ERR
# Upgrade code
fetch_and_extract ${INSTALL_DIR}/src-new/ ihatemoney