1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/yeswiki_ynh.git synced 2024-09-03 18:05:56 +02:00

Merge pull request #91 from Lab-8916100448256/testing

feat(yunohost extension): complete upgrade,  backup, restore and remo…
This commit is contained in:
Florian 2024-06-14 10:14:50 +02:00 committed by GitHub
commit 7950357b1a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 57 additions and 2 deletions

View file

@ -33,6 +33,18 @@ ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
#=================================================
# BACKUP THE IMPORTER PLUGIN SUDOERS FILE
#=================================================
ynh_backup --src_path="/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"
#================================================= #=================================================
# BACKUP THE MYSQL DATABASE # BACKUP THE MYSQL DATABASE
#================================================= #=================================================

View file

@ -77,7 +77,7 @@ ynh_replace_string --match_string="'allow_raw_html' => false," --replace_string=
#================================================= #=================================================
ynh_script_progression --message="Configure importer plugin" --weight=1 ynh_script_progression --message="Configure importer plugin" --weight=1
# Download yeswiki plugin from yeswiki repository # Download importer plugin from yeswiki repository
mkdir -p "$install_dir/tools/importer" mkdir -p "$install_dir/tools/importer"
ynh_setup_source --dest_dir="$install_dir/tools/importer" --source_id="importerplugin" ynh_setup_source --dest_dir="$install_dir/tools/importer" --source_id="importerplugin"
@ -99,6 +99,8 @@ chmod +x $install_dir/tools/yunohost/private/scripts/*.sh
# Add app user in sudoers to authorize to launch yunohost cli commands without password # Add app user in sudoers to authorize to launch yunohost cli commands without password
ynh_add_config --template="sudoers" --destination="/etc/sudoers.d/$app" ynh_add_config --template="sudoers" --destination="/etc/sudoers.d/$app"
chown root:root /etc/sudoers.d/$app chown root:root /etc/sudoers.d/$app
# Add a post app install hook to sync the app importer
ynh_add_config --template="sync_app_importer.sh" --destination="/etc/yunohost/hooks.d/post_app_install/$app_sync_app_importer.sh" ynh_add_config --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 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 chmod +x /etc/yunohost/hooks.d/post_app_install/$app_sync_app_importer.sh

View file

@ -20,7 +20,11 @@ ynh_remove_nginx_config
# Remove the dedicated PHP-FPM config # Remove the dedicated PHP-FPM config
ynh_remove_fpm_config ynh_remove_fpm_config
# TODO: remove /etc/sudoers/$app # Remove sudoers file
ynh_secure_remove --file="/etc/sudoers/$app"
# Remove post app install hook
ynh_secure_remove --file="/etc/yunohost/hooks.d/post_app_install/$app_sync_app_importer.sh"
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT

View file

@ -35,6 +35,20 @@ ynh_script_progression --message="Restoring the NGINX web server configuration..
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" ynh_restore_file --origin_path="/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_restore_file --origin_path="/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_restore_file --origin_path="/etc/yunohost/hooks.d/post_app_install/$app_sync_app_importer.sh"
#================================================= #=================================================
# RESTORE THE MYSQL DATABASE # RESTORE THE MYSQL DATABASE
#================================================= #=================================================

View file

@ -73,6 +73,29 @@ ynh_secure_remove "$install_dir/tools/importer"
mkdir -p "$install_dir/tools/importer" mkdir -p "$install_dir/tools/importer"
ynh_setup_source --dest_dir="$install_dir/tools/importer" --source_id="importerplugin" ynh_setup_source --dest_dir="$install_dir/tools/importer" --source_id="importerplugin"
# 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
# Add a post app install hook to sync the app importer
ynh_add_config --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
# ToDo : Add importer config in wakka.config.php if it is not already there ?
# if [ ??? ]; then
# ynh_replace_string --match_string=");" --replace_string=" 'dataSources' => [\n'yunohost-cli' => [\n'formId' => '5', // form id used in local bazar\n'lang' >
# fi
# At last, run the YunoHost app importer
ynh_script_progression --message="Import YunoHost apps in bazar" --weight=2
pushd $install_dir
ynh_exec_as $app ./yeswicli importer:sync -s yunohost-cli
popd
#================================================= #=================================================
# SECURE FILES AND DIRECTORIES # SECURE FILES AND DIRECTORIES
#================================================= #=================================================