diff --git a/check_process b/check_process index b596b87..dfd14a8 100644 --- a/check_process +++ b/check_process @@ -2,10 +2,10 @@ ; Manifest domain="domain.tld" path="/path" - admin="john" - users_status="Editor" is_public=1 - password="thisisapassword" + admin="john" + password="1Strong-Password" + users_status="Editor" ; Checks pkg_linter=1 setup_sub_dir=1 diff --git a/conf/app.src b/conf/app.src index ebeaefc..c417b94 100644 --- a/conf/app.src +++ b/conf/app.src @@ -3,4 +3,5 @@ SOURCE_SUM=ede38c530e459b63f083200eed2e7d385b67c5a08ec5abf73ae75acb9aca3ef6 SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=zip SOURCE_IN_SUBDIR=false +SOURCE_FILENAME= SOURCE_EXTRACT=true diff --git a/conf/nginx.conf b/conf/nginx.conf index 59c6307..ac29444 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -2,7 +2,7 @@ location __PATH__/ { # Path to source - alias __FINALPATH__/ ; + alias __FINALPATH__/; index index.php; diff --git a/manifest.json b/manifest.json index e8e45ba..e1c117d 100644 --- a/manifest.json +++ b/manifest.json @@ -41,6 +41,11 @@ "example": "/spip", "default": "/spip" }, + { + "name": "is_public", + "type": "boolean", + "default": true + }, { "name": "admin", "type": "user" @@ -49,11 +54,6 @@ "name": "password", "type": "password" }, - { - "name": "is_public", - "type": "boolean", - "default": true - }, { "name": "users_status", "type": "string", diff --git a/scripts/_common.sh b/scripts/_common.sh index bf8022b..1d19640 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -1,10 +1,10 @@ #!/bin/bash #================================================= -# SET ALL CONSTANTS +# COMMON VARIABLES #================================================= -YNH_PHP_VERSION="7.3" +YNH_PHP_VERSION="7.4" pkg_dependencies="php${YNH_PHP_VERSION}-sqlite3 php${YNH_PHP_VERSION}-mysql php${YNH_PHP_VERSION}-xml php${YNH_PHP_VERSION}-gd" diff --git a/scripts/install b/scripts/install index 7a1bfe4..17705a0 100644 --- a/scripts/install +++ b/scripts/install @@ -25,8 +25,8 @@ ynh_abort_if_errors domain=$YNH_APP_ARG_DOMAIN path_url=$YNH_APP_ARG_PATH -admin=$YNH_APP_ARG_ADMIN is_public=$YNH_APP_ARG_IS_PUBLIC +admin=$YNH_APP_ARG_ADMIN password=$YNH_APP_ARG_PASSWORD users_status=$YNH_APP_ARG_USERS_STATUS @@ -54,6 +54,8 @@ ynh_app_setting_set --app=$app --key=admin --value=$admin ynh_app_setting_set --app=$app --key=password --value=$password ynh_app_setting_set --app=$app --key=users_status --value=$users_status +#================================================= +# STANDARD MODIFICATIONS #================================================= # INSTALL DEPENDENCIES #================================================= @@ -67,7 +69,7 @@ ynh_install_app_dependencies $pkg_dependencies ynh_script_progression --message="Configuring system user..." # Create a system user -ynh_system_user_create --username=$app --home_dir=$final_path +ynh_system_user_create --username=$app --home_dir="$final_path" #================================================= # CREATE A MYSQL DATABASE @@ -93,14 +95,6 @@ chmod 750 "$final_path" chmod -R o-rwx "$final_path" chown -R $app:www-data "$final_path" -#================================================= -# NGINX CONFIGURATION -#================================================= -ynh_script_progression --message="Configuring NGINX web server..." - -# Create a dedicated NGINX config -ynh_add_nginx_config - #================================================= # PHP-FPM CONFIGURATION #================================================= @@ -109,6 +103,14 @@ ynh_script_progression --message="Configuring PHP-FPM..." # Create a dedicated PHP-FPM config ynh_add_fpm_config +#================================================= +# NGINX CONFIGURATION +#================================================= +ynh_script_progression --message="Configuring NGINX web server..." + +# Create a dedicated NGINX config +ynh_add_nginx_config + #================================================= # SPECIFIC SETUP #================================================= @@ -153,8 +155,9 @@ ynh_local_curl "/ecrire/?suivant" "exec=install" "etape=3b" "adresse_db=localhos ynh_local_curl "/ecrire/?suivant" "exec=install" "etape=fin" #================================================= -# MODIFY A CONFIG FILE +# ADD A CONFIGURATION #================================================= +ynh_script_progression --message="Adding a configuration file..." #ynh_replace_string "'','utf8');" "'ldap.php','utf8');" $final_path/config/connect.php cp ../conf/mes_options.php $final_path/config/mes_options.php diff --git a/scripts/remove b/scripts/remove index 14f781e..8c4a4e1 100644 --- a/scripts/remove +++ b/scripts/remove @@ -39,14 +39,6 @@ ynh_script_progression --message="Removing the MySQL database..." # Remove a database if it exists, along with the associated user ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name -#================================================= -# REMOVE DEPENDENCIES -#================================================= -ynh_script_progression --message="Removing dependencies..." - -# Remove metapackage and its dependencies -ynh_remove_app_dependencies - #================================================= # REMOVE APP MAIN DIR #================================================= @@ -71,6 +63,14 @@ ynh_script_progression --message="Removing PHP-FPM configuration..." # Remove the dedicated PHP-FPM config ynh_remove_fpm_config +#================================================= +# REMOVE DEPENDENCIES +#================================================= +ynh_script_progression --message="Removing dependencies..." + +# Remove metapackage and its dependencies +ynh_remove_app_dependencies + #================================================= # GENERIC FINALIZATION #================================================= diff --git a/scripts/restore b/scripts/restore index 05fc11a..5136010 100644 --- a/scripts/restore +++ b/scripts/restore @@ -39,17 +39,11 @@ phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) #================================================= ynh_script_progression --message="Validating restoration parameters..." -test ! -d $final_path || ynh_die --message="There is already a directory: $final_path " +test ! -d $final_path \ + || ynh_die --message="There is already a directory: $final_path " #================================================= # STANDARD RESTORATION STEPS -#================================================= -# RESTORE THE NGINX CONFIGURATION -#================================================= -ynh_script_progression --message="Restoring the NGINX configuration..." - -ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" - #================================================= # RECREATE THE DEDICATED USER #================================================= @@ -69,6 +63,14 @@ chmod 750 "$final_path" chmod -R o-rwx "$final_path" chown -R $app:www-data "$final_path" +#================================================= +# REINSTALL DEPENDENCIES +#================================================= +ynh_script_progression --message="Reinstalling dependencies..." + +# Define and install dependencies +ynh_install_app_dependencies $pkg_dependencies + #================================================= # RESTORE THE PHP-FPM CONFIGURATION #================================================= @@ -81,15 +83,12 @@ ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" ynh_add_fpm_config --phpversion=$phpversion #================================================= -# REINSTALL DEPENDENCIES +# RESTORE THE NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Reinstalling dependencies..." +ynh_script_progression --message="Restoring the NGINX web server configuration..." -# Define and install dependencies -ynh_install_app_dependencies $pkg_dependencies +ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" -#================================================= -# SPECIFIC RESTORATION #================================================= # RESTORE THE MYSQL DATABASE #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index a534fe3..3fab063 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -118,7 +118,7 @@ fi ynh_script_progression --message="Making sure dedicated system user exists..." # Create a dedicated user (if not existing) -ynh_system_user_create --username=$app --home_dir=$final_path +ynh_system_user_create --username=$app --home_dir="$final_path" #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE @@ -136,14 +136,6 @@ chmod 750 "$final_path" chmod -R o-rwx "$final_path" chown -R $app:www-data "$final_path" -#================================================= -# NGINX CONFIGURATION -#================================================= -ynh_script_progression --message="Upgrading NGINX web server configuration..." - -# Create a dedicated NGINX config -ynh_add_nginx_config - #================================================= # UPGRADE DEPENDENCIES #================================================= @@ -159,6 +151,14 @@ ynh_script_progression --message="Upgrading PHP-FPM configuration..." # Create a dedicated PHP-FPM config ynh_add_fpm_config +#================================================= +# NGINX CONFIGURATION +#================================================= +ynh_script_progression --message="Upgrading NGINX web server configuration..." + +# Create a dedicated NGINX config +ynh_add_nginx_config + #================================================= # SPECIFIC UPGRADE #================================================= @@ -209,14 +209,11 @@ ynh_local_curl "/ecrire/?suivant" "exec=install" "etape=fin" #================================================= # UPDATE A CONFIG FILE #================================================= +ynh_script_progression --message="Updating a configuration file..." #ynh_replace_string --match_string="'','utf8');" --replace_string="'ldap.php','utf8');" --target_file=$final_path/config/connect.php cp ../conf/mes_options.php $final_path/config/mes_options.php -#================================================= -# STORE THE CONFIG FILE CHECKSUM -#================================================= - if [ ! -f $final_path/config/connect.php ]; then mv $final_path/config/connect.php.ynh_bkp $final_path/config/connect.php else