diff --git a/check_process b/check_process index 6d24bc6..89a9335 100644 --- a/check_process +++ b/check_process @@ -1,4 +1,8 @@ ; Test complet + ; pre-upgrade + if [ "$FROM_COMMIT" == "04e1730ff642a2e48dfb533b2136fe90f9eaf133" ]; then + chmod -R o-rwx /var/www/garradin + fi ; Manifest domain="domain.tld" path="/path" @@ -12,6 +16,7 @@ setup_public=1 upgrade=1 upgrade=1 from_commit=7205455e0a806a49c48c6d2f005d80d1b74a3355 + upgrade=1 from_commit=04e1730ff642a2e48dfb533b2136fe90f9eaf133 backup_restore=1 multi_instance=1 change_url=1 @@ -20,5 +25,8 @@ Email= Notification=none ;;; Upgrade options ; commit=7205455e0a806a49c48c6d2f005d80d1b74a3355 - name=Merge pull request #55 from yunohost-bot/issue-and-pr-template + name=Previous version + manifest_arg=domain=DOMAIN&path=PATH&admin=USER&language=fr&is_public=1&password=pass&port=666& + ; commit=04e1730ff642a2e48dfb533b2136fe90f9eaf133 + name=Version 1.0.6~ynh1 manifest_arg=domain=DOMAIN&path=PATH&admin=USER&language=fr&is_public=1&password=pass&port=666& diff --git a/conf/config.local.php b/conf/config.local.php new file mode 100644 index 0000000..e9b8a71 --- /dev/null +++ b/conf/config.local.php @@ -0,0 +1,9 @@ + >(grep -v 'WARNING E: Unable to locate package') #================================================= # GENERIC FINALIZATION diff --git a/scripts/restore b/scripts/restore index d702b05..d712603 100644 --- a/scripts/restore +++ b/scripts/restore @@ -35,7 +35,7 @@ phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) ynh_script_progression --message="Validating restoration parameters..." --weight=4 test ! -d $final_path \ - || ynh_die "There is already a directory: $final_path " + || ynh_die --message="There is already a directory: $final_path " #================================================= # STANDARD RESTORATION STEPS @@ -71,7 +71,9 @@ find "$final_path" -type d -exec chmod 550 {} + find "$final_path" -type f -exec chmod 440 {} + find "$final_path/data" -type d -exec chmod 770 {} + find "$final_path/data" -type f -exec chmod 660 {} + -chmod 660 "$final_path/config.local.php" +chmod 440 "$final_path/config.local.php" +chmod 440 "$final_path/config.local.yunohost.php" +chmod 660 "$final_path/config.local.user.php" #================================================= # RESTORE THE PHP-FPM CONFIGURATION @@ -80,7 +82,8 @@ ynh_script_progression --message="Reconfiguring PHP-FPM..." --weight=6 ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" -ynh_add_fpm_config --package="$extra_php_dependencies" +ynh_install_app_dependencies "$extra_php_dependencies" +ynh_add_fpm_config #================================================= # GENERIC FINALIZATION diff --git a/scripts/upgrade b/scripts/upgrade index 98e376a..accbb30 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -18,8 +18,9 @@ app=$YNH_APP_INSTANCE_NAME domain=$(ynh_app_setting_get --app=$app --key=domain) path_url=$(ynh_app_setting_get --app=$app --key=path) -final_path=$(ynh_app_setting_get --app=$app --key=final_path) || ynh_die "This path already contains a folder" +final_path=$(ynh_app_setting_get --app=$app --key=final_path) || ynh_die --message="This path already contains a folder" phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) +secret_key=$(ynh_string_random --length=50) #================================================= # CHECK VERSION @@ -91,13 +92,14 @@ fi if ynh_compare_current_package_version --comparison lt --version 0.9.8.1~ynh1 then - ynh_script_progression --message="Upgrading upgrade to 0.9.8" --weight=5 + ynh_script_progression --message="Upgrading to 0.9.8" --weight=5 # Download, check integrity, uncompress and patch the source from 0.9.8.src ynh_setup_source --keep="config.local.php" --dest_dir="$final_path" --source_id="0.9.8" # Set permissions on app files ynh_system_user_create --username=$app ynh_add_nginx_config - ynh_add_fpm_config --package="$extra_php_dependencies" + ynh_install_app_dependencies "$extra_php_dependencies" + ynh_add_fpm_config phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) ynh_script_progression --message="restore data..." --weight=10 @@ -138,13 +140,14 @@ fi if ynh_compare_current_package_version --comparison lt --version 1.1.0~ynh1 then - ynh_script_progression --message="Upgrading upgrade to 1.1.0" --weight=5 + ynh_script_progression --message="Upgrading to 1.1.0" --weight=5 # Download, check integrity, uncompress and patch the source from 0.9.8.src ynh_setup_source --keep="config.local.php" --dest_dir="$final_path" --source_id="1.1.0" # Set permissions on app files ynh_system_user_create --username=$app ynh_add_nginx_config - ynh_add_fpm_config --package="$extra_php_dependencies" + ynh_install_app_dependencies "$extra_php_dependencies" + ynh_add_fpm_config phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) ynh_script_progression --message="restore data..." --weight=10 @@ -196,7 +199,7 @@ ynh_script_progression --message="Upgrading source files..." --weight=5 if [ "$upgrade_type" == "UPGRADE_APP" ] then # Download, check integrity, uncompress and patch the source from app.src - ynh_setup_source --keep="config.local.php" --dest_dir="$final_path" + ynh_setup_source --keep="config.local.user.php" --dest_dir="$final_path" fi #================================================= @@ -213,7 +216,8 @@ ynh_add_nginx_config ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=2 # Create a dedicated PHP-FPM config -ynh_add_fpm_config --package="$extra_php_dependencies" +ynh_install_app_dependencies "$extra_php_dependencies" +ynh_add_fpm_config #======================================================= # backup bdd, squelettes directory and config.local.php @@ -255,9 +259,13 @@ fi #================================================= ynh_script_progression --message="Adding a configuration file..." --weight=5 -ynh_add_config --template="config.local.release.php" --destination="$final_path/config.local.release.php" +if ynh_compare_current_package_version --comparison lt --version 1.1.15~ynh1; then + ynh_add_config --template="config.local.user.php" --destination="$final_path/config.local.user.php" +fi -echo -e "\n require 'config.local.release.php;'" >> $final_path/config.local.php +ynh_add_config --template="config.local.php" --destination="$final_path/config.local.php" +ynh_add_config --template="config.local.yunohost.php" --destination="$final_path/config.local.yunohost.php" +# NOTE: Don't overwrite config.local.user.php # Permissions on files and directories chmod -R o-rwx "$final_path" @@ -266,8 +274,9 @@ find "$final_path" -type d -exec chmod 550 {} + find "$final_path" -type f -exec chmod 440 {} + find "$final_path/data" -type d -exec chmod 770 {} + find "$final_path/data" -type f -exec chmod 660 {} + -chmod 660 "$final_path/config.local.php" -chmod 660 "$final_path/config.local.release.php" +chmod 440 "$final_path/config.local.php" +chmod 440 "$final_path/config.local.yunohost.php" +chmod 660 "$final_path/config.local.user.php" #================================================= # RELOAD NGINX @@ -282,7 +291,6 @@ ynh_systemd_action --service_name=nginx --action=reload ynh_script_progression --message="Finalise upgrade" --weight=1 ynh_local_curl "/admin/index.php" -chmod 440 "$final_path/config.local.php" #================================================= # END OF SCRIPT