blob: 6fd0093c891b1a8c7eb12e80e5ac2ad4a715f758 (
plain)
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
|
pre_install() {
if [ "$1" = "upgrade" ] ; then
if [ -f /usr/rmmagent/hacker_patterns ] ; then
mv /usr/rmmagent/hacker_patterns /usr/rmmagent/hacker_patterns.old || echo "Tried to preserve hacker_patterns"
fi
fi
}
post_install() {
if [ "$1" = "configure" ] ; then
ldconfig
if [ ! -f /usr/bin/service -a ! -f /usr/bin/service -a ! -f /usr/bin/service -a ! -f /usr/bin/service ]
then
cp /usr/rmmagent/service /usr/sbin || echo "Tried to copy service to /usr/sbin"
chmod 755 /usr/bin/service || echo "Tried to change rights for /usr/bin/service"
fi
rm -f /usr/rmmagent/service || echo "Tried to remove service script"
if ! [ -f /usr/rmmagent/hacker_patterns_custom ] ; then
touch /usr/rmmagent/hacker_patterns_custom || echo "Tried to create hacker_patterns_custom"
fi
fi
echo "To register this server in the dashboard please run '# /usr/rmmagent/rmmagentd -i'"
echo ""
echo "When asked if you want to start the agent during setup, choose 'No' then"
echo "enable and start the rmmagentd service to begin monitoring and data submission."
}
pre_upgrade() {
pre_install
}
post_upgrade() {
post_install
}
pre_remove() {
if [ "$1" = "remove" ] ; then
/usr/rmmagent/rmmagentd -u || echo "not installed"
fi
systemctl disable rmmagentd
systemctl stop rmmagentd
}
post_remove() {
if [ "$1" = "remove" ] ; then
rm -rf /usr/rmmagent || echo "removed."
fi
if [ "$1" = "upgrade" ] ; then
if pgrep rmmagentd > /dev/null
then
/usr/rmmagent/rmmagentd -r || echo "Tried to restart agent daemon"
fi
fi
rm -f /etc/systemd/system/rmmagentd.service
rm -rf /usr/rmmagent
}
|