forked from TritonDataCenter/void-lx-brand-image-builder
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.sh
90 lines (67 loc) · 2.1 KB
/
setup.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
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
#!/bin/bash
if [[ -v TRACE ]] && [[ -n $TRACE ]]; then
export PS4='[\D{%FT%TZ}] ${BASH_SOURCE}:${LINENO}: ${FUNCNAME[0]:+${FUNCNAME[0]}(): }'
set -o xtrace
fi
# See https://wiki.gentoo.org/wiki/Handbook:AMD64/Installation/Base
source /etc/profile
set -eu -o pipefail
echo '==> Using 8.8.8.8 as nameserver'
cat >/etc/resolv.conf <<EOL
nameserver 8.8.8.8
EOL
echo '==> Enabling gentoo porage repo'
mkdir --parents /etc/portage/repos.conf
cp -fv /usr/share/portage/config/repos.conf /etc/portage/repos.conf/gentoo.conf
echo '==> Downloading latest portage snapshot'
emerge-webrsync
eselect news read
echo '==> Setting timezone to UTC'
echo "UTC" > /etc/timezone
emerge --config sys-libs/timezone-data
echo '==> Generating locales'
cat >/etc/locale.gen <<EOL
en_US ISO-8859-1
en_US.UTF-8 UTF-8
C.UTF8 UTF-8
EOL
locale-gen
echo '==> Setting locale to en_US utf8'
eselect locale set en_US.utf8
# Use the updated environment
env-update
source /etc/profile
# Set random root pw
passwd -d root
echo '==> Updating system'
emerge -1vuUDj @world
emerge --depclean
echo '==> Installing default packages'
emerge -tjv \
app-editors/vim \
app-portage/gentoolkit \
dev-vcs/git \
app-shells/bash-completion \
sys-apps/sdc-vmtools
# We need to patch openrc to support container=zone
# https://github.com/OpenRC/openrc/pull/390
echo '==> Rebuilding OpenRC'
emerge -j sys-apps/openrc
rc-update add sdc-init boot
rc-update add sshd default
rc-update del kmod-static-nodes sysinit
rc-update del udev sysinit
rc-update del udev-trigger sysinit
echo '==> Disabling ttys'
sed -E -i \
-e 's/^(c[0-9])/#\1/' \
-e '/# TERMINALS/a # LX zones do not support ttys' \
/etc/inittab
echo '==> Disabling portage sandbox'
echo '# LX does not support the sandbox' >> /etc/portage/make.conf
echo 'FEATURES="-ipc-sandbox -pid-sandbox -network-sandbox"' >> /etc/portage/make.conf
echo '==> Setting FEATURES="nostrip"'
echo '# https://github.com/joyent/smartos-live/issues/967' >> /etc/portage/make.conf
echo 'FEATURES="${FEATURES} nostrip"' >> /etc/portage/make.conf
# Remove our temp version. It will be regenerated on 1st boot.
rm /etc/resolv.conf