1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/paheko_ynh.git synced 2024-09-03 19:56:22 +02:00
paheko_ynh/conf/garradin_post_migration.sh
2023-02-08 14:16:42 +01:00

46 lines
1.3 KiB
Bash

#!/bin/bash
# Ending the migration process from Gogs to Gitea
set -u
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source /usr/share/yunohost/helpers
#=================================================
# SET VARIABLES
#=================================================
old_app="__OLD_APP__"
new_app="__NEW_APP__"
script_name="$0"
#=================================================
# DELETE OLD APP'S SESSIONS
#=================================================
[ -n "$old_app" ] && find /var/lib/php/sessions/ -user "$old_app" -delete
#=================================================
# DELETE OLD APP'S SETTINGS
#=================================================
# `app=""` Circumvents this issue: https://github.com/YunoHost/issues/issues/2138
app="" ynh_secure_remove --file="/etc/yunohost/apps/$old_app"
yunohost app ssowatconf
#=================================================
# REMOVE THE OLD USER
#=================================================
ynh_user_exists --username=$old_app && ynh_system_user_delete $old_app
#=================================================
# DELETE THIS SCRIPT
#=================================================
echo "rm $script_name" | at now + 1 minutes