-
Notifications
You must be signed in to change notification settings - Fork 73
/
.f12
executable file
·82 lines (71 loc) · 2.54 KB
/
.f12
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
#!/bin/bash
which sudo >/dev/null 2>&1 && SUDO=sudo || SUDO=
if [ $(uname) = Darwin ]; then
# Short snippet for installing NagVis on OSX into MacPorts path
# This is not meant for production use, just for development!
BASEDIR=/opt/local/nagvis
$SUDO rsync -av etc $BASEDIR/
$SUDO cp $BASEDIR/etc/apache2-nagvis.conf-sample $BASEDIR/etc/apache.conf
$SUDO gsed -i -e 's|@NAGVIS_WEB@|/nagvis|g' \
-e 's|@NAGVIS_PATH@|/opt/local/nagvis/share|g' $BASEDIR/etc/apache.conf
$SUDO apachectl restart
if [ ! -f $BASEDIR/etc/nagvis.ini.php ]; then
$SUDO cp $BASEDIR/etc/nagvis.ini.php{-sample,}
fi
$SUDO rsync -av share /opt/local/nagvis/
$SUDO rsync -av docs /opt/local/nagvis/share/
$SUDO mkdir -p $BASEDIR/var/tmpl/{cache,compile}
$SUDO mkdir -p $BASEDIR/etc/profiles
$SUDO chown -R _www:_www $BASEDIR/var $BASEDIR/etc $BASEDIR/share/userfiles/images/maps
$SUDO rm /opt/local/nagvis/var/* 2>/dev/null
$SUDO bash -c ". install_lib ; cmp_js $BASEDIR/share/frontend/nagvis-js/js"
$SUDO touch /opt/local/nagvis/share/index.php # trigger browser reload
if ps -x | grep [f]irefox >/dev/null 2>&1; then
osascript <<EOF
tell application "Firefox"
activate
end tell
EOF
else
osascript <<EOF
tell application "Safari"
activate
tell window 1
do JavaScript "window.location.reload(true)" in current tab
end tell
end tell
EOF
fi
exit 0
fi
SITE=${SITE:-$(cat .site 2>/dev/null || true)}
SITE=${SITE:-$(omd sites --bare | head -n 1)}
BASE=$(pwd)
sudo mkdir -p /usr/local/nagvis/share
sudo cp -r share/* /usr/local/nagvis/share/
sudo bash -c '. install_lib ; cmp_js /usr/local/nagvis/share/frontend/nagvis-js/js'
sudo rm -f /usr/local/nagvis/var/*cache*
# Old machanism. Slow, but using the default installer ways
##
## Install to /usr/local/nagvis
##
#$SUDO ./install.sh -a y -q -r -F -c y \
# -W /nagvis -n /usr/local/nagios \
# -i mklivestatus -p /usr/local/nagvis \
# -u www-data -g www-data \
# -w /etc/apache2/conf-available \
# -l unix:/omd/sites/muc/tmp/run/live
#$SUDO rm -f /etc/apache2/conf-available/nagvis.conf.*
#
##$SUDO rm -f /usr/local/nagvis/share/frontend/nagvis-js/js/NagVisCompressed.js
#
#
# Install to omd site local/
#
$SUDO rm -rf /omd/sites/$SITE/nvsrc
$SUDO rsync --filter='- .git' --filter='- .*.swp' -a $BASE/./ /omd/sites/$SITE/nvsrc/ ; \
$SUDO chown $SITE:$SITE /omd/sites/$SITE/nvsrc
$SUDO su - $SITE -c "
cd /omd/sites/$SITE/nvsrc/ ; \
yes y | ./omd_install.sh"
exit 0