mirror of
https://github.com/YunoHost-Apps/dolibarr_ynh.git
synced 2024-09-03 18:35:53 +02:00
Update to 16.0.3 & scripts improvement & fixs
Update to 16.0.3 & scripts improvement & fixs
This commit is contained in:
commit
52a3492e0c
19 changed files with 313 additions and 153 deletions
|
@ -17,8 +17,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in
|
|||
|
||||
Dolibarr ERP & CRM is a modern software for managing your professional or associative activity (contacts, invoices, orders, stocks, agenda, etc.).
|
||||
|
||||
**Shipped version:** 15.0.3~ynh1
|
||||
|
||||
**Shipped version:** 16.0.3~ynh1
|
||||
|
||||
**Demo:** https://www.dolibarr.org/onlinedemo
|
||||
|
||||
|
|
|
@ -17,8 +17,7 @@ Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour
|
|||
|
||||
Dolibarr ERP & CRM est un logiciel moderne de gestion de votre activité professionnelle ou associative (contacts, factures, commandes, stocks, agenda, etc.).
|
||||
|
||||
**Version incluse :** 15.0.3~ynh1
|
||||
|
||||
**Version incluse :** 16.0.3~ynh1
|
||||
|
||||
**Démo :** https://www.dolibarr.org/onlinedemo
|
||||
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
SOURCE_URL=https://github.com/Dolibarr/dolibarr/archive/15.0.3.tar.gz
|
||||
SOURCE_SUM=b145a38f56c44b166721d64909fb12408c6d10d08fcf74d2c00418a60201cc9d
|
||||
SOURCE_SUM_PRG=sha256sum
|
||||
SOURCE_FORMAT=tar.gz
|
||||
SOURCE_IN_SUBDIR=true
|
|
@ -4,11 +4,6 @@ location __PATH__/ {
|
|||
# Path to source
|
||||
alias __FINALPATH__/htdocs/ ;
|
||||
|
||||
# Force usage of https
|
||||
if ($scheme = http) {
|
||||
rewrite ^ https://$server_name$request_uri? permanent;
|
||||
}
|
||||
|
||||
index index.php;
|
||||
|
||||
# Common parameter to increase upload size limit in conjunction with dedicated php-fpm file
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
#!/bin/bash
|
||||
app=__APP__
|
||||
src_path=__FINALPATH__
|
||||
member=__MEMBER__
|
||||
app="$(basename $0 | cut -d- -f 2-)" # Extract the app name from the script name, which is supposed to be something like "50-app_id"
|
||||
src_path=$(yunohost app setting $app final_path)
|
||||
# member=__MEMBER__
|
||||
|
||||
# Sync users
|
||||
if sudo php $src_path/scripts/user/sync_users_ldap2dolibarr.php commitiferror --server=localhost -y; then
|
||||
if sudo php "$src_path/scripts/user/sync_users_ldap2dolibarr.php" commitiferror --server=localhost -y; then
|
||||
echo ldap user update ok
|
||||
else
|
||||
echo ldap user update ended with error
|
||||
fi
|
||||
|
||||
# If YNH users should also be members, sync members
|
||||
if [ $member -eq 1 ];
|
||||
then
|
||||
if sudo php $src_path/scripts/members/sync_members_ldap2dolibarr.php commitiferror 1 --server=localhost -y; then
|
||||
echo ldap member update ok
|
||||
else
|
||||
echo ldap member update ended with error
|
||||
fi
|
||||
fi
|
||||
# if [ $member -eq 1 ];
|
||||
# then
|
||||
# if sudo php "$src_path/scripts/members/sync_members_ldap2dolibarr.php" commitiferror 1 --server=localhost -y; then
|
||||
# echo ldap member update ok
|
||||
# else
|
||||
# echo ldap member update ended with error
|
||||
# fi
|
||||
# fi
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
"en": "Manage the various aspects of your business or association",
|
||||
"fr": "Gérez les différents aspects de votre activité pro ou associative"
|
||||
},
|
||||
"version": "15.0.3~ynh1",
|
||||
"version": "16.0.3~ynh1",
|
||||
"url": "https://www.dolibarr.org/",
|
||||
"upstream": {
|
||||
"license": "GPL-3.0-or-later",
|
||||
|
@ -23,12 +23,12 @@
|
|||
"url": "https://github.com/mastereur"
|
||||
},
|
||||
"requirements": {
|
||||
"yunohost": ">= 4.3.4"
|
||||
"yunohost": ">= 11.0"
|
||||
},
|
||||
"multi_instance": true,
|
||||
"services": [
|
||||
"nginx",
|
||||
"php7.3-fpm",
|
||||
"php7.4-fpm",
|
||||
"mysql"
|
||||
],
|
||||
"arguments": {
|
||||
|
|
|
@ -3,20 +3,24 @@
|
|||
#=================================================
|
||||
# COMMON VARIABLES
|
||||
#=================================================
|
||||
YNH_PHP_VERSION="7.3"
|
||||
YNH_PHP_VERSION="7.4"
|
||||
|
||||
extra_php_dependencies="php${YNH_PHP_VERSION}-mysql \
|
||||
php${YNH_PHP_VERSION}-imagick \
|
||||
php${YNH_PHP_VERSION}-gd \
|
||||
php${YNH_PHP_VERSION}-mbstring \
|
||||
php${YNH_PHP_VERSION}-soap \
|
||||
php${YNH_PHP_VERSION}-curl \
|
||||
php${YNH_PHP_VERSION}-intl \
|
||||
php${YNH_PHP_VERSION}-opcache \
|
||||
php${YNH_PHP_VERSION}-calendar \
|
||||
php${YNH_PHP_VERSION}-zip \
|
||||
php${YNH_PHP_VERSION}-xml \
|
||||
php${YNH_PHP_VERSION}-fileinfo"
|
||||
php_dependencies="php$YNH_PHP_VERSION-mysql \
|
||||
php$YNH_PHP_VERSION-imagick \
|
||||
php$YNH_PHP_VERSION-gd \
|
||||
php$YNH_PHP_VERSION-mbstring \
|
||||
php$YNH_PHP_VERSION-soap \
|
||||
php$YNH_PHP_VERSION-curl \
|
||||
php$YNH_PHP_VERSION-intl \
|
||||
php$YNH_PHP_VERSION-opcache \
|
||||
php$YNH_PHP_VERSION-calendar \
|
||||
php$YNH_PHP_VERSION-zip \
|
||||
php$YNH_PHP_VERSION-xml \
|
||||
php$YNH_PHP_VERSION-fileinfo \
|
||||
php$YNH_PHP_VERSION-imap"
|
||||
|
||||
# dependencies used by the app (must be on a single line)
|
||||
pkg_dependencies="$php_dependencies"
|
||||
|
||||
#=================================================
|
||||
# PERSONAL HELPERS
|
||||
|
|
|
@ -23,8 +23,9 @@ ynh_abort_if_errors
|
|||
domain=$YNH_APP_ARG_DOMAIN
|
||||
path_url=$YNH_APP_ARG_PATH
|
||||
admin=$YNH_APP_ARG_ADMIN
|
||||
member=0
|
||||
#member=0
|
||||
#is_public=0
|
||||
phpversion=$YNH_PHP_VERSION
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
|
@ -48,9 +49,18 @@ ynh_app_setting_set --app=$app --key=domain --value=$domain
|
|||
ynh_app_setting_set --app=$app --key=path --value=$path_url
|
||||
ynh_app_setting_set --app=$app --key=admin --value=$admin
|
||||
#ynh_app_setting_set --app=$app --key=is_public --value=$is_public
|
||||
ynh_app_setting_set --app=$app --key=member --value=$member
|
||||
#ynh_app_setting_set --app=$app --key=member --value=$member
|
||||
ynh_app_setting_set --app=$app --key=version --value=$(ynh_app_upstream_version "../manifest.json")
|
||||
|
||||
#=================================================
|
||||
# STANDARD MODIFICATIONS
|
||||
#=================================================
|
||||
# INSTALL DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Installing dependencies..." --weight=1
|
||||
|
||||
ynh_install_app_dependencies $pkg_dependencies
|
||||
|
||||
#=================================================
|
||||
# CREATE DEDICATED USER
|
||||
#=================================================
|
||||
|
@ -59,8 +69,6 @@ ynh_script_progression --message="Configuring system user..." --weight=2
|
|||
# Create a system user
|
||||
ynh_system_user_create --username=$app --home_dir="$final_path"
|
||||
|
||||
#=================================================
|
||||
# STANDARD MODIFICATIONS
|
||||
#=================================================
|
||||
# CREATE A MYSQL DATABASE
|
||||
#=================================================
|
||||
|
@ -78,6 +86,19 @@ ynh_mysql_execute_as_root --sql="ALTER DATABASE $db_name charset=utf8"
|
|||
#=================================================
|
||||
ynh_script_progression --message="Setting up source files..." --weight=1
|
||||
|
||||
|
||||
# Load the last available version
|
||||
source upgrade.d/upgrade.last.sh
|
||||
|
||||
# Create an app.src for the last version of nextcloud
|
||||
cat > ../conf/app.src << EOF
|
||||
SOURCE_URL=https://github.com/Dolibarr/dolibarr/archive/$next_version.tar.gz
|
||||
SOURCE_SUM=$dolibarr_source_sha256
|
||||
SOURCE_SUM_PRG=sha256sum
|
||||
SOURCE_FORMAT=tar.bz2
|
||||
SOURCE_IN_SUBDIR=true
|
||||
EOF
|
||||
|
||||
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
|
||||
|
||||
# Download, check integrity, uncompress and patch the source from app.src
|
||||
|
@ -91,10 +112,17 @@ touch $final_path/htdocs/conf/conf.php
|
|||
#=================================================
|
||||
# PHP-FPM CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring PHP-FPM and install dependencies..." --weight=2
|
||||
ynh_script_progression --message="Configuring PHP-FPM" --weight=2
|
||||
|
||||
fpm_footprint="medium"
|
||||
fpm_usage="medium"
|
||||
|
||||
ynh_app_setting_set --app=$app --key=fpm_footprint --value=$fpm_footprint
|
||||
ynh_app_setting_set --app=$app --key=fpm_usage --value=$fpm_usage
|
||||
|
||||
# Create a dedicated php-fpm config
|
||||
ynh_add_fpm_config --usage=medium --footprint=medium --package="$extra_php_dependencies"
|
||||
ynh_add_fpm_config --phpversion=$phpversion --usage=$fpm_usage --footprint=$fpm_footprint
|
||||
# Used by ynh_add_nginx_config
|
||||
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
||||
|
||||
#=================================================
|
||||
|
@ -114,14 +142,6 @@ ynh_script_progression --message="Adding a configuration file..." --weight=1
|
|||
|
||||
ynh_add_config --template="../conf/install.forced.php" --destination="$final_path/htdocs/install/install.forced.php"
|
||||
|
||||
#=================================================
|
||||
# CONFIGURE THE HOOK FILE FOR USER CREATE
|
||||
#=================================================
|
||||
fhook=../hooks/post_user_create
|
||||
ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="$fhook"
|
||||
ynh_replace_string --match_string="__MEMBER__" --replace_string="$member" --target_file="$fhook"
|
||||
ynh_replace_string --match_string="__FINALPATH__" --replace_string="$final_path" --target_file="$fhook"
|
||||
|
||||
#=================================================
|
||||
# SETUP APPLICATION WITH CURL
|
||||
#=================================================
|
||||
|
@ -129,10 +149,10 @@ ynh_replace_string --match_string="__FINALPATH__" --replace_string="$final_path"
|
|||
# Set right permissions for curl install
|
||||
chown -R $app: "$final_path"
|
||||
|
||||
# Set the app as temporarily public for curl call
|
||||
ynh_script_progression --message="Configuring permissions..." --weight=1
|
||||
# Set the app as temporarily public for cURL call
|
||||
ynh_permission_update --permission="main" --add="visitors"
|
||||
if ! ynh_permission_has_user --permission "main" --user="visitors"; then
|
||||
ynh_permission_update --permission="main" --add="visitors"
|
||||
fi
|
||||
|
||||
# Reload NGINX
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
|
@ -190,10 +210,10 @@ ynh_mysql_connect_as --user=$db_name --password=$db_pwd --database=$db_name < ..
|
|||
# Populate the database with YNH users.
|
||||
ynh_mysql_connect_as --user=$db_name --password=$db_pwd --database=$db_name < ../conf/sql/ldap_user.sql
|
||||
|
||||
if php $final_path/scripts/user/sync_users_ldap2dolibarr.php commitiferror --server=localhost -y; then
|
||||
if php$phpversion $final_path/scripts/user/sync_users_ldap2dolibarr.php commitiferror --server=localhost -y; then
|
||||
ynh_print_info --message="LDAP user update ok"
|
||||
else
|
||||
ynh_print_warn --message="LDAP user update ended with error"
|
||||
ynh_print_info --message="LDAP user update ended with error"
|
||||
fi
|
||||
|
||||
# Remove the public access
|
||||
|
@ -219,8 +239,15 @@ ynh_store_file_checksum --file="$final_path/htdocs/conf/conf.php"
|
|||
#=================================================
|
||||
# SECURE FILES AND DIRECTORIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring permissions..." --weight=1
|
||||
|
||||
# Set permissions on app files
|
||||
if [ ! -f "$datadir/install.lock" ]; then
|
||||
echo 'This is a lock file to prevent use of install pages (set with permission 440)' > "$datadir/install.lock"
|
||||
chown $app:$app "$datadir/install.lock"
|
||||
chmod 440 "$datadir/install.lock"
|
||||
fi
|
||||
|
||||
chmod 750 "$final_path"
|
||||
chmod -R o-rwx "$final_path"
|
||||
chown -R $app:www-data "$final_path"
|
||||
|
|
|
@ -24,6 +24,13 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
|||
|
||||
#=================================================
|
||||
# STANDARD REMOVE
|
||||
# REMOVE DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing dependencies..." --weight=1
|
||||
|
||||
# Remove metapackage and its dependencies
|
||||
ynh_remove_app_dependencies
|
||||
|
||||
#=================================================
|
||||
# REMOVE THE MYSQL DATABASE
|
||||
#=================================================
|
||||
|
|
|
@ -46,10 +46,12 @@ test ! -d $final_path \
|
|||
#=================================================
|
||||
# STANDARD RESTORATION STEPS
|
||||
#=================================================
|
||||
# RESTORE THE NGINX CONFIGURATION
|
||||
# RECREATE THE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Recreating the dedicated system user..." --weight=3
|
||||
|
||||
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
# Create the dedicated user (if not existing)
|
||||
ynh_system_user_create --username=$app
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE APP MAIN DIR
|
||||
|
@ -59,12 +61,14 @@ ynh_script_progression --message="Restoring the app main directory..." --weight=
|
|||
ynh_restore_file --origin_path="$final_path"
|
||||
|
||||
#=================================================
|
||||
# RECREATE THE DEDICATED USER
|
||||
# SPECIFIC RESTORATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Recreating the dedicated system user..." --weight=3
|
||||
# REINSTALL DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reinstalling dependencies..." --weight=1
|
||||
|
||||
# Create the dedicated user (if not existing)
|
||||
ynh_system_user_create --username=$app
|
||||
# Define and install dependencies
|
||||
ynh_install_app_dependencies $pkg_dependencies
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE PHP-FPM CONFIGURATION
|
||||
|
@ -75,11 +79,14 @@ ynh_print_info --message="Reconfiguring PHP-FPM..."
|
|||
ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
|
||||
|
||||
# Recreate a dedicated php-fpm config
|
||||
ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint --phpversion=$phpversion --package="$extra_php_dependencies"
|
||||
|
||||
ynh_add_fpm_config --phpversion=$phpversion --usage=$fpm_usage --footprint=$fpm_footprint
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC RESTORATION
|
||||
# RESTORE THE NGINX CONFIGURATION
|
||||
#=================================================
|
||||
|
||||
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE MYSQL DATABASE
|
||||
#=================================================
|
||||
|
@ -92,12 +99,14 @@ ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./
|
|||
#=================================================
|
||||
# RESTORE THE LOGROTATE CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the logrotate configuration..." --weight=1
|
||||
|
||||
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
|
||||
|
||||
#=================================================
|
||||
# SECURE FILES AND DIRECTORIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring permissions..." --weight=1
|
||||
|
||||
# Set permissions on app files
|
||||
chmod 750 "$final_path"
|
||||
|
|
235
scripts/upgrade
235
scripts/upgrade
|
@ -19,7 +19,6 @@ app=$YNH_APP_INSTANCE_NAME
|
|||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||
path_url=$(ynh_app_setting_get --app=$app --key=path)
|
||||
admin=$(ynh_app_setting_get --app=$app --key=admin)
|
||||
member=$(ynh_app_setting_get --app=$app --key=member)
|
||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
language=$(ynh_app_setting_get --app=$app --key=language)
|
||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||
|
@ -29,7 +28,7 @@ datadir=$final_path/documents/
|
|||
|
||||
fpm_footprint=$(ynh_app_setting_get --app=$app --key=fpm_footprint)
|
||||
fpm_usage=$(ynh_app_setting_get --app=$app --key=fpm_usage)
|
||||
phpversion=$(ynh_app_setting_get --app="$app" --key=phpversion)
|
||||
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
||||
|
||||
#=================================================
|
||||
# CHECK VERSION
|
||||
|
@ -51,6 +50,8 @@ ynh_clean_setup () {
|
|||
# Exit if an error occurs during the execution of the script
|
||||
ynh_abort_if_errors
|
||||
|
||||
#=================================================
|
||||
# STANDARD UPGRADE STEPS
|
||||
#=================================================
|
||||
# ENSURE DOWNWARD COMPATIBILITY
|
||||
#=================================================
|
||||
|
@ -87,10 +88,16 @@ if ynh_legacy_permissions_exists; then
|
|||
ynh_app_setting_delete --app=$app --key=is_public
|
||||
fi
|
||||
|
||||
# Create a permission if needed
|
||||
if ! ynh_permission_exists --permission "public_space"; then
|
||||
ynh_permission_create --permission "public_space" --url "/public/" --allowed "visitors"
|
||||
fi
|
||||
|
||||
# Delete existing ini configuration file (backward compatibility)
|
||||
if [ -f /etc/php/$YNH_PHP_VERSION/fpm/conf.d/20-$app.ini ]; then
|
||||
ynh_secure_remove --file=/etc/php/$YNH_PHP_VERSION/fpm/conf.d/20-$app.ini
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# CREATE DEDICATED USER
|
||||
#=================================================
|
||||
|
@ -100,24 +107,26 @@ ynh_script_progression --message="Making sure dedicated system user exists..." -
|
|||
ynh_system_user_create --username=$app --home_dir="$final_path"
|
||||
|
||||
#=================================================
|
||||
# STANDARD UPGRADE STEPS
|
||||
#=================================================
|
||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||
# UPGRADE DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading dependencies..." --weight=1
|
||||
|
||||
if [ "$upgrade_type" == "UPGRADE_APP" ]
|
||||
then
|
||||
ynh_script_progression --message="Upgrading source files..." --weight=70
|
||||
|
||||
# Download, check integrity, uncompress and patch the source from app.src
|
||||
ynh_setup_source --dest_dir="$final_path"
|
||||
fi
|
||||
ynh_install_app_dependencies $pkg_dependencies
|
||||
|
||||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=1
|
||||
|
||||
ynh_backup_if_checksum_is_different --file="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
|
||||
# Delete current NGINX configuration to be able to check if .well-known is already served.
|
||||
ynh_remove_nginx_config
|
||||
ynh_app_setting_delete --app=$app --key="checksum__etc_nginx_conf.d_$domain.d_$app.conf"
|
||||
|
||||
# Wait untils NGINX has fully reloaded
|
||||
ynh_systemd_action --service_name=nginx --action=reload --line_match="Reloaded" --log_path="systemd"
|
||||
|
||||
# Create a dedicated nginx config
|
||||
ynh_add_nginx_config
|
||||
|
||||
|
@ -129,86 +138,149 @@ ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=2
|
|||
# If php has changed, remove the old fpm config file
|
||||
# if [ "$phpversion" != $YNH_PHP_VERSION ]
|
||||
# then
|
||||
# ynh_backup_if_checksum_is_different --file="/etc/php/$phpversion/fpm/pool.d/$app.conf"
|
||||
# ynh_secure_remove --file="/etc/php/$phpversion/fpm/pool.d/$app.conf"
|
||||
# if [ -f /etc/php/$phpversion/fpm/conf.d/20-$app.ini ]; then
|
||||
# ynh_secure_remove --file="/etc/php/$phpversion/fpm/conf.d/20-$app.ini"
|
||||
# fi
|
||||
# ynh_systemd_action --service_name="php${phpversion}-fpm" --action=reload
|
||||
# ynh_backup_if_checksum_is_different --file="/etc/php/$phpversion/fpm/pool.d/$app.conf"
|
||||
# ynh_secure_remove --file="/etc/php/$phpversion/fpm/pool.d/$app.conf"
|
||||
# if [ -f /etc/php/$phpversion/fpm/conf.d/20-$app.ini ]; then
|
||||
# ynh_secure_remove --file="/etc/php/$phpversion/fpm/conf.d/20-$app.ini"
|
||||
# fi
|
||||
# ynh_systemd_action --service_name="php${phpversion}-fpm" --action=reload
|
||||
|
||||
# phpversion="$YNH_PHP_VERSION"
|
||||
# phpversion="$YNH_PHP_VERSION"
|
||||
# fi
|
||||
|
||||
# Recreate a dedicated PHP-FPM config
|
||||
ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint --package="$extra_php_dependencies"
|
||||
ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint
|
||||
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC UPGRADE
|
||||
#=================================================
|
||||
# LAUNCH UPGRADE
|
||||
# MAKE SEQUENTIAL UPGRADES FROM EACH MAJOR
|
||||
# VERSION TO THE NEXT ONE
|
||||
#=================================================
|
||||
|
||||
if [ "$upgrade_type" == "UPGRADE_APP" ]
|
||||
then
|
||||
ynh_script_progression --message="Upgrading app from $current_version to $update_version" --weight=3
|
||||
ynh_script_progression --message="Upgrading source files..." --weight=60
|
||||
|
||||
chown -R $app: "$final_path"
|
||||
# Load the last available version
|
||||
source upgrade.d/upgrade.last.sh
|
||||
last_version=$next_version
|
||||
|
||||
# Remove the lock if it exists
|
||||
lock=$final_path/documents/install.lock
|
||||
if [ -f $lock ]
|
||||
then
|
||||
ynh_secure_remove $lock
|
||||
fi
|
||||
last_major_version=${last_version%%.*}
|
||||
|
||||
# While the current version is not the last version, do an upgrade
|
||||
while [ "$last_version" != "$current_version" ]
|
||||
do
|
||||
|
||||
mkdir -p /var/log/$app/
|
||||
|
||||
# Upgrade with CURL
|
||||
|
||||
# Set the app as temporarily public for cURL call
|
||||
ynh_permission_update --permission="main" --add="visitors"
|
||||
# The major version is the first part of the version number
|
||||
current_major_version=${current_version%%.*}
|
||||
|
||||
if [ ! -f upgrade.d/upgrade.$current_major_version.sh ]; then
|
||||
source upgrade.d/upgrade.last.sh
|
||||
else
|
||||
source upgrade.d/upgrade.$current_major_version.sh
|
||||
fi
|
||||
|
||||
pushd $final_path/htdocs/install/
|
||||
if php$phpversion upgrade.php $current_version $update_version > /var/log/$app/upgrade.html; then
|
||||
ynh_print_info --message="Step 1 upgrading ended successfully"
|
||||
else
|
||||
ynh_print_warn --message="Step 1 upgrading ended with error"
|
||||
fi
|
||||
# If the current version has the same major version than the next one,
|
||||
# then it's the last upgrade to do
|
||||
# We also cover the case where the last version is the first of the current major version series
|
||||
# (e.g. 20.0.0 is the latest version)
|
||||
if [[ ("$last_major_version" -eq "$current_major_version") || ( ("$last_major_version" -eq "$((current_major_version+1))") && ("$next_version" == "$last_version") ) ]]; then
|
||||
current_major_version=last
|
||||
fi
|
||||
|
||||
# Load the value for this version
|
||||
source upgrade.d/upgrade.$current_major_version.sh
|
||||
|
||||
ynh_exec_fully_quiet sleep 5
|
||||
|
||||
if php$phpversion upgrade2.php $current_version $update_version > /var/log/$app/upgrade2.html; then
|
||||
ynh_print_info --message="Step 2 upgrading ended successfully"
|
||||
else
|
||||
ynh_print_warn --message="Step 2 upgrading ended with error"
|
||||
fi
|
||||
|
||||
ynh_exec_fully_quiet sleep 5
|
||||
|
||||
charset=$(mysql -ss -N -e "SELECT default_character_set_name FROM information_schema.SCHEMATA WHERE schema_name = '$db_name'")
|
||||
if [ "$charset" != "utf8" ]
|
||||
then
|
||||
ynh_script_progression --message="Changing Database charset to utf8" --weight=5
|
||||
ynh_print_info --message="Upgrading app from $current_version to $next_version"
|
||||
|
||||
ynh_mysql_execute_as_root --database=$db_name --sql="ALTER DATABASE $db_name charset=utf8"
|
||||
|
||||
ynh_local_curl "/install/repair.php" \
|
||||
"force_utf8_on_tables=confirmed" > /var/log/$app/repair.html
|
||||
fi
|
||||
# Create an app.src for this version of Dolibarr
|
||||
cat > ../conf/app.src << EOF
|
||||
SOURCE_URL=https://github.com/Dolibarr/dolibarr/archive/$next_version.tar.gz
|
||||
SOURCE_SUM=$dolibarr_source_sha256
|
||||
SOURCE_SUM_PRG=sha256sum
|
||||
SOURCE_FORMAT=tar.bz2
|
||||
SOURCE_IN_SUBDIR=true
|
||||
EOF
|
||||
|
||||
ynh_exec_fully_quiet sleep 5
|
||||
|
||||
if php$phpversion step5.php $current_version $update_version > /var/log/$app/upgrade3.html; then
|
||||
ynh_print_info --message="Step 3 upgrading ended successfully"
|
||||
else
|
||||
ynh_print_warn --message="Step 3 upgrading ended with error"
|
||||
fi
|
||||
|
||||
ynh_app_setting_set --app=$app --key=version --value=$update_version
|
||||
# Download, check integrity, uncompress and patch the source from app.src
|
||||
ynh_setup_source --dest_dir="$final_path"
|
||||
|
||||
popd
|
||||
|
||||
ynh_permission_update --permission="main" --remove="visitors"
|
||||
chown -R $app: "$final_path"
|
||||
|
||||
# Remove the lock if it exists
|
||||
lock=$final_path/documents/install.lock
|
||||
if [ -f $lock ]
|
||||
then
|
||||
ynh_secure_remove $lock
|
||||
fi
|
||||
|
||||
mkdir -p /var/log/$app/
|
||||
|
||||
# Upgrade with CURL
|
||||
|
||||
# Set the app as temporarily public for cURL call
|
||||
if ! ynh_permission_has_user --permission "main" --user="visitors"; then
|
||||
ynh_permission_update --permission="main" --add="visitors"
|
||||
fi
|
||||
|
||||
|
||||
charset=$(mysql -ss -N -e "SELECT default_character_set_name FROM information_schema.SCHEMATA WHERE schema_name = '$db_name'")
|
||||
if [ "$charset" != "utf8" ]
|
||||
then
|
||||
ynh_print_info --message="Changing Database charset to utf8"
|
||||
|
||||
ynh_mysql_execute_as_root --database=$db_name --sql="ALTER DATABASE $db_name charset=utf8"
|
||||
|
||||
ynh_local_curl "/install/repair.php" \
|
||||
"force_utf8_on_tables=confirmed" > /var/log/$app/repair.html
|
||||
fi
|
||||
|
||||
ynh_exec_fully_quiet sleep 5
|
||||
|
||||
pushd $final_path/htdocs/install/
|
||||
|
||||
if php$phpversion upgrade.php $current_version $next_version > /var/log/$app/upgrade.html; then
|
||||
ynh_print_info --message="Step 1 upgrading ended successfully"
|
||||
else
|
||||
ynh_die --message="Step 1 upgrading ended with error"
|
||||
fi
|
||||
|
||||
ynh_exec_fully_quiet sleep 5
|
||||
|
||||
if php$phpversion upgrade2.php $current_version $next_version > /var/log/$app/upgrade2.html; then
|
||||
ynh_print_info --message="Step 2 upgrading ended successfully"
|
||||
else
|
||||
ynh_die --message="Step 2 upgrading ended with error"
|
||||
fi
|
||||
|
||||
ynh_exec_fully_quiet sleep 5
|
||||
|
||||
if php$phpversion step5.php $current_version $next_version > /var/log/$app/upgrade3.html; then
|
||||
ynh_print_info --message="Step 3 upgrading ended successfully"
|
||||
else
|
||||
ynh_die --message="Step 3 upgrading ended with error"
|
||||
fi
|
||||
|
||||
|
||||
popd
|
||||
|
||||
ynh_permission_update --permission="main" --remove="visitors"
|
||||
|
||||
# Get the new current version number
|
||||
current_version=$next_version
|
||||
current_major_version=${current_version%%.*}
|
||||
|
||||
done
|
||||
|
||||
if php$phpversion $final_path/scripts/user/sync_users_ldap2dolibarr.php commitiferror --server=localhost -y; then
|
||||
ynh_print_info --message="LDAP user update ok"
|
||||
else
|
||||
ynh_print_info --message="LDAP user update ended with error"
|
||||
fi
|
||||
|
||||
ynh_app_setting_set --app=$app --key=version --value=$update_version
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
|
@ -228,23 +300,20 @@ ynh_script_progression --message="Upgrading logrotate configuration..." --weight
|
|||
# Use logrotate to manage app-specific logfile(s)
|
||||
ynh_use_logrotate --non-append
|
||||
|
||||
#=================================================
|
||||
# UPDATE THE HOOK FILE FOR USER CREATE
|
||||
#=================================================
|
||||
|
||||
# Set system group in hooks
|
||||
fhook=../hooks/post_user_create
|
||||
ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="$fhook"
|
||||
ynh_replace_string --match_string="__MEMBER__" --replace_string="$member" --target_file="$fhook"
|
||||
ynh_replace_string --match_string="__FINALPATH__" --replace_string="$final_path" --target_file="$fhook"
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
# SECURE FILES AND DIRECTORIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring permissions..." --weight=1
|
||||
|
||||
# Set permissions on app files
|
||||
if [ ! -f "$datadir/install.lock" ]; then
|
||||
echo 'This is a lock file to prevent use of install pages (set with permission 440)' > "$datadir/install.lock"
|
||||
chown $app:$app "$datadir/install.lock"
|
||||
chmod 440 "$datadir/install.lock"
|
||||
fi
|
||||
|
||||
chmod 750 "$final_path"
|
||||
chmod -R o-rwx "$final_path"
|
||||
chown -R $app:www-data "$final_path"
|
||||
|
@ -256,7 +325,7 @@ chmod go-w $datadir
|
|||
#=================================================
|
||||
# RELOAD NGINX
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reloading NGINX web server and PHP-FPM..." --weight=1
|
||||
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
|
||||
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
|
||||
|
|
7
scripts/upgrade.d/upgrade.10.sh
Normal file
7
scripts/upgrade.d/upgrade.10.sh
Normal file
|
@ -0,0 +1,7 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Target version of the Dolibarr update
|
||||
next_version="11.0.5"
|
||||
|
||||
# Dolibarr tarball checksum
|
||||
dolibarr_source_sha256="6f51435a4ffe576e836bf6449d900de9a56016f09591322cb2ba47a07c97679d"
|
7
scripts/upgrade.d/upgrade.11.sh
Normal file
7
scripts/upgrade.d/upgrade.11.sh
Normal file
|
@ -0,0 +1,7 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Target version of the Dolibarr update
|
||||
next_version="12.0.5"
|
||||
|
||||
# Dolibarr tarball checksum
|
||||
dolibarr_source_sha256="b60b124ebcd294375f6200cc0683449e475b5dec687f8317b820fc8ec1413d21"
|
7
scripts/upgrade.d/upgrade.12.sh
Normal file
7
scripts/upgrade.d/upgrade.12.sh
Normal file
|
@ -0,0 +1,7 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Target version of the Dolibarr update
|
||||
next_version="13.0.5"
|
||||
|
||||
# Dolibarr tarball checksum
|
||||
dolibarr_source_sha256="08ec08dc5093d614361f273237f5aaf8d70e63d764c2fa8d7f3f68a1485156d0"
|
7
scripts/upgrade.d/upgrade.13.sh
Normal file
7
scripts/upgrade.d/upgrade.13.sh
Normal file
|
@ -0,0 +1,7 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Target version of the Dolibarr update
|
||||
next_version="14.0.5"
|
||||
|
||||
# Dolibarr tarball checksum
|
||||
dolibarr_source_sha256="31f4c934e484a9582d8867e4170f1f1acd8c41628b059370a6a449eb6e94ae75"
|
7
scripts/upgrade.d/upgrade.14.sh
Normal file
7
scripts/upgrade.d/upgrade.14.sh
Normal file
|
@ -0,0 +1,7 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Target version of the Dolibarr update
|
||||
next_version="15.0.3"
|
||||
|
||||
# Dolibarr tarball checksum
|
||||
dolibarr_source_sha256="b145a38f56c44b166721d64909fb12408c6d10d08fcf74d2c00418a60201cc9d"
|
7
scripts/upgrade.d/upgrade.15.sh
Normal file
7
scripts/upgrade.d/upgrade.15.sh
Normal file
|
@ -0,0 +1,7 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Target version of the Dolibarr update
|
||||
next_version="16.0.3"
|
||||
|
||||
# Dolibarr tarball checksum
|
||||
dolibarr_source_sha256="52010375412c780b378145633a4e18abf6bde4c8e89a4cc1ad56d98fcd6120fd"
|
7
scripts/upgrade.d/upgrade.9.sh
Normal file
7
scripts/upgrade.d/upgrade.9.sh
Normal file
|
@ -0,0 +1,7 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Target version of the Dolibarr update
|
||||
next_version="10.0.7"
|
||||
|
||||
# Dolibarr tarball checksum
|
||||
dolibarr_source_sha256="6efc230f400a7b7152a0e4b9ba02a780f38b869b4aebd2bc28883268270ef871"
|
7
scripts/upgrade.d/upgrade.last.sh
Normal file
7
scripts/upgrade.d/upgrade.last.sh
Normal file
|
@ -0,0 +1,7 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Target version of the Dolibarr update
|
||||
next_version="16.0.3"
|
||||
|
||||
# Dolibarr tarball checksum
|
||||
dolibarr_source_sha256="52010375412c780b378145633a4e18abf6bde4c8e89a4cc1ad56d98fcd6120fd"
|
Loading…
Reference in a new issue