forked from rchovan/npreal2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mxuninst
executable file
·100 lines (78 loc) · 3.34 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
85
86
87
88
89
90
91
92
93
94
95
96
97
################################################################################
# define value and default value setting
################################################################################
NPPath="/usr/lib/npreal2"
driverPath="/usr/lib/npreal2/driver"
OS="linux"
########################################################################
# 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
initproc=`ps --no-headers -o comm 1`
if [ $initproc = "init" ]
then
grep -v npreal2 /etc/rc.d/rc.local > /usr/lib/npreal2/tmp/nprtmp_rclocal2 2>&1
cp -f /usr/lib/npreal2/tmp/nprtmp_rclocal2 /etc/rc.d/rc.local > /dev/null 2>&1
rm -f /usr/lib/npreal2/tmp/nprtmp_rclocal2 > /dev/null 2>&1
grep -v 'npreal2d' /etc/rc.d/rc.local > /usr/lib/npreal2/tmp/nprtmp_rclocal3
cp -f /usr/lib/npreal2/tmp/nprtmp_rclocal3 /etc/rc.d/rc.local > /dev/null 2>&1
rm -f /usr/lib/npreal2/tmp/nprtmp_rclocal3 > /dev/null 2>&1
chmod 755 /etc/rc.d/rc.local > /dev/null 2>&1
chkconfig --del /etc/init.d/npreals > /dev/null 2>&1
elif [ $initproc = "systemd" ]
then
systemctl disable npreal2.service > /dev/null 2>&1
rm -f /usr/lib/npreal2/driver/load_npreal2.sh > /dev/null 2>&1
rm -f /etc/systemd/system/npreal2.service > /dev/null 2>&1
fi
elif [ "$OS" = "debian" ]
then
grep -v npreal2 /etc/init.d/npreals > /usr/lib/npreal2/tmp/nprtmp_rclocal2 2>&1
cp -f /usr/lib/npreal2/tmp/nprtmp_rclocal2 /etc/init.d/npreals > /dev/null 2>&1
rm -f /usr/lib/npreal2/tmp/nprtmp_rclocal2 > /dev/null 2>&1
grep -v 'npreal2d' /etc/init.d/npreals > /usr/lib/npreal2/tmp/nprtmp_rclocal3
cp -f /usr/lib/npreal2/tmp/nprtmp_rclocal3 /etc/init.d/npreals > /dev/null 2>&1
rm -f /usr/lib/npreal2/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 > /usr/lib/npreal2/tmp/nprtmp_rclocal2 2>&1
cp -f /usr/lib/npreal2/tmp/nprtmp_rclocal2 /etc/rc.d/boot.local > /dev/null 2>&1
rm -f /usr/lib/npreal2/tmp/nprtmp_rclocal2 > /dev/null 2>&1
grep -v 'npreal2d' /etc/rc.d/boot.local > /usr/lib/npreal2/tmp/nprtmp_rclocal3
cp -f /usr/lib/npreal2/tmp/nprtmp_rclocal3 /etc/rc.d/boot.local > /dev/null 2>&1
rm -f /usr/lib/npreal2/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/tmp/* > /dev/null 2>&1
rm -f $NPPath/* > /dev/null 2>&1
rm -r -f $driverPath > /dev/null 2>&1
rm -r -f $NPPath/tmp > /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 ''