Migrate to manifestv2 and other changes:

* Move app install dir from /opt to /var/www
* Revamp the way binaries are downloaded thanks to manifestv2 (no need to check for arch, etc)
* Remove custom helpers (exec_as, ynh_handle_app_migration)
* Rename LFS_KEY as LFS_JWT_SECRET and KEY as SECRET_KEY as named in app.ini
* Add JWT_SECRET for oauth and INTERNAL_TOKEN in app.ini
* update upstream sample app.ini URL
* Disable actions for now.
* Automatically add ssh permissions to the system user
* Remove support for upgrade before 1.6.4. Edit test_upgrade_from accordingly.
This commit is contained in:
Félix Piédallu
2023-09-09 11:17:52 +02:00
committed by Félix Piédallu
parent b51febc0f9
commit 60cb5e5ae4
128 changed files with 474 additions and 1648 deletions

View File

@ -4,61 +4,33 @@
# GENERIC START
#=================================================
# Load common variables and helpers
source ./experimental_helper.sh
source ./_common.sh
# IMPORT GENERIC HELPERS
source _common.sh
source /usr/share/yunohost/helpers
ynh_script_progression --message="Loading installation settings..."
# Retrieve domain from app settings
domain=$(ynh_app_setting_get --app $app --key domain)
#=================================================
# STANDARD REMOVE
# REMOVE SYSTEM CONFIGURATIONS
#=================================================
ynh_script_progression --message="Removing system configurations related to $app..." --weight=1
# Stop gitea
ynh_script_progression --message="Stoping services..."
systemctl stop "$app".service
if ynh_exec_warn_less yunohost service status "$app" >/dev/null
then
ynh_script_progression --message="Removing $app service integration..." --weight=1
yunohost service remove "$app"
fi
# Drop MySQL database and user
ynh_script_progression --message="Removing databases..."
ynh_mysql_drop_db "$dbname" 2>/dev/null
ynh_mysql_drop_user "$db_user" 2>/dev/null
ynh_remove_systemd_config
ynh_remove_nginx_config
ynh_remove_logrotate
ynh_remove_fail2ban_config
# Delete app directory and configurations
ynh_script_progression --message="Removing code..."
ynh_secure_remove --file="$final_path"
ynh_script_progression --message="Removing logs..."
ynh_secure_remove --file="/var/log/$app"
# Remove the app-specific logrotate config
ynh_remove_logrotate
# Remove nginx config
ynh_script_progression --message="Removing nginx configuration..."
ynh_remove_nginx_config
# Remove gitea user and data
ynh_script_progression --message="Removing the dedicated system user..."
ynh_system_user_delete $app
# Remove init script
ynh_script_progression --message="Removing systemd units..."
ynh_remove_systemd_config
# Remove monitor
ynh_script_progression --message="Removing gitea service..."
yunohost service remove "$app"
# Remove fail2ban config
ynh_script_progression --message="Removing fail2ban configuration..."
ynh_remove_fail2ban_config
ynh_print_info --message="Due of the backup core only feature the data directory in '$datadir' was not removed. It need to be removed manually to purge app user data."
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Removal of $app completed" --last
sleep 1