forked from song31/comix-server
-
Notifications
You must be signed in to change notification settings - Fork 0
/
uninstall.sh
executable file
·79 lines (63 loc) · 2.25 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
#!/bin/sh
######################################################################
WEB_DIR="/var/services/web/comix-server"
######################################################################
echo ":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::"
echo " 1. Detecting DSM Version"
echo ":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::"
DSM_VERSION=`grep majorversion /etc/VERSION |awk -F'=' '{print $2}' |awk -F'"' '{print $2}'`
if [ "$DSM_VERSION" == "4" ]
then
APACHE_CONF="/usr/syno/apache/conf/httpd.conf"
PHP_CONF="/usr/syno/etc/php/user-setting.ini"
APACHE_CMD="/usr/syno/apache/bin/httpd -DHAVE_PHP"
elif [ "$DSM_VERSION" == "5" ]
then
APACHE_CONF="/etc/httpd/conf/httpd.conf"
PHP_CONF="/etc/php/conf.d/user-settings.ini"
APACHE_CMD="/usr/bin/httpd -DHAVE_PHP"
else
echo "ERROR: Cannot detect DSM Version. Exiting..."
exit
fi
echo "Detected DSM version: $DSM_VERSION"
echo ":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::"
echo " 2. Removing comix-server"
echo ":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::"
if [ -e ${WEB_DIR} ]
then
rm -rf ${WEB_DIR}
fi
echo ":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::"
echo " 3. Restoring Apache HTTPD"
echo ":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::"
if [ -f ${APACHE_CONF}-comix ]
then
rm -f ${APACHE_CONF}-comix
fi
if [ -f ${APACHE_CONF}-user.org ]
then
mv -f ${APACHE_CONF}-user.org ${APACHE_CONF}-user
fi
if [ -f ${APACHE_CONF}.org ]
then
mv -f ${APACHE_CONF}.org ${APACHE_CONF}
fi
echo ":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::"
echo " 4. Restoring PHP"
echo ":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::"
if [ -f ${PHP_CONF}.org ]
then
mv -f ${PHP_CONF}.org ${PHP_CONF}
fi
echo ":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::"
echo " 5. Restarting Apache HTTPD"
echo ":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::"
kill `ps | grep HAVE_PHP | grep root | grep -v grep | awk '{print $1}'`
echo "Waiting for 5 seconds... "
sleep 5
if [ `ps | grep HAVE_PHP | grep root | grep -v grep | wc -l` -eq 0 ];
then
${APACHE_CMD}
fi
echo "Comix-server uninstalled."