diff --git a/.gitignore b/.gitignore index 783a4ae..8f144f3 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ *~ *.sw[op] +.DS_Store diff --git a/conf/extra_php-fpm.conf b/conf/extra_php-fpm.conf index 959b6c4..e6b67b5 100644 --- a/conf/extra_php-fpm.conf +++ b/conf/extra_php-fpm.conf @@ -1,6 +1,4 @@ ; Additional php.ini defines, specific to this pool of workers. -php_admin_value[upload_max_filesize] = 500M -php_admin_value[post_max_size] = 500M ; php binary to use for async processes env[ASYNC_PHP_BINARY] = /usr/bin/php8.2 diff --git a/conf/nginx.conf b/conf/nginx.conf index 3e8d95a..eabfbe8 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -25,7 +25,7 @@ location __PATH__/ { location ~ [^/]\.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; include fastcgi_params; diff --git a/conf/sudoers b/conf/sudoers index 16ef847..37870d9 100644 --- a/conf/sudoers +++ b/conf/sudoers @@ -1,2 +1,2 @@ -__USER__ ALL = (root) NOPASSWD: __INSTALL_DIR__/tools/yunohost/private/scripts/yunohost-user-info.sh -__USER__ ALL = (root) NOPASSWD: __INSTALL_DIR__/tools/yunohost/private/scripts/yunohost-app-list.sh +__APP__ ALL = (root) NOPASSWD: __INSTALL_DIR__/tools/yunohost/private/scripts/yunohost-user-info.sh +__APP__ ALL = (root) NOPASSWD: __INSTALL_DIR__/tools/yunohost/private/scripts/yunohost-app-list.sh diff --git a/conf/sync_app_importer.sh b/conf/sync_app_importer.sh index 620d6d1..fb38269 100644 --- a/conf/sync_app_importer.sh +++ b/conf/sync_app_importer.sh @@ -1,2 +1,2 @@ #!/usr/bin/env bash -sudo -u __USER__ bash -c "cd __INSTALL_DIR__ && ./yeswicli importer:sync -s yunohost-cli" +sudo -u __APP__ bash -c "cd __INSTALL_DIR__ && ./yeswicli importer:sync -s yunohost-cli" diff --git a/manifest.toml b/manifest.toml index 3459e47..e222c84 100644 --- a/manifest.toml +++ b/manifest.toml @@ -17,7 +17,8 @@ admindoc = "https://yeswiki.net/?DocumentatioN" code = "https://github.com/YesWiki/yeswiki" [integration] -yunohost = ">= 11.2" +yunohost = ">= 11.2.18" +helpers_version = "2.1" architectures = "all" multi_instance = true ldap = true @@ -103,6 +104,7 @@ sha256 = "e83a21eaa911b7beb2d845a16c896b2d4d4db2a9d5d2dfca8f0b7c910a329203" [resources.system_user] [resources.install_dir] +group = "www-data:r-x" [resources.permissions] main.url = "/" diff --git a/scripts/backup b/scripts/backup index 4693a0b..2a6f84b 100755 --- a/scripts/backup +++ b/scripts/backup @@ -1,59 +1,50 @@ #!/bin/bash -#================================================= -# GENERIC START -#================================================= -# IMPORT GENERIC HELPERS -#================================================= - # Keep this path for calling _common.sh inside the execution's context of backup and restore scripts source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers -#================================================= -# DECLARE DATA AND CONF FILES TO BACKUP -#================================================= -ynh_print_info --message="Declaring files to be backed up..." +ynh_print_info "Declaring files to be backed up..." #================================================= # BACKUP THE APP MAIN DIR #================================================= -ynh_backup --src_path="$install_dir" +ynh_backup "$install_dir" #================================================= # BACKUP THE NGINX CONFIGURATION #================================================= -ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" +ynh_backup "/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" +ynh_backup "/etc/php/$php_version/fpm/pool.d/$app.conf" #================================================= # BACKUP THE IMPORTER PLUGIN SUDOERS FILE #================================================= -ynh_backup --src_path="/etc/sudoers.d/$app" +ynh_backup "/etc/sudoers.d/$app" #================================================= # BACKUP THE IMPORTER PLUGIN POST APP INSTALL HOOK #================================================= -ynh_backup --src_path="/etc/yunohost/hooks.d/post_app_install/${app}_sync_app_importer.sh" +ynh_backup "/etc/yunohost/hooks.d/post_app_install/${app}_sync_app_importer.sh" #================================================= # 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 #================================================= -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)." diff --git a/scripts/change_url b/scripts/change_url index cd14b1e..49b3467 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -1,34 +1,26 @@ #!/bin/bash -#================================================= -# GENERIC STARTING -#================================================= -# IMPORT GENERIC HELPERS -#================================================= - source _common.sh source /usr/share/yunohost/helpers -#================================================= -# STANDARD MODIFICATIONS #================================================= # MODIFY URL IN NGINX CONF #================================================= -ynh_script_progression --message="Updating NGINX web server configuration..." --weight=5 +ynh_script_progression "Updating NGINX web server configuration..." -ynh_change_url_nginx_config +ynh_config_change_url_nginx #================================================= # SPECIFIC MODIFICATIONS #================================================= # UPDATE A CONFIG FILE #================================================= -ynh_script_progression --message="Updating a configuration file..." +ynh_script_progression "Updating configuration..." -ynh_replace_string --match_string="https://$old_domain${old_path%/}" --replace_string="https://$new_domain${new_path%/}" --target_file="$install_dir/wakka.config.php" +ynh_replace --match="https://$old_domain${old_path%/}" --replace="https://$new_domain${new_path%/}" --file="$install_dir/wakka.config.php" #================================================= # END OF SCRIPT #================================================= -ynh_script_progression --message="Change of URL completed for $app" --last +ynh_script_progression "Change of URL completed for $app" diff --git a/scripts/install b/scripts/install index 07b5b1b..458d8a9 100755 --- a/scripts/install +++ b/scripts/install @@ -1,53 +1,49 @@ #!/bin/bash -#================================================= -# GENERIC START -#================================================= -# IMPORT GENERIC HELPERS -#================================================= - source _common.sh source /usr/share/yunohost/helpers +ynh_app_setting_set --key=php_upload_max_filesize --value=500M + #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= -ynh_script_progression --message="Setting up source files..." --weight=5 +ynh_script_progression "Setting up source files..." # Download, check integrity, uncompress and patch the source from app.src ynh_setup_source --dest_dir="$install_dir" -chown -R ${app}:www-data $install_dir -chmod -R u=rwX,g=rX,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 +#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 u=rwX,g=rX,o-rwx $install_dir #================================================= # PHP-FPM 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 -ynh_add_fpm_config --usage=low --footprint=low +ynh_config_add_phpfpm # Create a dedicated NGINX config -ynh_add_nginx_config +ynh_config_add_nginx #================================================= # SPECIFIC SETUP #================================================= # INSTALL COMPOSER DEPENDENCIES #================================================= -ynh_script_progression --message="Installing composer dependencies..." +ynh_script_progression "Installing composer dependencies..." -ynh_exec_warn_less ynh_install_composer --phpversion="$phpversion" --workdir="$install_dir" +ynh_composer_install +ynh_composer_exec install --no-dev #================================================= # SETUP APPLICATION WITH CURL #================================================= # Installation with curl -ynh_script_progression --message="Finalizing installation..." --weight=2 +ynh_script_progression "Finalizing installation..." -admin_temp_pass=$(ynh_string_random 20) +admin_temp_pass=$(ynh_string_random --length=20) wiki_name_escaped=$(echo "$wiki_name" | sed 's/ /%20/g') @@ -71,7 +67,7 @@ fi #================================================= # DOWNLOAD AND CONFIGURE IMPORTER PLUGIN #================================================= -ynh_script_progression --message="Configure importer plugin" --weight=1 +ynh_script_progression "Configure importer plugin" # Download importer plugin from yeswiki repository mkdir -p "$install_dir/tools/importer" @@ -80,51 +76,51 @@ 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 "Configure yunohost plugin" # Download yeswiki plugin from yeswiki repository mkdir -p "$install_dir/tools/yunohost" ynh_setup_source --dest_dir="$install_dir/tools/yunohost" --source_id="yunohostplugin" # Add config at the end of wakka.config.php -ynh_replace_string --match_string=");" --replace_string=" 'dataSources' => [\n'yunohost-cli' => [\n'formId' => '5', // form id used in local bazar\n'lang' => 'fr',\n'importer' => 'YunohostCLIApp', // importer class name (without Importer suffix)\n],\n],\n);" --target_file="$install_dir/wakka.config.php" +ynh_replace --match=");" --replace=" 'dataSources' => [\n'yunohost-cli' => [\n'formId' => '5', // form id used in local bazar\n'lang' => 'fr',\n'importer' => 'YunohostCLIApp', // importer class name (without Importer suffix)\n],\n],\n);" --file="$install_dir/wakka.config.php" SSO_DOMAIN=$(yunohost domain main-domain | sed -e 's/.*: //') -ynh_replace_string --match_string=");" --replace_string=" 'yunohost_sso_domain' => '${SSO_DOMAIN}',\n);" --target_file="$install_dir/wakka.config.php" +ynh_replace --match=");" --replace=" 'yunohost_sso_domain' => '${SSO_DOMAIN}',\n);" --file="$install_dir/wakka.config.php" # Ensure that scripts are executable chmod +x $install_dir/tools/yunohost/private/scripts/*.sh # Add app user in sudoers to authorize to launch yunohost cli commands without password -ynh_add_config --template="sudoers" --destination="/etc/sudoers.d/$app" -chown root:root /etc/sudoers.d/$app +ynh_config_add --template="sudoers" --destination="/etc/sudoers.d/$app" +#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown root:root /etc/sudoers.d/$app # Add a post app install hook to sync the app importer mkdir -p /etc/yunohost/hooks.d/post_app_install -ynh_add_config --template="sync_app_importer.sh" --destination="/etc/yunohost/hooks.d/post_app_install/${app}_sync_app_importer.sh" +ynh_config_add --template="sync_app_importer.sh" --destination="/etc/yunohost/hooks.d/post_app_install/${app}_sync_app_importer.sh" chown root:root /etc/yunohost/hooks.d/post_app_install/${app}_sync_app_importer.sh chmod +x /etc/yunohost/hooks.d/post_app_install/${app}_sync_app_importer.sh # At last, run the YunoHost app importer -ynh_script_progression --message="Import YunoHost apps in bazar" --weight=2 +ynh_script_progression "Import YunoHost apps in bazar" pushd $install_dir -ynh_exec_as $app ./yeswicli importer:sync -s yunohost-cli +ynh_exec_as_app ./yeswicli importer:sync -s yunohost-cli popd if [ "${authprovider}" = "Yunohost SSO" ]; then #================================================= # CONFIGURE YUNOHOST PLUGIN #================================================= - ynh_script_progression --message="Enable YunoHost SSO" --weight=1 + ynh_script_progression "Enable YunoHost SSO" # 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" + ynh_replace --match=");" --replace=" 'enable_yunohost_sso' => true,\n);" --file="$install_dir/wakka.config.php" fi if [ "${wikimodel}" = "CLIC" ]; then #================================================= # DOWNLOAD AND CONFIGURE FERME PLUGIN #================================================= - ynh_script_progression --message="Configure ferme plugin" --weight=2 + ynh_script_progression "Configure ferme plugin" # Download ferme plugin from yeswiki repository mkdir -p "$install_dir/tools/ferme" @@ -135,20 +131,20 @@ if [ "${wikimodel}" = "CLIC" ]; then cp -R ../source/CLIC/files/* $install_dir/files/ # update configuration - ynh_replace_string --match_string=");" --replace_string=" 'favorite_preset' => 'custom/clic.css',\n);" --target_file="$install_dir/wakka.config.php" - ynh_replace_string --match_string=");" --replace_string=" 'favicon' => 'files/faviconclic.png',\n);" --target_file="$install_dir/wakka.config.php" + ynh_replace --match=");" --replace=" 'favorite_preset' => 'custom/clic.css',\n);" --file="$install_dir/wakka.config.php" + ynh_replace --match=");" --replace=" 'favicon' => 'files/faviconclic.png',\n);" --file="$install_dir/wakka.config.php" fi #================================================= # SECURE FILES AND DIRECTORIES #================================================= -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 +#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 +#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 u=rwX,g=rX,o-rwx $install_dir +#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod g-rwx $install_dir/wakka.config.php #================================================= # END OF SCRIPT #================================================= -ynh_script_progression --message="Installation of $app completed" --last +ynh_script_progression "Installation of $app completed" diff --git a/scripts/remove b/scripts/remove index db4d6eb..50ffdc0 100755 --- a/scripts/remove +++ b/scripts/remove @@ -1,33 +1,27 @@ #!/bin/bash -#================================================= -# GENERIC START -#================================================= -# IMPORT GENERIC HELPERS -#================================================= - source _common.sh source /usr/share/yunohost/helpers #================================================= # REMOVE NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Removing NGINX web server configuration..." --weight=1 +ynh_script_progression "Removing NGINX web server configuration..." # Remove the dedicated NGINX config -ynh_remove_nginx_config +ynh_config_remove_nginx # Remove the dedicated PHP-FPM config -ynh_remove_fpm_config +ynh_config_remove_phpfpm # Remove sudoers file -ynh_secure_remove --file="/etc/sudoers/$app" +ynh_safe_rm "/etc/sudoers/$app" # Remove post app install hook -ynh_secure_remove --file="/etc/yunohost/hooks.d/post_app_install/${app}_sync_app_importer.sh" +ynh_safe_rm "/etc/yunohost/hooks.d/post_app_install/${app}_sync_app_importer.sh" #================================================= # END OF SCRIPT #================================================= -ynh_script_progression --message="Removal of $app completed" --last +ynh_script_progression "Removal of $app completed" diff --git a/scripts/restore b/scripts/restore index d50e58d..68ebd0b 100755 --- a/scripts/restore +++ b/scripts/restore @@ -1,11 +1,5 @@ #!/bin/bash -#================================================= -# GENERIC START -#================================================= -# IMPORT GENERIC HELPERS -#================================================= - # Keep this path for calling _common.sh inside the execution's context of backup and restore scripts source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers @@ -13,61 +7,59 @@ source /usr/share/yunohost/helpers #================================================= # RESTORE THE APP MAIN DIR #================================================= -ynh_script_progression --message="Restoring the app main directory..." --weight=2 +ynh_script_progression "Restoring the app main directory..." -ynh_restore_file --origin_path="$install_dir" +ynh_restore "$install_dir" -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 +#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 +#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 u=rwX,g=rX,o-rwx $install_dir +#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | 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_script_progression "Restoring the PHP-FPM configuration..." -ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" +ynh_restore "/etc/php/$php_version/fpm/pool.d/$app.conf" #================================================= # RESTORE THE NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Restoring the NGINX web server configuration..." +ynh_script_progression "Restoring the NGINX web server configuration..." -ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" +ynh_restore "/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= # RESTORE THE IMPORTER PLUGIN SUDOERS FILE #================================================= -ynh_script_progression --message="Restoring the app importer plugin sudoers file..." +ynh_script_progression "Restoring the app importer plugin sudoers file..." -ynh_restore_file --origin_path="/etc/sudoers.d/$app" +ynh_restore "/etc/sudoers.d/$app" #================================================= # RESTORE THE IMPORTER PLUGIN POST APP INSTALL HOOK #================================================= -ynh_script_progression --message="Restoring the app importer post app install hook..." +ynh_script_progression "Restoring the app importer post app install hook..." -ynh_restore_file --origin_path="/etc/yunohost/hooks.d/post_app_install/${app}_sync_app_importer.sh" +ynh_restore "/etc/yunohost/hooks.d/post_app_install/${app}_sync_app_importer.sh" #================================================= # RESTORE THE MYSQL DATABASE #================================================= -ynh_script_progression --message="Restoring the MySQL database..." --weight=3 +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 -#================================================= -# GENERIC FINALIZATION #================================================= # 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_systemd_action --service_name=nginx --action=reload +ynh_systemctl --service=php$php_version-fpm --action=reload +ynh_systemctl --service=nginx --action=reload #================================================= # END OF SCRIPT #================================================= -ynh_script_progression --message="Restoration completed for $app" --last +ynh_script_progression "Restoration completed for $app" diff --git a/scripts/upgrade b/scripts/upgrade index 02272bd..2363f5a 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -1,26 +1,17 @@ #!/bin/bash -#================================================= -# GENERIC START -#================================================= -# IMPORT GENERIC HELPERS -#================================================= - source _common.sh source /usr/share/yunohost/helpers -#================================================= -# CHECK VERSION -#================================================= - -upgrade_type=$(ynh_check_app_version_changed) +ynh_app_setting_set_default --key=php_upload_max_filesize --value=500M #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= -if [ "$upgrade_type" == "UPGRADE_APP" ]; then - ynh_script_progression --message="Upgrading source files..." --weight=5 +# FIXME: this is still supported but the recommendation is now to *always* re-setup the app sources wether or not the upstream sources changed +if ynh_app_upstream_version_changed; then + ynh_script_progression "Upgrading source files..." # 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 @@ -29,47 +20,45 @@ if [ "$upgrade_type" == "UPGRADE_APP" ]; then 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_setup_source --dest_dir="$install_dir" --full_replace --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" + ynh_replace --match="yeswiki_release' \?=> \?'.*',$" --replace="yeswiki_release' => '$(ynh_app_upstream_version)'," --file="$install_dir/wakka.config.php" fi -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 -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" #================================================= # PHP-FPM CONFIGURATION #================================================= -ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=1 +ynh_script_progression "Upgrading system configurations related to $app..." # Create a dedicated PHP-FPM config -ynh_add_fpm_config --usage=low --footprint=low +ynh_config_add_phpfpm # Create a dedicated NGINX config -ynh_add_nginx_config +ynh_config_add_nginx -#================================================= -# SPECIFIC UPGRADE #================================================= # INSTALL COMPOSER DEPENDENCIES #================================================= -ynh_script_progression --message="Installing composer dependencies..." +ynh_script_progression "Installing composer dependencies..." -ynh_exec_warn_less ynh_install_composer --phpversion="$phpversion" --workdir="$install_dir" +ynh_composer_install +ynh_composer_exec install --no-dev #================================================= # DOWNLOAD AND CONFIGURE YUNOHOST PLUGIN #================================================= -ynh_script_progression --message="Upgrading Yunohost plugin..." --weight=3 +ynh_script_progression "Upgrading Yunohost plugin..." # Download yunohost plugin from yeswiki repository -ynh_secure_remove "$install_dir/tools/yunohost" +ynh_safe_rm "$install_dir/tools/yunohost" mkdir -p "$install_dir/tools/yunohost" ynh_setup_source --dest_dir="$install_dir/tools/yunohost" --source_id="yunohostplugin" # Download importer plugin from yeswiki repository -ynh_secure_remove "$install_dir/tools/importer" +ynh_safe_rm "$install_dir/tools/importer" mkdir -p "$install_dir/tools/importer" ynh_setup_source --dest_dir="$install_dir/tools/importer" --source_id="importerplugin" @@ -77,27 +66,27 @@ ynh_setup_source --dest_dir="$install_dir/tools/importer" --source_id="importerp chmod +x $install_dir/tools/yunohost/private/scripts/*.sh # Add app user in sudoers to authorize to launch yunohost cli commands without password -ynh_add_config --template="sudoers" --destination="/etc/sudoers.d/$app" -chown root:root /etc/sudoers.d/$app +ynh_config_add --template="sudoers" --destination="/etc/sudoers.d/$app" +#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown root:root /etc/sudoers.d/$app # Add a post app install hook to sync the app importer mkdir -p /etc/yunohost/hooks.d/post_app_install -ynh_add_config --template="sync_app_importer.sh" --destination="/etc/yunohost/hooks.d/post_app_install/${app}_sync_app_importer.sh" +ynh_config_add --template="sync_app_importer.sh" --destination="/etc/yunohost/hooks.d/post_app_install/${app}_sync_app_importer.sh" chown root:root /etc/yunohost/hooks.d/post_app_install/${app}_sync_app_importer.sh chmod +x /etc/yunohost/hooks.d/post_app_install/${app}_sync_app_importer.sh if [ $(grep yunohost_sso_domain "$install_dir/wakka.config.php" | wc -l) = "0" ]; then SSO_DOMAIN=$(yunohost domain main-domain | sed -e 's/.*: //') - ynh_replace_string --match_string="'wakka_version'" --replace_string="'yunohost_sso_domain' => '${SSO_DOMAIN}',\n 'wakka_version'" --target_file="$install_dir/wakka.config.php" + ynh_replace --match="'wakka_version'" --replace="'yunohost_sso_domain' => '${SSO_DOMAIN}',\n 'wakka_version'" --file="$install_dir/wakka.config.php" fi # ToDo : Add app importer config in wakka.config.php if it is not already there ? # At last, run the YunoHost app importer if its data source is configured if [ $(grep yunohost-cli "$install_dir/wakka.config.php" | wc -l) != "0" ]; then - ynh_script_progression --message="Import YunoHost apps in bazar" --weight=2 + ynh_script_progression "Import YunoHost apps in bazar" pushd $install_dir - ynh_exec_as $app ./yeswicli importer:sync -s yunohost-cli + ynh_exec_as_app ./yeswicli importer:sync -s yunohost-cli popd fi @@ -105,12 +94,12 @@ fi # SECURE FILES AND DIRECTORIES #================================================= -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 +#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 +#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 u=rwX,g=rX,o-rwx $install_dir +#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod g-rwx $install_dir/wakka.config.php #================================================= # END OF SCRIPT #================================================= -ynh_script_progression --message="Upgrade of $app completed" --last +ynh_script_progression "Upgrade of $app completed"