-
Notifications
You must be signed in to change notification settings - Fork 2
/
mxuninst
87 lines (66 loc) · 2.56 KB
/
mxuninst
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
################################################################################
# define value and default value setting
################################################################################
NPPath="/usr/lib/npreal2"
driverPath="/usr/lib/npreal2/driver"
OS=""
########################################################################
# Main procedures
# To read the shell program input argument and process it.
########################################################################
echo 'Driver Removal ... '
if [ -f /etc/redhat-release ]
then
OS="linux"
elif [ -f /etc/SuSE-release ]
then
OS="SuSE"
elif [ -f /etc/debian_version ]
then
OS="debian"
fi
# stop the daemon & kill the process
ps -ef | grep npreal2 |
awk '$0 !~ /grep/ {system("kill -15 "$2)}'
ps -ef | grep npreal2 |
awk '$0 !~ /grep/ {system("kill -9 "$2)}'
if [ "$OS" = "linux" ]
then
grep -v npreal2 /etc/rc.d/rc.local > /tmp/nprtmp_rclocal2 2>&1
cp -f /tmp/nprtmp_rclocal2 /etc/rc.d/rc.local > /dev/null 2>&1
rm -f /tmp/nprtmp_rclocal2 > /dev/null 2>&1
grep -v 'npreal2d' /etc/rc.d/rc.local > /tmp/nprtmp_rclocal3
cp -f /tmp/nprtmp_rclocal3 /etc/rc.d/rc.local > /dev/null 2>&1
rm -f /tmp/nprtmp_rclocal3 > /dev/null 2>&1
chmod 755 /etc/rc.d/rc.local > /dev/null 2>&1
elif [ "$OS" = "debian" ]
then
grep -v npreal2 /etc/init.d/npreals > /tmp/nprtmp_rclocal2 2>&1
cp -f /tmp/nprtmp_rclocal2 /etc/init.d/npreals > /dev/null 2>&1
rm -f /tmp/nprtmp_rclocal2 > /dev/null 2>&1
grep -v 'npreal2d' /etc/init.d/npreals > /tmp/nprtmp_rclocal3
cp -f /tmp/nprtmp_rclocal3 /etc/init.d/npreals > /dev/null 2>&1
rm -f /tmp/nprtmp_rclocal3 > /dev/null 2>&1
chmod 755 /etc/init.d/npreals > /dev/null 2>&1
update-rc.d npreals defaults 90
elif [ "$OS" = "SuSE" ]
then
grep -v npreal2 /etc/rc.d/boot.local > /tmp/nprtmp_rclocal2 2>&1
cp -f /tmp/nprtmp_rclocal2 /etc/rc.d/boot.local > /dev/null 2>&1
rm -f /tmp/nprtmp_rclocal2 > /dev/null 2>&1
grep -v 'npreal2d' /etc/rc.d/boot.local > /tmp/nprtmp_rclocal3
cp -f /tmp/nprtmp_rclocal3 /etc/rc.d/boot.local > /dev/null 2>&1
rm -f /tmp/nprtmp_rclocal3 > /dev/null 2>&1
chmod 755 /etc/rc.d/boot.local
fi
rm -f $driverPath/* > /dev/null 2>&1
rm -f $NPPath/* > /dev/null 2>&1
rm -r -f $driverPath > /dev/null 2>&1
rm -r -f $NPPath > /dev/null 2>&1
rm -f /lib/modules/`uname -r`/kernel/drivers/char/npreal2.o
rm -f /lib/modules/`uname -r`/misc/npreal2.o
rm -f /lib/modules/`uname -r`/kernel/drivers/char/npreal2.ko
rm -f /lib/modules/`uname -r`/misc/npreal2.ko
rmmod npreal2
echo 'Complete'
echo ''