This repository was archived by the owner on Feb 2, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathuninstall.sh
89 lines (77 loc) · 2.15 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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#!/bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin
export PATH
if [ $(id -u) != "0" ]; then
printf "Error: You must be root to run this script!"
exit 1
fi
clear
echo "#############################################################"
echo "# Pureftpd Auto Uninstall Shell Scritp"
echo "# Env: Debian/Ubuntu/Redhat/CentOS"
echo "# See: https://wangyan.org/blog/pureftpd-install-script.html"
echo "# Version: 0.1 build 120805"
echo "#"
echo "# Copyright (c) 2012, WangYan <[email protected]>"
echo "# All rights reserved."
echo "# Distributed under the GNU General Public License, version 3.0."
echo "#"
echo "#############################################################"
echo ""
echo "Are you sure uninstall Pureftpd? (y/n)"
read -p "(Default: n):" UNINSTALL
if [ -z $UNINSTALL ]; then
UNINSTALL="n"
fi
if [ "$UNINSTALL" != "y" ]; then
clear
echo "==========================="
echo "You canceled the uninstall!"
echo "==========================="
exit
else
echo "---------------------------"
echo "Yes, I decided to uninstall!"
echo "---------------------------"
echo ""
fi
echo "Please enter the root password of MySQL:"
read -p "(Default password: 123456):" MYSQL_ROOT_PWD
if [ -z $MYSQL_ROOT_PWD ]; then
MYSQL_ROOT_PWD="123456"
fi
echo "---------------------------"
echo "MySQL root password = $MYSQL_ROOT_PWD"
echo "---------------------------"
echo ""
get_char()
{
SAVEDSTTY=`stty -g`
stty -echo
stty cbreak
dd if=/dev/tty bs=1 count=1 2> /dev/null
stty -raw
stty echo
stty $SAVEDSTTY
}
echo "Press any key to start uninstall..."
echo "Or Ctrl+C cancel and exit ?"
char=`get_char`
echo ""
if [ "$UNINSTALL" = 'y' ]; then
echo "---------- Pureftpd ----------"
if cat /proc/version | grep -Eqi '(redhat|centos)';then
chkconfig pureftpd off
elif cat /proc/version | grep -Eqi '(debian|ubuntu)';then
update-rc.d -f pureftpd remove
fi
rm -rf /usr/local/pureftpd
rm -rf /var/www/ftp
rm -rf /etc/init.d/pureftpd
echo "---------- MySQL ----------"
mysql -uroot -p$MYSQL_ROOT_PWD -e"drop database pureftpd;Drop USER pureftpd@localhost;"
clear
echo "==========================="
echo "Uninstall completed!"
echo "==========================="
fi