feat(Gitea): add uninstall parameter

This commit is contained in:
EV21 committed 2022-07-31 11:29:27 +02:00
1 parent d041330627
commit 23aedfde45
1 file changed
+47
+47
View File
@@ -51,9 +51,28 @@ function install_gitea
uberspace web backend set / --http --port $DEFAULT_PORT
uberspace web backend list
install_update_script
echo "This is the file structure for this app"
echo_tree
printf "You can now access your $APP_NAME by directing you Browser to: \n https://%s.uber.space \n" "$USER"
}
function uninstall_gitea
{
# If some files do not exist there may be some errors
unset_critical_section
$GITEA_BIN_LOCATION manager flush-queues
supervisorctl stop gitea
sleep 30
mysql --verbose --execute="DROP DATABASE ${USER}_gitea"
rm ~/etc/services.d/gitea.ini
rm -r ~/gitea
rm ~/bin/gitea
rm ~/bin/gitea-update
supervisorctl reread
supervisorctl update
set_critical_section
}
function process_parameters
{
while test $# -gt 0
@@ -65,6 +84,13 @@ function process_parameters
USE_VERSION="$1"
shift
;;
uninstall )
echo "This command tries to revert the $APP_NAME installation, it will delete all of its scripts, service config, ~/gitea directory with all contents and drop the database"
if yes-no_question "Do you really want to do this?"
then uninstall_gitea
fi
exit 0
;;
* )
echo "$1 can not be processed, exiting script"
exit 1
@@ -303,6 +329,27 @@ end_of_content
chmod u+x --verbose ~/bin/gitea-update
}
function echo_tree
{
cat << 'end_of_content'
.
├── bin
│  ├── [-rwxrw-r--] gitea
│  └── [-rwxrw-r--] gitea-update
├── etc
│  ├── services.d
│  │  └── gitea.ini
│  └── ...
├── gitea
│  ├── custom
│  │  └── conf
│  │  └── app.ini
│  ├── data
│  └── [-rwxrw-r--] gitea
└── ...
end_of_content
}
function yes-no_question
{
local question=$1