forked from pylover/gitea-install
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuninstall.sh
executable file
·71 lines (45 loc) · 1.19 KB
/
uninstall.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#! /usr/bin/env bash
source ./common.sh
source ./vars.sh
source ./download.sh
source ./config.sh
source ./systemd.sh
source ./nginx.sh
# Validate the environment
validate
# stop services
systemctl stop gitea.service
systemctl disable gitea.service
# TODO: Backup /home/git
# TODO: Backup database
# TODO: Backup /var/lib/gitea
# TODO: Backup /etc/gitea
# delete database and role
sql DROP DATABASE gitea
sql DROP ROLE ${GITEA_USER}
# Delete directory structure
rm -rf ${GITEA_WORKINGDIR}/{custom,data,log}
rmdir ${GITEA_WORKINGDIR}
rm -rf ${GITEA_CONFIGDIR}
# delete gitea binary
rm /usr/local/bin/gitea
# delete gitea binary autocompletion
rm /usr/share/bash-completion/completions/gitea
# delete systemd service and socket
rm ${GITEA_SYSTEMD_SERVICEFILE}
systemctl daemon-reload
# delete nginx config
service nginx stop
rm /etc/nginx/sites-available/${GITEA_DOMAIN}
rm /etc/nginx/sites-enabled/${GITEA_DOMAIN}
service nginx start
# delete certbot
certbot delete --cert-name ayot.net
# Delete the gitea user
if [ -n "$(grep -P "^${GITEA_USER}" /etc/passwd)" ]; then
deluser \
--system \
--remove-home \
${GITEA_USER}
fi
echo "Bingo! Gitea webserver successfully uninstalled."