1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/zeronet_ynh.git synced 2024-09-03 17:46:12 +02:00
zeronet_ynh/scripts/upgrade
whypsi d87e7807c0 Squashed commit of the following:
commit f64d3c0eca9ee13888524a07b8d178140b52620e
Author: whypsi <whypsi@riseup.net>
Date:   Sat Mar 4 13:35:24 2017 +0100

    Several improvements

    ZeroNet application is now owned by user
    Cleans up code
2017-03-04 13:35:40 +01:00

34 lines
1.1 KiB
Bash
Executable file

#!/usr/bin/env bash
# Exit on command errors and treat unset variables as an error
set -eu
source /usr/share/yunohost/helpers
source functions.sh
main() {
local app=${YNH_APP_INSTANCE_NAME}
local user=$( ynh_app_setting_get $app user )
local deploy_path=$( ynh_app_setting_get $app deploy_path )
local symlink_to_deploy_path=$( ynh_app_setting_get $app symlink_to_deploy_path )
local installed_version=$( ynh_app_setting_get $app installed_version )
local systemd_service_name=$( ynh_app_setting_get $app systemd_service_name )
local app_config=../conf/app.src
local source_version=$(app_config_get $app_config "SOURCE_VERSION")
local old_deploy_path=$deploy_path
local new_deploy_path=$( make_deploy_path $app $source_version )
obtain_and_deploy_source $app_config $new_deploy_path $symlink_to_deploy_path $user
sudo systemctl restart $systemd_service_name
ynh_app_setting_set $app installed_version $source_version
ynh_app_setting_set $app deploy_path $new_deploy_path
if [ $new_deploy_path != $old_deploy_path ]; then
sudo rm -rf $old_deploy_path
fi
}
main