mirror of
https://github.com/YunoHost-Apps/spip_ynh.git
synced 2024-09-03 20:25:59 +02:00
Merge 44ed072afb
into 04c0c8a912
This commit is contained in:
commit
7b00ca94b6
11 changed files with 106 additions and 203 deletions
|
@ -1,49 +0,0 @@
|
|||
;; Test complet
|
||||
; Manifest
|
||||
domain="domain.tld"
|
||||
path="/path"
|
||||
is_public=1
|
||||
admin="john"
|
||||
password="1Strong-Password"
|
||||
users_status="Editor"
|
||||
; Checks
|
||||
pkg_linter=1
|
||||
setup_sub_dir=1
|
||||
setup_root=1
|
||||
setup_nourl=0
|
||||
setup_private=1
|
||||
setup_public=1
|
||||
upgrade=1
|
||||
# 3.2.4~ynh1
|
||||
#upgrade=1 from_commit=e079b0d81e698c9cde7e9ce50b29da1d5715bf65
|
||||
# 3.2.5~ynh1
|
||||
#upgrade=1 from_commit=bf4e4ecbed70de828d0a0828f3240febb25dde0e
|
||||
# 3.2.7~ynh2
|
||||
upgrade=1 from_commit=a13cdbc22324173e983cf8c358920615d8c10e64
|
||||
# 3.2.7~ynh3
|
||||
upgrade=1 from_commit=69521e339ffc50e4960968b63d2aee8ffe81f854
|
||||
# 3.2.8~ynh1
|
||||
upgrade=1 from_commit=810fd850466139fe4b7ee31eabc13d81d4020698
|
||||
# 3.2.8~ynh2
|
||||
upgrade=1 from_commit=0d7e9e61e95d2ad6e1443566d2c45325730fd29b
|
||||
# 3.2.9~ynh2
|
||||
upgrade=1 from_commit=7cb55ab7365af2c52b3c709127da860b87f932fc
|
||||
backup_restore=1
|
||||
multi_instance=1
|
||||
port_already_use=0
|
||||
change_url=1
|
||||
;;; Upgrade options
|
||||
; commit=e079b0d81e698c9cde7e9ce50b29da1d5715bf65
|
||||
name=3.2.4~ynh1
|
||||
; commit=bf4e4ecbed70de828d0a0828f3240febb25dde0e
|
||||
name=3.2.5~ynh1
|
||||
; commit=a13cdbc22324173e983cf8c358920615d8c10e64
|
||||
name=3.2.7~ynh2
|
||||
; commit=69521e339ffc50e4960968b63d2aee8ffe81f854
|
||||
name=3.2.7~ynh3
|
||||
; commit=810fd850466139fe4b7ee31eabc13d81d4020698
|
||||
name=3.2.8~ynh1
|
||||
; commit=0d7e9e61e95d2ad6e1443566d2c45325730fd29b
|
||||
name=3.2.8~ynh2
|
||||
; commit=7cb55ab7365af2c52b3c709127da860b87f932fc
|
||||
name=3.2.9~ynh2
|
|
@ -1,4 +0,0 @@
|
|||
; Additional php.ini defines, specific to this pool of workers.
|
||||
|
||||
php_admin_value[upload_max_filesize] = 50M
|
||||
php_admin_value[post_max_size] = 50M
|
|
@ -41,7 +41,7 @@ location __PATH__/ {
|
|||
|
||||
location ~ [^/]\.php(/|$) {
|
||||
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
|
||||
fastcgi_pass unix:/var/run/php/php__PHPVERSION__-fpm-__NAME__.sock;
|
||||
fastcgi_pass unix:/var/run/php/php__PHP_VERSION__-fpm-__APP__.sock;
|
||||
|
||||
fastcgi_index index.php;
|
||||
include fastcgi_params;
|
||||
|
|
|
@ -18,7 +18,8 @@ userdoc = "https://www.spip.net/en_rubrique57.html"
|
|||
code = "https://git.spip.net/spip/spip"
|
||||
|
||||
[integration]
|
||||
yunohost = ">= 11.1.19"
|
||||
yunohost = ">= 11.2.18"
|
||||
helpers_version = "2.1"
|
||||
architectures = "all"
|
||||
multi_instance = true
|
||||
ldap = false
|
||||
|
@ -62,6 +63,7 @@ ram.runtime = "50M"
|
|||
[resources.system_user]
|
||||
|
||||
[resources.install_dir]
|
||||
group = "www-data:r-x"
|
||||
|
||||
[resources.permissions]
|
||||
main.url = "/"
|
||||
|
|
|
@ -1,11 +1,7 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# COMMON VARIABLES
|
||||
#=================================================
|
||||
|
||||
#=================================================
|
||||
# EXPERIMENTAL HELPERS
|
||||
# COMMON VARIABLES AND CUSTOM HELPERS
|
||||
#=================================================
|
||||
|
||||
# Send an email to inform the administrator
|
||||
|
@ -95,21 +91,27 @@ __PRE_TAG1__$(yunohost tools diagnosis | grep -B 100 "services:" | sed '/service
|
|||
if [ "$admin_mail_html" -eq 1 ]
|
||||
then
|
||||
# Insert 'br' tags at each ending of lines.
|
||||
ynh_replace_string "$" "<br>" mail_to_send
|
||||
# FIXMEhelpers2.1: ynh_replace used with positional args. Please add the keywords: --match=, --replace=, --file=
|
||||
ynh_replace "$" "<br>" mail_to_send
|
||||
|
||||
# Insert starting HTML tags
|
||||
sed --in-place '1s@^@<!DOCTYPE html>\n<html>\n<head></head>\n<body>\n@' mail_to_send
|
||||
|
||||
# Keep tabulations
|
||||
ynh_replace_string " " "\ \ " mail_to_send
|
||||
ynh_replace_string "\t" "\ \ " mail_to_send
|
||||
# FIXMEhelpers2.1: ynh_replace used with positional args. Please add the keywords: --match=, --replace=, --file=
|
||||
ynh_replace " " "\ \ " mail_to_send
|
||||
# FIXMEhelpers2.1: ynh_replace used with positional args. Please add the keywords: --match=, --replace=, --file=
|
||||
ynh_replace "\t" "\ \ " mail_to_send
|
||||
|
||||
# Insert url links tags
|
||||
ynh_replace_string "__URL_TAG1__\(.*\)__URL_TAG2__\(.*\)__URL_TAG3__" "<a href=\"\2\">\1</a>" mail_to_send
|
||||
# FIXMEhelpers2.1: ynh_replace used with positional args. Please add the keywords: --match=, --replace=, --file=
|
||||
ynh_replace "__URL_TAG1__\(.*\)__URL_TAG2__\(.*\)__URL_TAG3__" "<a href=\"\2\">\1</a>" mail_to_send
|
||||
|
||||
# Insert pre tags
|
||||
ynh_replace_string "__PRE_TAG1__" "<pre>" mail_to_send
|
||||
ynh_replace_string "__PRE_TAG2__" "<\pre>" mail_to_send
|
||||
# FIXMEhelpers2.1: ynh_replace used with positional args. Please add the keywords: --match=, --replace=, --file=
|
||||
ynh_replace "__PRE_TAG1__" "<pre>" mail_to_send
|
||||
# FIXMEhelpers2.1: ynh_replace used with positional args. Please add the keywords: --match=, --replace=, --file=
|
||||
ynh_replace "__PRE_TAG2__" "<\pre>" mail_to_send
|
||||
|
||||
# Insert finishing HTML tags
|
||||
echo -e "\n</body>\n</html>" >> mail_to_send
|
||||
|
@ -117,11 +119,14 @@ __PRE_TAG1__$(yunohost tools diagnosis | grep -B 100 "services:" | sed '/service
|
|||
# Otherwise, remove tags to keep a plain text.
|
||||
else
|
||||
# Remove URL tags
|
||||
ynh_replace_string "__URL_TAG[1,3]__" "" mail_to_send
|
||||
ynh_replace_string "__URL_TAG2__" ": " mail_to_send
|
||||
# FIXMEhelpers2.1: ynh_replace used with positional args. Please add the keywords: --match=, --replace=, --file=
|
||||
ynh_replace "__URL_TAG[1,3]__" "" mail_to_send
|
||||
# FIXMEhelpers2.1: ynh_replace used with positional args. Please add the keywords: --match=, --replace=, --file=
|
||||
ynh_replace "__URL_TAG2__" ": " mail_to_send
|
||||
|
||||
# Remove PRE tags
|
||||
ynh_replace_string "__PRE_TAG[1-2]__" "" mail_to_send
|
||||
# FIXMEhelpers2.1: ynh_replace used with positional args. Please add the keywords: --match=, --replace=, --file=
|
||||
ynh_replace "__PRE_TAG[1-2]__" "" mail_to_send
|
||||
fi
|
||||
|
||||
# Define binary to use for mail command
|
||||
|
@ -214,7 +219,8 @@ ynh_handle_app_migration () {
|
|||
fi
|
||||
|
||||
#=================================================
|
||||
# CHECK IF IT HAS TO MIGRATE
|
||||
# CHECK IF IT HAS TO MIGRATE
|
||||
|
||||
#=================================================
|
||||
|
||||
migration_process=0
|
||||
|
@ -269,7 +275,8 @@ ynh_handle_app_migration () {
|
|||
cp -a "$settings_dir/$old_app" "$settings_dir/$new_app"
|
||||
|
||||
# Replace the old id by the new one
|
||||
ynh_replace_string "\(^id: .*\)$old_app" "\1$new_app" "$settings_dir/$new_app/settings.yml"
|
||||
# FIXMEhelpers2.1: ynh_replace used with positional args. Please add the keywords: --match=, --replace=, --file=
|
||||
ynh_replace "\(^id: .*\)$old_app" "\1$new_app" "$settings_dir/$new_app/settings.yml"
|
||||
# INFO: There a special behavior with yunohost app setting:
|
||||
# if the id given in argument does not match with the id
|
||||
# stored in the config file, the config file will be purged.
|
||||
|
@ -303,13 +310,16 @@ ynh_handle_app_migration () {
|
|||
#=================================================
|
||||
|
||||
# Replace nginx checksum
|
||||
ynh_replace_string "\(^checksum__etc_nginx.*\)_$old_app" "\1_$new_app/" "$settings_dir/$new_app/settings.yml"
|
||||
# FIXMEhelpers2.1: ynh_replace used with positional args. Please add the keywords: --match=, --replace=, --file=
|
||||
ynh_replace "\(^checksum__etc_nginx.*\)_$old_app" "\1_$new_app/" "$settings_dir/$new_app/settings.yml"
|
||||
|
||||
# Replace php5-fpm checksums
|
||||
ynh_replace_string "\(^checksum__etc_php5.*[-_]\)$old_app" "\1$new_app/" "$settings_dir/$new_app/settings.yml"
|
||||
# FIXMEhelpers2.1: ynh_replace used with positional args. Please add the keywords: --match=, --replace=, --file=
|
||||
ynh_replace "\(^checksum__etc_php5.*[-_]\)$old_app" "\1$new_app/" "$settings_dir/$new_app/settings.yml"
|
||||
|
||||
# Replace install_dir
|
||||
ynh_replace_string "\(^install_dir: .*\)$old_app" "\1$new_app" "$settings_dir/$new_app/settings.yml"
|
||||
# FIXMEhelpers2.1: ynh_replace used with positional args. Please add the keywords: --match=, --replace=, --file=
|
||||
ynh_replace "\(^install_dir: .*\)$old_app" "\1$new_app" "$settings_dir/$new_app/settings.yml"
|
||||
|
||||
#=================================================
|
||||
# MOVE THE DATABASE
|
||||
|
@ -328,17 +338,17 @@ ynh_handle_app_migration () {
|
|||
local sql_dump="/tmp/${db_name}-$(date '+%s').sql"
|
||||
|
||||
# Dump the old database
|
||||
ynh_mysql_dump_db "$db_name" > "$sql_dump"
|
||||
ynh_mysql_dump_db > "$sql_dump"
|
||||
|
||||
# Create a new database
|
||||
#REMOVEME? ynh_mysql_setup_db $new_db_name $new_db_name $db_pwd
|
||||
#REMOVEME? # FIXMEhelpers2.1 ynh_mysql_create_db $new_db_name $new_db_name $db_pwd
|
||||
# Then restore the old one into the new one
|
||||
ynh_mysql_connect_as $new_db_name $db_pwd $new_db_name < "$sql_dump"
|
||||
ynh_mysql_db_shell < "$sql_dump"
|
||||
|
||||
# Remove the old database
|
||||
#REMOVEME? ynh_mysql_remove_db $db_name $db_name
|
||||
#REMOVEME? # FIXMEhelpers2.1 ynh_mysql_drop_db && ynh_mysql_drop_user $db_name $db_name
|
||||
# And the dump
|
||||
ynh_secure_remove "$sql_dump"
|
||||
ynh_safe_rm "$sql_dump"
|
||||
|
||||
# Update the value of $db_name
|
||||
db_name=$new_db_name
|
||||
|
@ -368,14 +378,14 @@ ynh_handle_app_migration () {
|
|||
local old_package_name="${old_app//_/-}-ynh-deps"
|
||||
local new_package_name="${new_app//_/-}-ynh-deps"
|
||||
|
||||
if ynh_package_is_installed "$old_package_name"
|
||||
if _ynh_apt_package_is_installed"$old_package_name"
|
||||
then
|
||||
# Install a new fake package
|
||||
app=$new_app
|
||||
#REMOVEME? ynh_install_app_dependencies $pkg_dependencies
|
||||
#REMOVEME? ynh_apt_install_dependencies $pkg_dependencies
|
||||
# Then remove the old one
|
||||
app=$old_app
|
||||
#REMOVEME? ynh_remove_app_dependencies
|
||||
#REMOVEME? ynh_apt_remove_dependencies
|
||||
fi
|
||||
fi
|
||||
|
||||
|
@ -385,7 +395,6 @@ ynh_handle_app_migration () {
|
|||
|
||||
app=$new_app
|
||||
|
||||
|
||||
# Set migration_process to 1 to inform that an upgrade has been made
|
||||
migration_process=1
|
||||
fi
|
||||
|
|
|
@ -1,47 +1,38 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# GENERIC START
|
||||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
||||
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
|
||||
source ../settings/scripts/_common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# DECLARE DATA AND CONF FILES TO BACKUP
|
||||
#=================================================
|
||||
ynh_print_info --message="Declaring files to be backed up..."
|
||||
ynh_print_info "Declaring files to be backed up..."
|
||||
|
||||
#=================================================
|
||||
# BACKUP THE APP MAIN DIR
|
||||
#=================================================
|
||||
|
||||
ynh_backup --src_path="$install_dir"
|
||||
ynh_backup "$install_dir"
|
||||
|
||||
#=================================================
|
||||
# BACKUP THE NGINX CONFIGURATION
|
||||
#=================================================
|
||||
|
||||
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
|
||||
#=================================================
|
||||
# BACKUP THE PHP-FPM CONFIGURATION
|
||||
#=================================================
|
||||
|
||||
ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
|
||||
ynh_backup "/etc/php/$php_version/fpm/pool.d/$app.conf"
|
||||
|
||||
#=================================================
|
||||
# BACKUP THE MYSQL DATABASE
|
||||
#=================================================
|
||||
ynh_print_info --message="Backing up the MySQL database..."
|
||||
ynh_print_info "Backing up the MySQL database..."
|
||||
|
||||
ynh_mysql_dump_db --database="$db_name" > db.sql
|
||||
ynh_mysql_dump_db > db.sql
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."
|
||||
ynh_print_info "Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."
|
||||
|
|
|
@ -1,25 +1,17 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# GENERIC STARTING
|
||||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
||||
source _common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# STANDARD MODIFICATIONS
|
||||
#=================================================
|
||||
# MODIFY URL IN NGINX CONF
|
||||
#=================================================
|
||||
ynh_script_progression --message="Updating NGINX web server configuration..."
|
||||
ynh_script_progression "Updating NGINX web server configuration..."
|
||||
|
||||
ynh_change_url_nginx_config
|
||||
ynh_config_change_url_nginx
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Change of URL completed for $app" --last
|
||||
ynh_script_progression "Change of URL completed for $app"
|
||||
|
|
|
@ -1,11 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# GENERIC START
|
||||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
||||
source _common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
|
@ -14,46 +8,44 @@ source /usr/share/yunohost/helpers
|
|||
#=================================================
|
||||
|
||||
password=$YNH_APP_ARG_PASSWORD
|
||||
ynh_app_setting_set --app=$app --key=password --value=$password
|
||||
ynh_app_setting_set --key=password --value=$password
|
||||
|
||||
#=================================================
|
||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Setting up source files..."
|
||||
ynh_script_progression "Setting up source files..."
|
||||
|
||||
# Download, check integrity, uncompress and patch the source from app.src
|
||||
ynh_setup_source --dest_dir="$install_dir"
|
||||
|
||||
chmod -R o-rwx "$install_dir"
|
||||
chown -R $app:www-data "$install_dir"
|
||||
|
||||
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod -R o-rwx "$install_dir"
|
||||
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R $app:www-data "$install_dir"
|
||||
#=================================================
|
||||
# PHP-FPM CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring PHP-FPM..."
|
||||
ynh_script_progression "Configuring PHP-FPM..."
|
||||
|
||||
# Create a dedicated PHP-FPM config
|
||||
ynh_add_fpm_config --usage=low --footprint=low
|
||||
ynh_config_add_phpfpm
|
||||
|
||||
# Create a dedicated NGINX config
|
||||
ynh_add_nginx_config
|
||||
ynh_config_add_nginx
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC SETUP
|
||||
#=================================================
|
||||
# SETUP APPLICATION WITH CURL
|
||||
#=================================================
|
||||
ynh_script_progression --message="Setuping application with cURL..."
|
||||
ynh_script_progression "Setuping application with cURL..."
|
||||
|
||||
# Set right permissions for curl install
|
||||
mkdir -p $install_dir/plugins/auto
|
||||
chown -R $app:www-data "$install_dir"
|
||||
|
||||
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R $app:www-data "$install_dir"
|
||||
# Set the app as temporarily public for curl call
|
||||
ynh_script_progression --message="Configuring SSOwat..."
|
||||
ynh_script_progression "Configuring SSOwat..."
|
||||
|
||||
# Installation with cURL
|
||||
ynh_script_progression --message="Finalizing installation..."
|
||||
ynh_script_progression "Finalizing installation..."
|
||||
ynh_local_curl "/ecrire/?suivant" "exec=install" "etape=chmod"
|
||||
ynh_local_curl "/ecrire/?suivant" "exec=install" "etape=2" "chmod=750" "adresse_db=localhost" "login_db=$db_name" "pass_db=$db_pwd" "server_db=mysql"
|
||||
ynh_local_curl "/ecrire/?suivant" "exec=install" "etape=3" "adresse_db=localhost" "login_db=$db_name" "pass_db=$db_pwd" "server_db=mysql" "choix_db=$db_name" "tprefix=$db_name"
|
||||
|
@ -85,9 +77,10 @@ ynh_local_curl "/ecrire/?suivant" "exec=install" "etape=fin"
|
|||
#=================================================
|
||||
# ADD A CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Adding a configuration file..."
|
||||
ynh_script_progression "Adding $app's configuration..."
|
||||
|
||||
#ynh_replace_string "'','utf8');" "'ldap.php','utf8');" $install_dir/config/connect.php
|
||||
## FIXMEhelpers2.1: ynh_replace used with positional args. Please add the keywords: --match=, --replace=, --file=
|
||||
ynh_replace "'','utf8');" "'ldap.php','utf8');" $install_dir/config/connect.php
|
||||
cp ../conf/mes_options.php $install_dir/config/mes_options.php
|
||||
|
||||
# Add security fix https://www.spip.net/en_article4201.html to be removed after version 4.2.2
|
||||
|
@ -97,10 +90,10 @@ cp ../conf/ecran_securite.php $install_dir/config/ecran_securite.php
|
|||
# STORE THE CONFIG FILE CHECKSUM
|
||||
#=================================================
|
||||
|
||||
ynh_store_file_checksum --file="$install_dir/config/connect.php"
|
||||
ynh_store_file_checksum "$install_dir/config/connect.php"
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Installation of $app completed" --last
|
||||
ynh_script_progression "Installation of $app completed"
|
||||
|
|
|
@ -1,11 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# GENERIC START
|
||||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
||||
source _common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
|
@ -14,19 +8,19 @@ source /usr/share/yunohost/helpers
|
|||
#=================================================
|
||||
# STOP AND REMOVE SERVICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Stopping and removing the systemd service..."
|
||||
ynh_script_progression "Stopping and removing the systemd service..."
|
||||
|
||||
# Remove the dedicated systemd config
|
||||
ynh_remove_systemd_config
|
||||
ynh_config_remove_systemd
|
||||
|
||||
# Remove the dedicated NGINX config
|
||||
ynh_remove_nginx_config
|
||||
ynh_config_remove_nginx
|
||||
|
||||
# Remove the dedicated PHP-FPM config
|
||||
ynh_remove_fpm_config
|
||||
ynh_config_remove_phpfpm
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Removal of $app completed" --last
|
||||
ynh_script_progression "Removal of $app completed"
|
||||
|
|
|
@ -1,11 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# GENERIC START
|
||||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
||||
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
|
||||
source ../settings/scripts/_common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
@ -13,42 +7,39 @@ source /usr/share/yunohost/helpers
|
|||
#=================================================
|
||||
# RESTORE THE APP MAIN DIR
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the app main directory..."
|
||||
ynh_script_progression "Restoring the app main directory..."
|
||||
|
||||
ynh_restore_file --origin_path="$install_dir"
|
||||
|
||||
chmod -R o-rwx "$install_dir"
|
||||
chown -R $app:www-data "$install_dir"
|
||||
ynh_restore "$install_dir"
|
||||
|
||||
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod -R o-rwx "$install_dir"
|
||||
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R $app:www-data "$install_dir"
|
||||
#=================================================
|
||||
# RESTORE THE PHP-FPM CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the PHP-FPM configuration..."
|
||||
ynh_script_progression "Restoring the PHP-FPM configuration..."
|
||||
|
||||
# Restore the file first, so it can have a backup if different
|
||||
ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
|
||||
ynh_restore "/etc/php/$php_version/fpm/pool.d/$app.conf"
|
||||
|
||||
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
ynh_restore "/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE MYSQL DATABASE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the MySQL database..."
|
||||
ynh_script_progression "Restoring the MySQL database..."
|
||||
|
||||
ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql
|
||||
ynh_mysql_db_shell < ./db.sql
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
# RELOAD NGINX AND PHP-FPM
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reloading NGINX web server and PHP-FPM..."
|
||||
ynh_script_progression "Reloading NGINX web server and PHP-FPM..."
|
||||
|
||||
ynh_systemd_action --service_name=php$phpversion-fpm --action=reload
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
ynh_systemctl --service=php$php_version-fpm --action=reload
|
||||
ynh_systemctl --service=nginx --action=reload
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Restoration completed for $app"
|
||||
ynh_script_progression "Restoration completed for $app"
|
||||
|
|
|
@ -1,79 +1,63 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# GENERIC START
|
||||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
||||
source _common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# CHECK VERSION
|
||||
#=================================================
|
||||
|
||||
upgrade_type=$(ynh_check_app_version_changed)
|
||||
|
||||
#=================================================
|
||||
# STANDARD UPGRADE STEPS
|
||||
#=================================================
|
||||
# ENSURE DOWNWARD COMPATIBILITY
|
||||
#=================================================
|
||||
ynh_script_progression --message="Ensuring downward compatibility..."
|
||||
ynh_script_progression "Ensuring downward compatibility..."
|
||||
|
||||
# If users_status doesn't exist, create it
|
||||
# FIXMEhelpers2.1: maybe replace with: ynh_app_setting_set_default --key=users_status --value="Editor"
|
||||
if [ -z "${users_status:-}" ]; then
|
||||
users_status="Editor"
|
||||
ynh_app_setting_set --app=$app --key=users_status --value=$users_status
|
||||
ynh_app_setting_set --key=users_status --value=$users_status
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||
#=================================================
|
||||
|
||||
if [ "$upgrade_type" == "UPGRADE_APP" ]
|
||||
# FIXME: this is still supported but the recommendation is now to *always* re-setup the app sources wether or not the upstream sources changed
|
||||
if ynh_app_upstream_version_changed
|
||||
then
|
||||
ynh_script_progression --message="Upgrading source files..."
|
||||
ynh_script_progression "Upgrading source files..."
|
||||
|
||||
# Download, check integrity, uncompress and patch the source from app.src
|
||||
ynh_setup_source --dest_dir="$install_dir"
|
||||
fi
|
||||
|
||||
chmod -R o-rwx "$install_dir"
|
||||
chown -R $app:www-data "$install_dir"
|
||||
|
||||
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod -R o-rwx "$install_dir"
|
||||
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R $app:www-data "$install_dir"
|
||||
#=================================================
|
||||
# PHP-FPM CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading PHP-FPM configuration..."
|
||||
ynh_script_progression "Upgrading PHP-FPM configuration..."
|
||||
|
||||
# Create a dedicated PHP-FPM config
|
||||
ynh_add_fpm_config --usage=low --footprint=low
|
||||
ynh_config_add_phpfpm
|
||||
|
||||
# Create a dedicated NGINX config
|
||||
ynh_add_nginx_config
|
||||
ynh_config_add_nginx
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC UPGRADE
|
||||
#=================================================
|
||||
# SETUP APPLICATION WITH CURL
|
||||
#=================================================
|
||||
ynh_script_progression --message="Setuping application with CURL..."
|
||||
ynh_script_progression "Setuping application with CURL..."
|
||||
|
||||
# Set right permissions for curl install
|
||||
mkdir -p $install_dir/plugins/auto
|
||||
chown -R $app:www-data "$install_dir"
|
||||
|
||||
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R $app:www-data "$install_dir"
|
||||
# Set the app as temporarily public for curl call
|
||||
ynh_script_progression --message="Configuring SSOwat..."
|
||||
ynh_script_progression "Configuring SSOwat..."
|
||||
|
||||
ynh_backup_if_checksum_is_different --file="$install_dir/config/connect.php"
|
||||
ynh_backup_if_checksum_is_different "$install_dir/config/connect.php"
|
||||
|
||||
mv $install_dir/config/connect.php $install_dir/config/connect.php.ynh_bkp
|
||||
|
||||
# Installation with curl
|
||||
ynh_script_progression --message="Finalizing installation..."
|
||||
ynh_script_progression "Finalizing installation..."
|
||||
ynh_local_curl "/ecrire/?suivant" "exec=install" "etape=chmod"
|
||||
ynh_local_curl "/ecrire/?suivant" "exec=install" "etape=2" "chmod=750" "adresse_db=localhost" "login_db=$db_name" "pass_db=$db_pwd" "server_db=mysql"
|
||||
ynh_local_curl "/ecrire/?suivant" "exec=install" "etape=3" "adresse_db=localhost" "login_db=$db_name" "pass_db=$db_pwd" "server_db=mysql" "choix_db=$db_name" "tprefix=$db_name"
|
||||
|
@ -105,9 +89,9 @@ ynh_local_curl "/ecrire/?suivant" "exec=install" "etape=fin"
|
|||
#=================================================
|
||||
# UPDATE A CONFIG FILE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Updating a configuration file..."
|
||||
ynh_script_progression "Updating configuration..."
|
||||
|
||||
#ynh_replace_string --match_string="'','utf8');" --replace_string="'ldap.php','utf8');" --target_file=$install_dir/config/connect.php
|
||||
#ynh_replace --match="'','utf8');" --replace="'ldap.php','utf8');" --file=$install_dir/config/connect.php
|
||||
cp ../conf/mes_options.php $install_dir/config/mes_options.php
|
||||
|
||||
# Add security fix https://www.spip.net/en_article4201.html to be removed after version 4.2.2
|
||||
|
@ -116,13 +100,13 @@ cp ../conf/ecran_securite.php $install_dir/config/ecran_securite.php
|
|||
if [ ! -f $install_dir/config/connect.php ]; then
|
||||
mv $install_dir/config/connect.php.ynh_bkp $install_dir/config/connect.php
|
||||
else
|
||||
ynh_secure_remove --file="$install_dir/config/connect.php.ynh_bkp"
|
||||
ynh_safe_rm "$install_dir/config/connect.php.ynh_bkp"
|
||||
fi
|
||||
|
||||
ynh_store_file_checksum --file="$install_dir/config/connect.php"
|
||||
ynh_store_file_checksum "$install_dir/config/connect.php"
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Upgrade of $app completed" --last
|
||||
ynh_script_progression "Upgrade of $app completed"
|
||||
|
|
Loading…
Add table
Reference in a new issue