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}
|
2017-03-04 13:35:40 +01:00
|
|
|
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")
|
|
|
|
|
2017-03-04 13:35:40 +01:00
|
|
|
local old_deploy_path=$deploy_path
|
|
|
|
local new_deploy_path=$( make_deploy_path $app $source_version )
|
2017-03-03 21:26:30 +01:00
|
|
|
|
2017-03-04 13:35:40 +01:00
|
|
|
obtain_and_deploy_source $app_config $new_deploy_path $symlink_to_deploy_path $user
|
2017-03-03 21:26:30 +01:00
|
|
|
|
2017-03-04 13:35:40 +01:00
|
|
|
sudo systemctl restart $systemd_service_name
|
2017-03-03 21:26:30 +01:00
|
|
|
|
2017-03-04 13:35:40 +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
|
|
|
|
2017-03-04 13:35:40 +01:00
|
|
|
if [ $new_deploy_path != $old_deploy_path ]; then
|
2017-03-03 21:26:30 +01:00
|
|
|
sudo rm -rf $old_deploy_path
|
2017-03-04 13:35:40 +01:00
|
|
|
fi
|
2017-03-03 21:26:30 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
main
|