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

33 lines
1 KiB
Bash
Executable file

#!/usr/bin/env bash
source /usr/share/yunohost/helpers
source functions.sh
main() {
ynh_abort_if_errors
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