-
Notifications
You must be signed in to change notification settings - Fork 8
/
customize
executable file
·67 lines (53 loc) · 1.74 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
63
64
65
66
67
#!/usr/bin/bash
set -o errexit
PATH=/opt/local/gnu/bin:/opt/local/bin:/opt/local/sbin:/usr/bin:/usr/sbin
# Munin plugins
MUNIN_PLUGIN_VERSION='0.19'
MUNIN_PLUGINS="
cert_expire
cputime
df
load
uptime
users
proc_state
vfs_bytes
vfs_iops
vfs_latency
if_net0
pkg_audit
memory_cap
swap_cap
smf
tcp
udp
ip_version
nullmailer
"
echo "* Use the skylime pkgsrc mirror"
gsed -i 's:pkgsrc.smartos.org/packages:packages.pkgsrc.pub/smartos:g' /opt/local/etc/pkg_install.conf
gsed -i 's:pkgsrc.smartos.org/packages:packages.pkgsrc.pub/smartos:g' /opt/local/etc/pkgin/repositories.conf
gsed -i 's#\(^https://[a-z.]*\)/\([a-z]*\)/\(.*\)/All#\1/skylime-extra/\3\n\1/\2/\3/All#' \
/opt/local/etc/pkgin/repositories.conf
pkg_admin rebuild
pkgin -y up
## MUNIN
echo "* Create munin template file that will be used during mdata setup"
cp /opt/local/etc/munin/munin-node.conf /opt/local/etc/munin/munin-node.conf.tpl
echo "* Download and install community munin plugins (overwrite all other plugins)"
mkdir -p /opt/local/lib/munin/plugins/smartos
curl -L https://github.com/drscream/smartos-munin-plugins/archive/v${MUNIN_PLUGIN_VERSION}.tar.gz | gtar xz -C /opt/local/lib/munin/plugins/smartos --strip-components=1
echo "* Activate munin plugins"
/opt/core/bin/munin-node-plugins "${MUNIN_PLUGINS}"
echo "* Remove unused logfiles"
rm -f /var/log/courier.log
echo "* Cleanup home/admin because of delegate dataset usage"
rm -rf /home/admin/.[^.]*
echo "* Cleaning up."
rm -rf /root/*
# Provide workaround for /.zonecontrol/metadata.sock issue
# https://github.com/joyent/smtools/issues/3
gsed -i 's:^rm -f /.zonecontrol/metadata.sock$:rm -f /.zonecontrol/metadata.sock || true:g' \
/opt/local/bin/sm-prepare-image
echo "* Prepare image"
sm-prepare-image -y