-
Notifications
You must be signed in to change notification settings - Fork 0
/
customize
executable file
·43 lines (34 loc) · 1.32 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
#!/usr/bin/bash
PATH=/opt/local/gnu/bin:/opt/local/bin:/opt/local/sbin:/usr/bin:/usr/sbin
# Exit if any command fails
set -o errexit
PLATFORM_VERSION="20220127T011500Z"
PREVIOUS_VERSION="20211118T011125Z"
echo "* Setup tftp server"
mkdir -p /tftpboot
svcadm enable inetd
svccfg import /opt/local/lib/svc/manifest/tftp-udp6.xml
svcadm enable tftp/udp6
svcadm restart tftp/udp6
echo "* Setup ipxe"
curl -q https://download.qutic.com/src/ipxe/undionly.kpxe > /tftpboot/undionly.kpxe
echo "* Setup load latest smartos platform image"
/opt/local/bin/load_platform_release "${PLATFORM_VERSION}"
/opt/local/bin/load_platform_release "${PREVIOUS_VERSION}"
sed -i \
-e "s|set smartos-build 20201007T223416Z|set smartos-build ${PLATFORM_VERSION}|" \
-e "s|set smartos-build2 20201007T223416Z|set smartos-build2 ${PREVIOUS_VERSION}|" \
/var/www/default/ipxe/bootstrap.ipxe
echo "* Allow apache vhosts"
sed -i \
-e "s|#LoadModule vhost_alias_module lib/httpd/mod_vhost_alias.so|LoadModule vhost_alias_module lib/httpd/mod_vhost_alias.so|" \
-e "s|#Include etc/httpd/httpd-vhosts.conf|Include etc/httpd/httpd-vhosts.conf|" \
/opt/local/etc/httpd/httpd.conf
svcadm enable apache
svcadm restart apache
# Clean up
echo "* Cleaning up."
rm /root/customize
rm -rf /var/zoneinit/tmp
# Prepare image for provisioning
sm-prepare-image -y