forked from skylime/mi-core-base
-
Notifications
You must be signed in to change notification settings - Fork 1
/
customize
executable file
·125 lines (101 loc) · 3.34 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
#!/usr/bin/bash
set -o errexit
PATH=/opt/local/gnu/bin:/opt/local/bin:/opt/local/sbin:/usr/bin:/usr/sbin
echo "* Use the qutic pkgsrc mirror"
sed -i \
-e 's|https://pkgsrc.smartos.org|https://pkgsrc.qutic.com|g' \
/opt/local/etc/pkgin/repositories.conf
sed -i \
-e 's|https://pkgsrc.smartos.org|https://pkgsrc.qutic.com|g' \
/opt/local/etc/pkg_install.conf
# import key
# rm /opt/local/etc/gnupg/pkgsrc.gpg || true
# mkdir -p /opt/local/etc/gnupg || true
# curl -s https://download.qutic.com/extras/pkgsrc-trunk.gpg > /opt/local/etc/gnupg/pkgsrc.gpg
# get latest updates
pkg_add -U pkg_install pkgin
pkg_admin rebuild || true
pkgin -y upgrade || true
# we may wanna use hexdump :)
ln -nfs /usr/bin/xxd /opt/local/bin/hexdump
# create additional zabbix-folders
# mkdir /nonexistent
mkdir -p /opt/local/etc/zabbix_agentd.conf.d
mkdir -p /var/log/zabbix
chown zabbix:zabbix /var/log/zabbix
mkdir -p /nonexistent
# link pkgin log into place
ln -nfs /var/db/pkgin/pkg_install-err.log /var/log/pkg_install-err_log || true
mkdir -p /root/.gnupg
chmod 0700 /root/.gnupg
echo "keyserver pgp.mit.edu" > /root/.gnupg/gpg.conf
chmod 0600 /root/.gnupg/gpg.conf
echo "* Cleanup home/admin because of delegate dataset usage"
rm -rf /home/admin/.[^.]*
# bash extensions
cat >> /etc/skel/.bashrc << EOF
PS1='\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\W\[\033[00m\]\$ '
alias la="ls -al"
alias t="cd /var/log/ && tail -n 50 -f "
alias msg="/usr/bin/tail -n 50 -f /var/adm/messages"
alias nano="/usr/bin/vim"
vw() {
/usr/bin/vim $(/usr/bin/which $1)
}
LANG=en_US.UTF-8
LANGUAGE=en_US.UTF-8
LC_MONETARY=de_DE.UTF-8
LC_TIME=de_DE.UTF-8
LC_CTYPE=de_DE.UTF-8
LC_NUMERIC=de_DE.UTF-8
LC_MESSAGES=C
EDITOR=/usr/bin/vim
HISTSIZE=2000
HISTFILESIZE=25000
HISTTIMEFORMAT="[%d.%m.%Y %T] "
EOF
echo "* Create missing log-files"
touch /var/log/mail.log
touch /var/log/ipf.log
touch /var/log/auth.log
rm /var/log/authlog
rm /var/log/maillog
chmod 0640 /var/log/auth.log
chmod 0640 /var/log/ipf.log
gsed -i \
-e 's:authlog:auth.log:' \
-e 's:maillog:mail.log:' \
/etc/logadm.conf
# echo "* Enable ipfilter"
# svcadm enable svc:/network/ipfilter:default
echo "* link nullmailer log"
mkdir -p /var/log/nullmailer
ln -nfs /var/svc/log/pkgsrc-nullmailer:default.log /var/log/nullmailer/mail.log
echo "* link zoneinit log"
ln -nfs /var/svc/log/system-zoneinit:default.log /var/log/system_zoneinit_log
echo "* load startup.xml"
/usr/sbin/svccfg import /svc/manifest/site/startup.xml
svcadm enable svc:/site/startup:default
echo "* fix df command in sm-summary"
# https://github.com/joyent/smtools/pull/5
sed -i \
-e "s|df -B1 /tmp|df -k /tmp|" \
-e "s|/1024/1024|/1024|" \
/opt/local/bin/sm-summary
echo "* pkgsrc mnx migration"
curl -s https://download.qutic.com/src/pkgsrc/8254B861.asc | gpg --import --no-default-keyring --keyring /opt/local/etc/gnupg/pkgsrc.gpg
pkg_add -U pkg_install pkgin libarchive
pkgin clean
echo "* Cleaning up."
cp /etc/skel/.bashrc /root/.bashrc
chmod 0640 /root/.bashrc
rm /root/customize
rm /opt/local/bin/sm-install-drupal || true
rm /opt/local/bin/sm-install-wordpress || true
# 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
history -c
echo "* Prepare image"
sm-prepare-image -y