|
|
@ -11,6 +11,7 @@ source /usr/share/yunohost/helpers |
|
|
#================================================= |
|
|
#================================================= |
|
|
# LOAD SETTINGS |
|
|
# LOAD SETTINGS |
|
|
#================================================= |
|
|
#================================================= |
|
|
|
|
|
ynh_print_info "Loading installation settings..." |
|
|
|
|
|
|
|
|
app=$YNH_APP_INSTANCE_NAME |
|
|
app=$YNH_APP_INSTANCE_NAME |
|
|
|
|
|
|
|
|
@ -26,6 +27,7 @@ user=$(ynh_app_setting_get $app user) |
|
|
#================================================= |
|
|
#================================================= |
|
|
# ENSURE DOWNWARD COMPATIBILITY |
|
|
# ENSURE DOWNWARD COMPATIBILITY |
|
|
#================================================= |
|
|
#================================================= |
|
|
|
|
|
ynh_print_info "Ensuring downward compatibility..." |
|
|
|
|
|
|
|
|
# Fix is_public as a boolean value |
|
|
# Fix is_public as a boolean value |
|
|
if [ "$is_public" = "Yes" ]; then |
|
|
if [ "$is_public" = "Yes" ]; then |
|
|
@ -51,6 +53,7 @@ fi |
|
|
#================================================= |
|
|
#================================================= |
|
|
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP |
|
|
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP |
|
|
#================================================= |
|
|
#================================================= |
|
|
|
|
|
ynh_print_info "Backing up the app before upgrading (may take a while)..." |
|
|
|
|
|
|
|
|
# Backup the current version of the app |
|
|
# Backup the current version of the app |
|
|
ynh_backup_before_upgrade |
|
|
ynh_backup_before_upgrade |
|
|
@ -78,6 +81,7 @@ modified_config=$(ynh_backup_if_checksum_is_different "/etc/nginx/conf.d/$domain |
|
|
# Replace nginx config only if it wasn't modified. |
|
|
# Replace nginx config only if it wasn't modified. |
|
|
if [ -z "$modified_config" ] |
|
|
if [ -z "$modified_config" ] |
|
|
then |
|
|
then |
|
|
|
|
|
ynh_print_info "Upgrading nginx web server configuration..." |
|
|
# Create a dedicated nginx config |
|
|
# Create a dedicated nginx config |
|
|
ynh_add_nginx_config |
|
|
ynh_add_nginx_config |
|
|
fi |
|
|
fi |
|
|
@ -85,6 +89,7 @@ fi |
|
|
#================================================= |
|
|
#================================================= |
|
|
# CREATE DEDICATED USER |
|
|
# CREATE DEDICATED USER |
|
|
#================================================= |
|
|
#================================================= |
|
|
|
|
|
ynh_print_info "Making sure dedicated system user exists..." |
|
|
|
|
|
|
|
|
# Create a standard user (not a system user for sftp) |
|
|
# Create a standard user (not a system user for sftp) |
|
|
ynh_system_user_exists "$user" || \ |
|
|
ynh_system_user_exists "$user" || \ |
|
|
@ -104,6 +109,7 @@ modified_config=$(ynh_backup_if_checksum_is_different "/etc/php5/fpm/pool.d/$app |
|
|
# Replace nginx config only if it wasn't modified. |
|
|
# Replace nginx config only if it wasn't modified. |
|
|
if [ -z "$modified_config" ] |
|
|
if [ -z "$modified_config" ] |
|
|
then |
|
|
then |
|
|
|
|
|
ynh_print_info "Upgrading php-fpm configuration..." |
|
|
# Create a dedicated php-fpm config |
|
|
# Create a dedicated php-fpm config |
|
|
ynh_replace_string "__USER__" "$user" "../conf/php-fpm.conf" |
|
|
ynh_replace_string "__USER__" "$user" "../conf/php-fpm.conf" |
|
|
ynh_add_fpm_config |
|
|
ynh_add_fpm_config |
|
|
@ -114,6 +120,7 @@ fi |
|
|
#================================================= |
|
|
#================================================= |
|
|
# CONFIGURE SSH |
|
|
# CONFIGURE SSH |
|
|
#================================================= |
|
|
#================================================= |
|
|
|
|
|
ynh_print_info "Configuring ssh..." |
|
|
|
|
|
|
|
|
# Remove the previous config for upgrading it |
|
|
# Remove the previous config for upgrading it |
|
|
sed -i "/##-> ${app}/,/##<- ${app}/d" /etc/ssh/sshd_config |
|
|
sed -i "/##-> ${app}/,/##<- ${app}/d" /etc/ssh/sshd_config |
|
|
@ -143,6 +150,7 @@ chown root: "$final_path" |
|
|
#================================================= |
|
|
#================================================= |
|
|
# SETUP SSOWAT |
|
|
# SETUP SSOWAT |
|
|
#================================================= |
|
|
#================================================= |
|
|
|
|
|
ynh_print_info "Upgrading SSOwat configuration..." |
|
|
|
|
|
|
|
|
# Make app public if necessary |
|
|
# Make app public if necessary |
|
|
if [ $is_public -eq 1 ] |
|
|
if [ $is_public -eq 1 ] |
|
|
@ -153,5 +161,12 @@ fi |
|
|
#================================================= |
|
|
#================================================= |
|
|
# RELOAD NGINX |
|
|
# RELOAD NGINX |
|
|
#================================================= |
|
|
#================================================= |
|
|
|
|
|
ynh_print_info "Reloading nginx web server..." |
|
|
|
|
|
|
|
|
systemctl reload nginx |
|
|
systemctl reload nginx |
|
|
|
|
|
|
|
|
|
|
|
#================================================= |
|
|
|
|
|
# END OF SCRIPT |
|
|
|
|
|
#================================================= |
|
|
|
|
|
|
|
|
|
|
|
ynh_print_info "Upgrade of $app completed" |