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

35 lines
1.1 KiB
Text
Raw Normal View History

2017-03-03 21:26:30 +01:00
#!/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 )
2017-03-03 21:26:30 +01:00
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 )
2017-03-03 21:26:30 +01:00
obtain_and_deploy_source $app_config $new_deploy_path $symlink_to_deploy_path $user
2017-03-03 21:26:30 +01:00
sudo systemctl restart $systemd_service_name
2017-03-03 21:26:30 +01:00
ynh_app_setting_set $app installed_version $source_version
ynh_app_setting_set $app deploy_path $new_deploy_path
2017-03-03 21:26:30 +01:00
if [ $new_deploy_path != $old_deploy_path ]; then
2017-03-03 21:26:30 +01:00
sudo rm -rf $old_deploy_path
fi
2017-03-03 21:26:30 +01:00
}
main