This repository has been archived by the owner on Jul 29, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcustomize
executable file
·62 lines (45 loc) · 2.02 KB
/
customize
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
#!/usr/bin/bash
#
# Put customizations to your image in this file.
MUNSTRAP_VERSION=0.2
MUNIN_MASTER_ADMIN_VERSION=0.7
# Custom versions and variables
PATH=/opt/local/gnu/bin:/opt/local/bin:/opt/local/sbin:/usr/bin:/usr/sbin
# Exit if any commands fail
set -o errexit
MUNIN_PLUGINS="
nginx
"
echo "* Activate munin plugins"
/opt/qutic/bin/munin-node-plugins ${MUNIN_PLUGINS}
# Configuring image specific packages
echo "* Configuring image specific packages.";
echo "* Use default python 3.6"
pkg_alternatives manual python36
echo "* Cleanup /var/munin in order to set the dataset mountpoint (must be empty)"
rm -r /var/munin/*
echo "* Download and extract munstrap to /opt/local/etc/munin/munstrap"
(mkdir -p /opt/local/etc/munin/munstrap)
curl -L "https://github.com/drscream/munstrap/archive/v${MUNSTRAP_VERSION}.tar.gz" | gtar xz -C /opt/local/etc/munin/munstrap --strip-components=1
# fix privacy leakage
# sed -i -e 's#code.jquery.com/jquery-1.10.2.min.js#cdn.radiantmagic.com/libs/jquery/1.10.2/min.js#g' /opt/local/etc/munin/munstrap/templates/partial/head.tmpl
echo "* Rename original template and create symlinks to activate munstrap"
(cd /opt/local/etc/munin; mv static static-orig; mv templates templates-orig; ln -s munstrap/static static; ln -s munstrap/templates templates)
echo "* Download and extract munin_master_admin to /opt/munin_master_admin"
(mkdir -p /opt/munin_master_admin)
curl -L "https://github.com/drscream/munin_master_admin/archive/v${MUNIN_MASTER_ADMIN_VERSION}.tar.gz" | gtar xz -C /opt/munin_master_admin --strip-components=1
chown -R www:www /opt/munin_master_admin
echo "* Install required python packages"
pip3.6 install -r /opt/munin_master_admin/req.txt
echo "* Create nginx ssl folder"
mkdir -p /opt/local/etc/nginx/ssl
touch /opt/local/etc/nginx/.htpasswd
ln -nfs /opt/local/www/munin/data/ /var/www
echo "* Cleanup home/admin because of delegate dataset usage"
rm -rf /home/admin/.[^.]*
# Clean up
echo "* Cleaning up."
rm -rf /root/customize
history -c
# Prepare image for provisioning
sm-prepare-image -y