-
Notifications
You must be signed in to change notification settings - Fork 3
/
UNINSTALL-FreeBSD.sh
executable file
·82 lines (65 loc) · 2.29 KB
/
UNINSTALL-FreeBSD.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
#! /bin/sh
#
# ipv6mon un-installation script for FreeBSD systems
#
# Copyright (C) 2011-2012 Fernando Gont
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# 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.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
###############################################################################
if ! uname -a | grep -e FreeBSD >/dev/null 2>&1; then
echo "This uninstaller script should be used only with FreeBSD systems"
exit 1
fi
if [ `id -u` -ne 0 ]; then
echo "Must have superuser privileges to uninstall ipv6mon" && exit 1
fi
echo "Uninstalling ipv6mon from the local system"
echo -n "Stoping ipv6mon..."
if /etc/rc.d/ipv6mon stop >/dev/null 2>&1; then
echo "succeeded."
else
echo "not running."
fi
echo -n "Removing ipv6mon from /etc/rc.d..."
if rm /etc/rc.d/ipv6mon >/dev/null 2>&1; then
echo "succeeded."
else
echo "failed." && exit 1
fi
echo -n "Removing ipv6mon from /usr/sbin/..."
if rm /usr/sbin/ipv6mon >/dev/null 2>&1; then
echo "succeeded."
else
echo "failed." && exit 1
fi
echo -n "Removing user:group ipv6mon:ipv6mon from the system..."
if rmuser -y ipv6mon >/dev/null 2>&1; then
echo "succeeded."
else
echo "failed."
fi
echo -n "Removing manual pages from the local system..."
if test -d "/usr/share/man/man8" && test -d "/usr/share/man/man5" >/dev/null 2>&1; then
rm "/usr/share/man/man8/ipv6mon.8.gz" 2>&1
rm "/usr/share/man/man5/ipv6mon.conf.5.gz" 2>&1
echo "succeeded."
else
echo "failed."
echo "You must manually remove the manual pages from your system!"
fi
echo "ipv6mon has been successfully uninstalled from the system!\n"
echo "Note: The ipv6mon configuration file /etc/ipv6mon.conf has NOT been removed."
echo "You should now delete the following line from /etc/rc.conf:"
echo "ipv6mon_enable=\"YES\""
exit 0