From c27e334e77719f73fa1b876e913f452efb246c53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Thu, 13 Jun 2024 16:49:41 +0200 Subject: [PATCH] cleaning --- scripts/backup | 6 +----- scripts/install | 20 ++++++++++---------- scripts/remove | 4 ++-- scripts/restore | 23 +++++++++-------------- scripts/upgrade | 33 ++++++++++++--------------------- 5 files changed, 34 insertions(+), 52 deletions(-) diff --git a/scripts/backup b/scripts/backup index 214b288..30f2c81 100755 --- a/scripts/backup +++ b/scripts/backup @@ -22,15 +22,11 @@ ynh_print_info --message="Declaring files to be backed up..." ynh_backup --src_path="$install_dir" #================================================= -# BACKUP THE NGINX CONFIGURATION +# SYSTEM CONFIGURATION #================================================= ynh_backup --src_path="/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" #================================================= diff --git a/scripts/install b/scripts/install index 54c5d6e..c189866 100755 --- a/scripts/install +++ b/scripts/install @@ -21,9 +21,9 @@ chown -R $app:www-data $install_dir chmod -R u=rwX,g=rX,o-rwx $install_dir #================================================= -# PHP-FPM CONFIGURATION +# SYSTEM CONFIGURATION #================================================= -ynh_script_progression --message="Adding system configurations related to $app ..." --weight=1 +ynh_script_progression --message="Adding system configurations related to $app..." --weight=1 # Create a dedicated PHP-FPM config ynh_add_fpm_config @@ -36,7 +36,7 @@ ynh_add_nginx_config #================================================= # INSTALL COMPOSER DEPENDENCIES #================================================= -ynh_script_progression --message="Installing composer dependencies..." +ynh_script_progression --message="Installing Composer dependencies..." ynh_exec_warn_less ynh_install_composer --phpversion="$phpversion" --workdir="$install_dir" @@ -84,7 +84,7 @@ ynh_setup_source --dest_dir="$install_dir/tools/importer" --source_id="importerp #================================================= # DOWNLOAD AND CONFIGURE YUNOHOST PLUGIN #================================================= -ynh_script_progression --message="Configure yunohost plugin" --weight=2 +ynh_script_progression --message="Configure YunoHost plugin" --weight=2 # Download yeswiki plugin from yeswiki repository mkdir -p "$install_dir/tools/yunohost" @@ -109,20 +109,20 @@ pushd $install_dir ynh_exec_as $app ./yeswicli importer:sync -s yunohost-cli popd +#================================================= +# CONFIGURE YUNOHOST PLUGIN +#================================================= if [ "${authprovider}" = "Yunohost SSO" ]; then - #================================================= - # CONFIGURE YUNOHOST PLUGIN - #================================================= ynh_script_progression --message="Enable YunoHost SSO" --weight=1 # Add config at the end of wakka.config.php ynh_replace_string --match_string=");" --replace_string=" 'enable_yunohost_sso' => true,\n);" --target_file="$install_dir/wakka.config.php" fi +#================================================= +# DOWNLOAD AND CONFIGURE FERME PLUGIN +#================================================= if [ "${wikimodel}" = "CLIC" ]; then - #================================================= - # DOWNLOAD AND CONFIGURE FERME PLUGIN - #================================================= ynh_script_progression --message="Configure ferme plugin" --weight=2 # Download ferme plugin from yeswiki repository diff --git a/scripts/remove b/scripts/remove index 03fafa5..1f8502f 100755 --- a/scripts/remove +++ b/scripts/remove @@ -10,9 +10,9 @@ source _common.sh source /usr/share/yunohost/helpers #================================================= -# REMOVE NGINX CONFIGURATION +# REMOVE SYSTEM CONFIGURATIONS #================================================= -ynh_script_progression --message="Removing NGINX web server configuration..." --weight=1 +ynh_script_progression --message="Removing system configurations related to $app..." --weight=1 # Remove the dedicated NGINX config ynh_remove_nginx_config diff --git a/scripts/restore b/scripts/restore index 2dff91d..10b207b 100755 --- a/scripts/restore +++ b/scripts/restore @@ -21,20 +21,6 @@ chown -R $app:www-data $install_dir chmod -R u=rwX,g=rX,o-rwx $install_dir chmod g-rwx $install_dir/wakka.config.php -#================================================= -# RESTORE THE PHP-FPM CONFIGURATION -#================================================= -ynh_script_progression --message="Restoring the PHP-FPM configuration..." --weight=11 - -ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" - -#================================================= -# RESTORE THE NGINX CONFIGURATION -#================================================= -ynh_script_progression --message="Restoring the NGINX web server configuration..." - -ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" - #================================================= # RESTORE THE MYSQL DATABASE #================================================= @@ -42,6 +28,15 @@ ynh_script_progression --message="Restoring the MySQL database..." --weight=3 ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql +#================================================= +# RESTORE SYSTEM CONFIGURATIONS +#================================================= +ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1 + +ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" + +ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" + #================================================= # GENERIC FINALIZATION #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index bd41746..66e8322 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -9,30 +9,21 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# CHECK VERSION -#================================================= - -upgrade_type=$(ynh_check_app_version_changed) - #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= +ynh_script_progression --message="Upgrading source files..." --weight=5 -if [ "$upgrade_type" == "UPGRADE_APP" ]; then - ynh_script_progression --message="Upgrading source files..." --weight=5 +# Download, check integrity, uncompress and patch the source from app.src +# TODO : find a way to sync stable extensions list to avoid hardcoded extensions folders to keep +noncore_extensions="$(echo tools/{accountactivationbyemail,advancedsearch,benevolat,ferme,fontautoinstall,importer,ipblock,lms,login-sso,logincas,loginldap,maintenance,multideletepages,nextcloudconnector,publication,qrcode,stats,tabdyn,twolevels,webhooks,yunohost})" +ferme_instances="$( + cd $install_dir + for p in $(ls -- */wakka.config.php 2>/dev/null); do dirname "$p"; done +)" +ynh_setup_source --dest_dir="$install_dir" --full_replace=1 --keep=".env wakka.config.php files custom private themes $noncore_extensions $ferme_instances" - # Download, check integrity, uncompress and patch the source from app.src - # TODO : find a way to sync stable extensions list to avoid hardcoded extensions folders to keep - noncore_extensions="$(echo tools/{accountactivationbyemail,advancedsearch,benevolat,ferme,fontautoinstall,importer,ipblock,lms,login-sso,logincas,loginldap,maintenance,multideletepages,nextcloudconnector,publication,qrcode,stats,tabdyn,twolevels,webhooks,yunohost})" - ferme_instances="$( - cd $install_dir - for p in $(ls -- */wakka.config.php 2>/dev/null); do dirname "$p"; done - )" - ynh_setup_source --dest_dir="$install_dir" --full_replace=1 --keep=".env wakka.config.php files custom private themes $noncore_extensions $ferme_instances" - - ynh_replace_string --match_string="yeswiki_release' \?=> \?'.*',$" --replace_string="yeswiki_release' => '$(ynh_app_upstream_version)'," --target_file="$install_dir/wakka.config.php" -fi +ynh_replace_string --match_string="yeswiki_release' \?=> \?'.*',$" --replace_string="yeswiki_release' => '$(ynh_app_upstream_version)'," --target_file="$install_dir/wakka.config.php" chmod -R o-rwx "$install_dir" chown -R $app:www-data "$install_dir" @@ -53,7 +44,7 @@ ynh_add_nginx_config #================================================= # INSTALL COMPOSER DEPENDENCIES #================================================= -ynh_script_progression --message="Installing composer dependencies..." +ynh_script_progression --message="Installing Composer dependencies..." ynh_exec_warn_less ynh_install_composer --phpversion="$phpversion" --workdir="$install_dir" @@ -61,7 +52,7 @@ ynh_exec_warn_less ynh_install_composer --phpversion="$phpversion" --workdir="$i # DOWNLOAD AND CONFIGURE YUNOHOST PLUGIN #================================================= -ynh_script_progression --message="Upgrading Yunohost plugin..." --weight=3 +ynh_script_progression --message="Upgrading YunoHost plugin..." --weight=3 # Download yunohost plugin from yeswiki repository ynh_secure_remove "$install_dir/tools/yunohost"