-
Notifications
You must be signed in to change notification settings - Fork 0
/
install_ubuntu.sh
executable file
·63 lines (49 loc) · 1.44 KB
/
install_ubuntu.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
#!/bin/bash
set -e
DIR_PLUGINS_USED="/etc/munin/plugins"
olddir=$(pwd)
# prerequisites
apt-get -fym install html2text dialog git-core
# clone / pull gitrep
[ -d /var/git ] || mkdir -p /var/git
cd /var/git
if [ -d true-munin-plugins/.git ]; then
cd true-munin-plugins
git pull
else
git clone git://github.com/true/true-munin-plugins.git && cd true-munin-plugins
fi
# Index Dirs & prepare checklist
list=""
for dir in $(find -maxdepth 1 -type d |sed 's#\./##g' |egrep -v '(^_|^\.)' |sort); do
status="on"
if [ "${dir}" = "libvirt" ]; then
status="off"
fi
list="${list} ${dir} ${dir} ${status}"
done
# Show checklist and save wanted plugins
dialog --checklist "Which plugins do you want to install?" 20 40 10 ${list} 2> /tmp/answer$$
plugins=$(cat /tmp/answer$$)
mkdir -p ${DIR_PLUGINS_USED}
for plugin in ${plugins}; do
plugin=$(echo "${plugin}" |sed 's#"##g')
cd ${plugin}
echo "Installing Plugin: ${plugin}";
if [ -f "install.sh" ]; then
echo " Found ${plugin}/install.sh, executing.."
source install.sh
else
echo " There was no ${plugin}/install.sh, so just symlinking all files to ${DIR_PLUGINS_USED})"
for plugfile in $(find ./ -maxdepth 1 -type f |egrep -v '(^\./_|^\./\.)' |sed "s#^\./#$(pwd)/#g"); do
plugbase=$(basename "${plugfile}")
ln -nfs ${plugfile} ${DIR_PLUGINS_USED}/${plugbase}
done
fi
echo ""
cd - > /dev/null
done
echo "Restarting munin-node... "
restart munin-node
# return to working dir
cd ${olddir}