-
Notifications
You must be signed in to change notification settings - Fork 0
/
.uninstall.sh
85 lines (83 loc) · 2.49 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
#/bin/sh
##################################
# .uninstall.sh
#
# ABSTRACT: PlugMedia QPKG removal
#
# HISTORY:
# 2009/08/01 Written by Laurent (Ad'Novea)
# 2008/01/16 find_base fnt by AndyChuo (QNAP)
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
##################################
#
##################################
# UTILS
##################################
CMD_CUT="/bin/cut"
CMD_ECHO="/bin/echo"
CMD_GETCFG="/sbin/getcfg";
CMD_RM="/bin/rm"
CMD_SED="/bin/sed"
#
##################################
# SYSTEM
##################################
#
# QPKG management
QPKG_INSTALL_MSG=""
QPKG_BASE=""
QPKG_DIR=""
SYS_INIT_DIR="/etc/init.d"
SYS_rcS_DIR="/etc/rcS.d/"
SYS_rcK_DIR="/etc/rcK.d/"
QPKG_RC_NUM="101" #for rcS and rcK
QPKG_SERVICE_PROGRAM=""
#
##################################
# QPKG
##################################
QPKG_NAME="plugmedia"
#
##################################
# Determine BASE installation location
##################################
#
find_base() {
# Determine BASE installation location according to smb.conf
publicdir="`${CMD_GETCFG} Public path -f /etc/config/smb.conf`"
if [ ! -z $publicdir ] && [ -d $publicdir ];then
publicdirp1="`${CMD_ECHO} $publicdir | ${CMD_CUT} -d "/" -f 2`"
publicdirp2="`${CMD_ECHO} $publicdir | ${CMD_CUT} -d "/" -f 3`"
publicdirp3="`${CMD_ECHO} $publicdir | ${CMD_CUT} -d "/" -f 4`"
if [ ! -z $publicdirp1 ] && [ ! -z $publicdirp2 ] && [ ! -z $publicdirp3 ]; then
[ -d "/${publicdirp1}/${publicdirp2}/Public" ] && QPKG_BASE="/${publicdirp1}/${publicdirp2}"
fi
fi
# Determine BASE installation location by checking where the Public folder is.
if [ -z $QPKG_BASE ]; then
for datadirtest in /share/HDA_DATA /share/HDB_DATA /share/HDC_DATA /share/HDD_DATA /share/MD0_DATA /share/MD1_DATA; do
[ -d $datadirtest/Public ] && QPKG_BASE="/${publicdirp1}/${publicdirp2}"
done
fi
if [ -z $QPKG_BASE ] ; then
QPKG_INSTALL_MSG="The Public share not found."
$CMD_ECHO $QPKG_INSTALL_MSG; _exit 1;
fi
QPKG_INSTALL_PATH="${QPKG_BASE}/.qpkg"
QPKG_DIR="${QPKG_INSTALL_PATH}/${QPKG_NAME}"
}
#
##################################
# MAIN
##################################
#
find_base
# Remove symbolic link and CGI file
$CMD_RM -Rf /share/Qweb/$QPKG_NAME
$CMD_RM -Rf /home/httpd/cgi-bin/plugmedia
exit $RETVAL