-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbuild-image
More file actions
executable file
·46 lines (35 loc) · 1.1 KB
/
Copy pathbuild-image
File metadata and controls
executable file
·46 lines (35 loc) · 1.1 KB
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
#!/bin/sh
# Exit on failure
set -e
# Exit on unassigned variable use
set -u
# Switch working directory
cd $(dirname $0)
# Avoid locale issues
export LC_ALL=C
# dpkg shouldn't ask questions
export DEBIAN_FRONTEND=noninteractive
# Configure main repository
cat >/etc/apt/sources.list <<EOF
deb http://archive.ubuntu.com/ubuntu/ xenial main restricted universe multiverse
deb http://security.ubuntu.com/ubuntu xenial-security main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ xenial-updates main restricted universe multiverse
EOF
# Update packages list
apt-get update
# Install SSH server
apt-get install -y --no-install-recommends \
openssh-server
# just for cosmetics, fix "not-found" entries while using "systemctl --all"
for MATCH in \
auditd.service \
; do
grep -rn --binary-files=without-match ${MATCH} /lib/systemd/ | cut -d: -f1 | xargs sed -ri 's/(.*=.*)'${MATCH}'(.*)/\1\2/'
done
# Install cloud-init systemd service
cp -vf cloud-init /usr/sbin/
cp -vf cloud-init.service /lib/systemd/system/
systemctl enable cloud-init.service
# Clean rootfs
cd /
rm -rf /tmp/* /var/tmp/*