1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/dolibarr_ynh.git synced 2024-09-03 18:35:53 +02:00

[autopatch] Automatic patch attempt for helpers 2.1

This commit is contained in:
Yunohost-Bot 2024-08-30 22:49:44 +02:00 committed by Alexandre Aubin
parent f5aa3c34ce
commit 700947608d
13 changed files with 114 additions and 133 deletions

1
.gitignore vendored
View file

@ -1,2 +1,3 @@
*~ *~
*.sw[op] *.sw[op]
.DS_Store

View file

@ -1,10 +1,7 @@
; Additional php.ini defines, specific to this pool of workers. ; Additional php.ini defines, specific to this pool of workers.
; Common values to change to increase file upload limit ; Common values to change to increase file upload limit
php_admin_value[upload_max_filesize] = 50M
php_admin_value[post_max_size] = 50M
; Other common parameters ; Other common parameters
php_admin_value[max_execution_time] = 1600 php_admin_value[max_execution_time] = 1600
php_admin_value[max_input_time] = 300 php_admin_value[max_input_time] = 300
php_admin_value[memory_limit] = 256M

View file

@ -12,7 +12,7 @@ location __PATH__/ {
try_files $uri $uri/ index.php; try_files $uri $uri/ index.php;
location ~ [^/]\.php(/|$) { location ~ [^/]\.php(/|$) {
fastcgi_split_path_info ^(.+?\.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; fastcgi_index index.php;
include fastcgi_params; include fastcgi_params;

View file

@ -21,7 +21,8 @@ code = "https://github.com/Dolibarr/dolibarr"
cpe = "cpe:2.3:a:dolibarr:dolibarr" cpe = "cpe:2.3:a:dolibarr:dolibarr"
[integration] [integration]
yunohost = ">= 11.2" yunohost = ">= 11.2.18"
helpers_version = "2.1"
architectures = "all" architectures = "all"
multi_instance = true multi_instance = true
ldap = true ldap = true
@ -99,6 +100,7 @@ ram.runtime = "150M"
[resources.system_user] [resources.system_user]
[resources.install_dir] [resources.install_dir]
group = "www-data:r-x"
[resources.permissions] [resources.permissions]
main.url = "/" main.url = "/"

View file

@ -1,41 +1,28 @@
#!/bin/bash #!/bin/bash
#================================================= #=================================================
# COMMON VARIABLES # COMMON VARIABLES AND CUSTOM HELPERS
#=================================================
#=================================================
# PERSONAL HELPERS
#================================================= #=================================================
upgrade_dolibarr() { upgrade_dolibarr() {
ynh_setup_source --source_id="$source_id" --dest_dir="$install_dir" --full_replace=1 \ ynh_setup_source --source_id="$source_id" --dest_dir="$install_dir" --full_replace \
--keep="htdocs/conf/conf.php htdocs/install/install.forced.php" --keep="htdocs/conf/conf.php htdocs/install/install.forced.php"
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 | 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 | chown -R "$app:www-data" "$install_dir"
# Remove the lock if it exists # Remove the lock if it exists
lock=$install_dir/documents/install.lock lock=$install_dir/documents/install.lock
if [ -f "$lock" ]; then if [ -f "$lock" ]; then
ynh_secure_remove --file="$lock" ynh_safe_rm "$lock"
fi fi
pushd "$install_dir/htdocs/install/" pushd "$install_dir/htdocs/install/"
"php$phpversion" upgrade.php "$current_version" "$new_version" "php$php_version" upgrade.php "$current_version" "$new_version"
ynh_exec_fully_quiet sleep 5 sleep 5
"php$phpversion" upgrade2.php "$current_version" "$new_version" "php$php_version" upgrade2.php "$current_version" "$new_version"
ynh_exec_fully_quiet sleep 5 sleep 5
"php$phpversion" step5.php "$current_version" "$new_version" "php$php_version" step5.php "$current_version" "$new_version"
ynh_exec_fully_quiet sleep 5 sleep 5
popd popd
} }
#=================================================
# EXPERIMENTAL HELPERS
#=================================================
#=================================================
# FUTURE OFFICIAL HELPERS
#=================================================

View file

@ -8,36 +8,33 @@
source ../settings/scripts/_common.sh source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#================================================= ynh_print_info "Declaring files to be backed up..."
# DECLARE DATA AND CONF FILES TO BACKUP
#=================================================
ynh_print_info --message="Declaring files to be backed up..."
#================================================= #=================================================
# BACKUP THE APP MAIN DIR # BACKUP THE APP MAIN DIR
#================================================= #=================================================
ynh_backup --src_path="$install_dir" ynh_backup "$install_dir"
#================================================= #=================================================
# BACKUP THE SYSTEM CONFIGURATION # BACKUP THE SYSTEM CONFIGURATION
#================================================= #=================================================
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf"
ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" ynh_backup "/etc/php/$php_version/fpm/pool.d/$app.conf"
ynh_backup --src_path="/etc/logrotate.d/$app" ynh_backup "/etc/logrotate.d/$app"
#================================================= #=================================================
# BACKUP THE MYSQL DATABASE # 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 # 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)."

View file

@ -10,20 +10,20 @@ source /usr/share/yunohost/helpers
#================================================= #=================================================
# MODIFY URL IN NGINX CONF # MODIFY URL IN NGINX CONF
#================================================= #=================================================
ynh_script_progression --message="Updating NGINX web server configuration..." --weight=1 ynh_script_progression "Updating NGINX web server configuration..."
ynh_change_url_nginx_config ynh_config_change_url_nginx
#================================================= #=================================================
# UPDATE conf file # UPDATE conf file
#================================================= #=================================================
ynh_replace_string --target_file="$install_dir/htdocs/conf/conf.php" \ ynh_replace --file="$install_dir/htdocs/conf/conf.php" \
--match_string="$old_domain$old_path" \ --match="$old_domain$old_path" \
--replace_string="$new_domain$new_path" --replace="$new_domain$new_path"
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================
ynh_script_progression --message="Change of URL completed for $app" --last ynh_script_progression "Change of URL completed for $app"

View file

@ -7,83 +7,84 @@
source _common.sh source _common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
ynh_app_setting_set --key=php_memory_limit --value=256M
#================================================= #=================================================
# CREATE A MYSQL DATABASE # CREATE A MYSQL DATABASE
#================================================= #=================================================
ynh_script_progression --message="Configuring $app's MySQL database..." --weight=1 ynh_script_progression "Configuring $app's MySQL database..."
ynh_mysql_execute_as_root --sql="ALTER DATABASE $db_name charset=utf8" ynh_mysql_db_shell <<< "ALTER DATABASE $db_name charset=utf8"
#================================================= #=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE # DOWNLOAD, CHECK AND UNPACK SOURCE
#================================================= #=================================================
ynh_script_progression --message="Setting up source files..." --weight=1 ynh_script_progression "Setting up source files..."
# Download, check integrity, uncompress and patch the source from app.src # Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --source_id="main" --dest_dir="$install_dir" ynh_setup_source --source_id="main" --dest_dir="$install_dir"
mkdir -p "$install_dir/documents" mkdir -p "$install_dir/documents"
chmod 750 "$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 750 "$install_dir"
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 | chmod -R o-rwx "$install_dir"
chmod go-w "$install_dir/documents" chmod go-w "$install_dir/documents"
#================================================= #=================================================
# PREPARE AND INSTALL APP # PREPARE AND INSTALL APP
#================================================= #=================================================
ynh_script_progression --message="Adding $app's configuration file..." --weight=1 ynh_script_progression "Adding $app's configuration file..."
ynh_add_config --template="install.forced.php" --destination="$install_dir/htdocs/install/install.forced.php" ynh_config_add --template="install.forced.php" --destination="$install_dir/htdocs/install/install.forced.php"
#================================================= #=================================================
# SYSTEM CONFIGURATION # SYSTEM CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Adding system configurations related to $app..." --weight=1 ynh_script_progression "Adding system configurations related to $app..."
# Create a dedicated php-fpm config # Create a dedicated php-fpm config
ynh_add_fpm_config ynh_config_add_phpfpm
# Create a dedicated nginx config # Create a dedicated nginx config
ynh_add_nginx_config ynh_config_add_nginx
# Use logrotate to manage application logfile(s) # Use logrotate to manage application logfile(s)
ynh_use_logrotate --logfile="$install_dir/documents/dolibarr.log" ynh_config_add_logrotate "$install_dir/documents/dolibarr.log"
#================================================= #=================================================
# SETUP APPLICATION WITH CURL # SETUP APPLICATION WITH CURL
#================================================= #=================================================
ynh_script_progression --message="Configuring $app ..." --weight=1 ynh_script_progression "Configuring $app ..."
# Create necessary files # Create necessary files
touch "$install_dir/htdocs/conf/conf.php" touch "$install_dir/htdocs/conf/conf.php"
# Set right permissions for curl install # Set right permissions for curl install
chown -R "$app:" "$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:" "$install_dir"
ynh_local_curl "/install/fileconf.php" "testpost=ok" ynh_local_curl "/install/fileconf.php" "testpost=ok"
ynh_exec_fully_quiet sleep 5 sleep 5
ynh_local_curl "/install/step1.php" "testpost=ok" "action=set" ynh_local_curl "/install/step1.php" "testpost=ok" "action=set"
ynh_exec_fully_quiet sleep 5 sleep 5
ynh_local_curl "/install/step2.php" "testpost=ok" "action=set" ynh_local_curl "/install/step2.php" "testpost=ok" "action=set"
ynh_exec_fully_quiet sleep 5 sleep 5
ynh_local_curl "/install/step4.php" "testpost=ok" "action=set" ynh_local_curl "/install/step4.php" "testpost=ok" "action=set"
ynh_exec_fully_quiet sleep 5 sleep 5
# Generate a random password for the admin user (will be ignored because of LDAP) # Generate a random password for the admin user (will be ignored because of LDAP)
password=$(ynh_string_random 8) password=$(ynh_string_random --length=8)
ynh_local_curl "/install/step5.php" "testpost=ok" "action=set" "pass=$password" "pass_verif=$password" ynh_local_curl "/install/step5.php" "testpost=ok" "action=set" "pass=$password" "pass_verif=$password"
ynh_exec_fully_quiet sleep 5 sleep 5
# Setup HTTP auth in conf # Setup HTTP auth in conf
ynh_replace_string --target_file="$install_dir/htdocs/conf/conf.php" \ ynh_replace --file="$install_dir/htdocs/conf/conf.php" \
--match_string="dolibarr_main_authentication='dolibarr'" \ --match="dolibarr_main_authentication='dolibarr'" \
--replace_string="dolibarr_main_authentication='http'" --replace="dolibarr_main_authentication='http'"
# Calculate and store the config file checksum into the app settings # Calculate and store the config file checksum into the app settings
ynh_store_file_checksum --file="$install_dir/htdocs/conf/conf.php" ynh_store_file_checksum "$install_dir/htdocs/conf/conf.php"
chmod 644 "$install_dir/htdocs/conf/conf.php" chmod 644 "$install_dir/htdocs/conf/conf.php"
# Set permissions on app files # Set permissions on app files
@ -93,28 +94,28 @@ if [ ! -f "$install_dir/documents/install.lock" ]; then
chmod 440 "$install_dir/documents/install.lock" chmod 440 "$install_dir/documents/install.lock"
fi fi
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"
chown -R "$app:" "$install_dir/documents" chown -R "$app:" "$install_dir/documents"
#================================================= #=================================================
# SETUP LDAP # SETUP LDAP
#================================================= #=================================================
ynh_script_progression --message="Configuring LDAP for $app..." --weight=1 ynh_script_progression "Configuring LDAP for $app..."
# Populate the LDAP parameters # Populate the LDAP parameters
ynh_mysql_connect_as --user="$db_name" --password="$db_pwd" --database="$db_name" < ../conf/sql/ldap.sql ynh_mysql_db_shell < ../conf/sql/ldap.sql
# Populate the database with YNH users. # Populate the database with YNH users.
ynh_mysql_connect_as --user="$db_name" --password="$db_pwd" --database="$db_name" < ../conf/sql/ldap_user.sql ynh_mysql_db_shell < ../conf/sql/ldap_user.sql
if "php$phpversion" "$install_dir/scripts/user/sync_users_ldap2dolibarr.php" commitiferror --server=localhost -y; then if "php$php_version" "$install_dir/scripts/user/sync_users_ldap2dolibarr.php" commitiferror --server=localhost -y; then
ynh_print_info --message="LDAP user update ok" ynh_print_info "LDAP user update ok"
else else
ynh_print_info --message="LDAP user update ended with error" ynh_print_info "LDAP user update ended with error"
fi fi
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================
ynh_script_progression --message="Installation of $app completed" --last ynh_script_progression "Installation of $app completed"

View file

@ -10,16 +10,16 @@ source /usr/share/yunohost/helpers
#================================================= #=================================================
# REMOVE SYSTEM CONFIGURATIONS # REMOVE SYSTEM CONFIGURATIONS
#================================================= #=================================================
ynh_script_progression --message="Removing system configurations related to $app..." --weight=1 ynh_script_progression "Removing system configurations related to $app..."
# Remove the dedicated nginx config # Remove the dedicated nginx config
ynh_remove_nginx_config ynh_config_remove_nginx
# Remove the dedicated php-fpm config # Remove the dedicated php-fpm config
ynh_remove_fpm_config ynh_config_remove_phpfpm
# Remove the app-specific logrotate config # Remove the app-specific logrotate config
ynh_remove_logrotate ynh_config_remove_logrotate
#================================================= #=================================================
# REMOVE OLD FILES # REMOVE OLD FILES
@ -27,17 +27,17 @@ ynh_remove_logrotate
# Delete old static pool.d conf # Delete old static pool.d conf
old_php_version=7.0 old_php_version=7.0
if [ -f "/etc/php/$old_php_version/fpm/pool.d/$app.conf" ]; then if [ -f "/etc/php/$old_php_version/fpm/pool.d/$app.conf" ]; then
ynh_secure_remove --file="/etc/php/$old_php_version/fpm/pool.d/$app.conf" ynh_safe_rm "/etc/php/$old_php_version/fpm/pool.d/$app.conf"
fi fi
# Remove a directory securely # Remove a directory securely
ynh_secure_remove --file="/etc/$app" ynh_safe_rm "/etc/$app"
# Remove the log files # Remove the log files
ynh_secure_remove --file="/var/log/$app" #REMOVEME? (Apps should not remove their log dir during remove ... this should only happen if --purge is used, and be handled by the core...) ynh_safe_rm "/var/log/$app"
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================
ynh_script_progression --message="Removal of $app completed" --last ynh_script_progression "Removal of $app completed"

View file

@ -11,48 +11,47 @@ source /usr/share/yunohost/helpers
#================================================= #=================================================
# RESTORE THE APP MAIN DIR # RESTORE THE APP MAIN DIR
#================================================= #=================================================
ynh_script_progression --message="Restoring the app main directory..." --weight=1 ynh_script_progression "Restoring the app main directory..."
ynh_restore_file --origin_path="$install_dir" ynh_restore "$install_dir"
chmod 750 "$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 750 "$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"
chmod 644 "$install_dir/htdocs/conf/conf.php" chmod 644 "$install_dir/htdocs/conf/conf.php"
#================================================= #=================================================
# RESTORE THE MYSQL DATABASE # RESTORE THE MYSQL DATABASE
#================================================= #=================================================
ynh_script_progression --message="Restoring the MySQL database..." --weight=1 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
#================================================= #=================================================
# RESTORE SYSTEM CONFIGURATIONS # RESTORE SYSTEM CONFIGURATIONS
#================================================= #=================================================
ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1 ynh_script_progression "Restoring system configurations related to $app..."
# Restore the file first, so it can have a backup if different # 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"
# Recreate a dedicated php-fpm config # Recreate a dedicated php-fpm config
ynh_add_fpm_config --phpversion="$phpversion" ynh_config_add_phpfpm
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" ynh_restore "/etc/nginx/conf.d/$domain.d/$app.conf"
ynh_restore_file --origin_path="/etc/logrotate.d/$app" ynh_restore "/etc/logrotate.d/$app"
#================================================= #=================================================
# RELOAD NGINX AND PHP-FPM # RELOAD NGINX AND PHP-FPM
#================================================= #=================================================
ynh_script_progression --message="Reloading NGINX web server and PHP-FPM..." --weight=1 ynh_script_progression "Reloading NGINX web server and PHP-FPM..."
ynh_systemd_action --service_name="php$phpversion-fpm" --action=reload ynh_systemctl --service="php$php_version-fpm" --action=reload
ynh_systemd_action --service_name=nginx --action=reload ynh_systemctl --service=nginx --action=reload
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================
ynh_script_progression --message="Restoration completed for $app" --last ynh_script_progression "Restoration completed for $app"

View file

@ -7,49 +7,51 @@
source _common.sh source _common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
ynh_app_setting_set_default --key=php_memory_limit --value=256M
#================================================= #=================================================
# ENSURE DOWNWARD COMPATIBILITY # ENSURE DOWNWARD COMPATIBILITY
#================================================= #=================================================
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 ynh_script_progression "Ensuring downward compatibility..."
# If fpm_footprint doesn't exist, create it # If fpm_footprint doesn't exist, create it
if [ -z "${fpm_footprint:-}" ]; then if [ -z "${fpm_footprint:-}" ]; then
fpm_footprint=medium fpm_footprint=medium
ynh_app_setting_set --app=$app --key=fpm_footprint --value=$fpm_footprint #REMOVEME? Everything about fpm_footprint is removed in helpers2.1... | ynh_app_setting_set --key=fpm_footprint --value=$fpm_footprint
fi fi
# If fpm_usage doesn't exist, create it # If fpm_usage doesn't exist, create it
if [ -z "${fpm_usage:-}" ]; then if [ -z "${fpm_usage:-}" ]; then
fpm_usage=medium fpm_usage=medium
ynh_app_setting_set --app=$app --key=fpm_usage --value=$fpm_usage #REMOVEME? Everything about fpm_usage is removed in helpers2.1... | ynh_app_setting_set --key=fpm_usage --value=$fpm_usage
fi fi
# Delete existing ini configuration file (backward compatibility) # Delete existing ini configuration file (backward compatibility)
if [ -f /etc/php/$YNH_PHP_VERSION/fpm/conf.d/20-$app.ini ]; then 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 ynh_safe_rm /etc/php/$YNH_PHP_VERSION/fpm/conf.d/20-$app.ini
fi fi
if [ -n "${version:-}" ]; then if [ -n "${version:-}" ]; then
ynh_app_setting_delete --app=$app --key="version" ynh_app_setting_delete --key="version"
fi fi
charset=$(mysql -ss -N -e "SELECT default_character_set_name FROM information_schema.SCHEMATA WHERE schema_name = '$db_name'") charset=$(mysql -ss -N -e "SELECT default_character_set_name FROM information_schema.SCHEMATA WHERE schema_name = '$db_name'")
if [ "$charset" != "utf8" ]; then if [ "$charset" != "utf8" ]; then
ynh_print_info --message="Changing Database charset to utf8" ynh_print_info "Changing Database charset to utf8"
ynh_mysql_execute_as_root --sql="ALTER DATABASE $db_name charset=utf8" ynh_mysql_db_shell <<< "ALTER DATABASE $db_name charset=utf8"
ynh_local_curl "/install/repair.php" "force_utf8_on_tables=confirmed" ynh_local_curl "/install/repair.php" "force_utf8_on_tables=confirmed"
ynh_exec_fully_quiet sleep 5 sleep 5
fi fi
#================================================= #=================================================
# MAKE SEQUENTIAL UPGRADES FROM EACH MAJOR # MAKE SEQUENTIAL UPGRADES FROM EACH MAJOR
# VERSION TO THE NEXT ONE # VERSION TO THE NEXT ONE
#================================================= #=================================================
ynh_script_progression --message="Upgrading source files..." --weight=60 ynh_script_progression "Upgrading source files..."
# Sort --version-sort cdécembrean handle underscore in versions numbers # Sort --version-sort cdécembrean handle underscore in versions numbers
mapfile -t main_versions < <( mapfile -t main_versions < <(
ynh_read_manifest --manifest_key="resources.sources | keys[]" | grep "main_" | sort --version-sort ynh_read_manifest | keys[]" | grep "main_" | sort --version-sort
) )
current_version="$YNH_APP_CURRENT_VERSION" current_version="$YNH_APP_CURRENT_VERSION"
for version in "${main_versions[@]}"; do for version in "${main_versions[@]}"; do
@ -57,7 +59,7 @@ for version in "${main_versions[@]}"; do
if dpkg --compare-versions "$current_version" ge "$new_version"; then if dpkg --compare-versions "$current_version" ge "$new_version"; then
continue continue
fi fi
ynh_print_info --message="Upgrading app from $current_version to $new_version" ynh_print_info "Upgrading app from $current_version to $new_version"
source_id="$version" source_id="$version"
upgrade_dolibarr upgrade_dolibarr
current_version="$new_version" current_version="$new_version"
@ -66,18 +68,18 @@ done
# Final upgrade to the final version # Final upgrade to the final version
new_version=$(ynh_app_upstream_version) new_version=$(ynh_app_upstream_version)
source_id="main" source_id="main"
ynh_print_info --message="Upgrading app from $current_version to $new_version" ynh_print_info "Upgrading app from $current_version to $new_version"
upgrade_dolibarr upgrade_dolibarr
if "php$phpversion" "$install_dir/scripts/user/sync_users_ldap2dolibarr.php" commitiferror --server=localhost -y; then if "php$php_version" "$install_dir/scripts/user/sync_users_ldap2dolibarr.php" commitiferror --server=localhost -y; then
ynh_print_info --message="LDAP user update ok" ynh_print_info "LDAP user update ok"
else else
ynh_print_info --message="LDAP user update ended with error" ynh_print_info "LDAP user update ended with error"
fi fi
ynh_backup_if_checksum_is_different --file="$install_dir/htdocs/conf/conf.php" ynh_backup_if_checksum_is_different "$install_dir/htdocs/conf/conf.php"
# Recalculate and store the checksum of the file for the next upgrade. # Recalculate and store the checksum of the file for the next upgrade.
ynh_store_file_checksum --file="$install_dir/htdocs/conf/conf.php" ynh_store_file_checksum "$install_dir/htdocs/conf/conf.php"
chmod 644 "$install_dir/htdocs/conf/conf.php" chmod 644 "$install_dir/htdocs/conf/conf.php"
if [ ! -f "$install_dir/documents/install.lock" ]; then if [ ! -f "$install_dir/documents/install.lock" ]; then
@ -86,10 +88,9 @@ if [ ! -f "$install_dir/documents/install.lock" ]; then
chmod 440 "$install_dir/documents/install.lock" chmod 440 "$install_dir/documents/install.lock"
fi fi
chmod 750 "$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 750 "$install_dir"
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 | 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 | chown -R "$app:www-data" "$install_dir"
# mkdir -p "$data_dir" # mkdir -p "$data_dir"
# chown -R $app: "$data_dir" # chown -R $app: "$data_dir"
# chmod go-w $data_dir # chmod go-w $data_dir
@ -97,16 +98,16 @@ chown -R "$app:www-data" "$install_dir"
#================================================= #=================================================
# REAPPLY SYSTEM CONFIGURATIONS # REAPPLY SYSTEM CONFIGURATIONS
#================================================= #=================================================
ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=1 ynh_script_progression "Upgrading system configurations related to $app..."
ynh_add_fpm_config ynh_config_add_phpfpm
ynh_add_nginx_config ynh_config_add_nginx
ynh_use_logrotate --non-append ynh_config_add_logrotate
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================
ynh_script_progression --message="Upgrade of $app completed" --last ynh_script_progression "Upgrade of $app completed"

View file

@ -1,2 +0,0 @@
*~
*.sw[op]

View file

@ -1,2 +0,0 @@
*~
*.sw[op]