-
Notifications
You must be signed in to change notification settings - Fork 37
Expand file tree
/
Copy patharch.setup
More file actions
executable file
·197 lines (167 loc) · 4.8 KB
/
arch.setup
File metadata and controls
executable file
·197 lines (167 loc) · 4.8 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
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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
#!/bin/bash
set -ex
IMAGE="$1"
# avoid failures when running image builds in a non-English locale (ssh transfers the host environment)
unset LANGUAGE
unset LANG
export LC_ALL=C
# binutils for strip (required for fetching sources in devtools)
COCKPIT_DEPS="\
binutils \
edk2-ovmf \
json-glib \
krb5 \
cpio \
cdrtools \
docbook-xsl \
dmidecode \
openssh \
networkmanager \
pcp \
xmlto \
packagekit \
libvirt \
libvirt-python \
libvirt-dbus \
libblockdev-mdraid \
libpwquality \
tracer \
tuned \
virt-install \
udisks2 \
udisks2-btrfs \
udisks2-lvm2 \
devtools \
"
TEST_PACKAGES="\
clevis \
criu \
gdb \
fakeroot \
strace \
ltrace \
lvm2 \
cryptsetup \
dhclient \
dnsmasq \
iptables-nft \
socat \
sudo \
vim \
firewalld \
openssh \
podman \
qemu \
qemu-tools \
qemu-audio-spice \
qemu-ui-spice-app \
qemu-hw-usb-host \
qemu-hw-usb-redirect \
qemu-block-curl \
valkey \
openbsd-netcat \
nfs-utils \
sssd \
swtpm \
tang \
tpm2-tools \
jq \
ntfs-3g \
wireguard-tools \
xfsprogs \
"
# HACK: libosinfo requires gsettings-desktop-schemas but does not depend on it.
# https://gitlab.archlinux.org/archlinux/packaging/packages/libosinfo/-/issues/1
TEST_PACKAGES="$TEST_PACKAGES gsettings-desktop-schemas"
# iptables-nft (which provides ebtables) is required for libvirt NAT networking
# but provides iptables and therefore conflicts. First remove it before installing iptables-nft.
pacman -Rdd --noconfirm iptables
# Ignore a linux kernel update as it removes kernel modules which are required
# for starting firewalld and podman, as last step the kernel is upgraded.
pacman -Syu --noconfirm --asexplicit $COCKPIT_DEPS $TEST_PACKAGES cockpit --ignore linux
echo "127.0.1.1 $(hostname)" >> /etc/hosts
systemctl enable --now firewalld
# Use networkd for eth0
cat > /etc/systemd/network/20-wired.network << EOL
[Match]
Name=eth0
[Network]
DHCP=yes
EOL
# Enable networkmanager as no services are started by default
systemctl enable NetworkManager
# Don't let NetworkManager manage eth0 (networkd does), and don't autoconnect to eth1
cat > /etc/NetworkManager/conf.d/noauto.conf <<EOL
[main]
no-auto-default=*
[keyfile]
unmanaged-devices=interface-name:eth0
EOL
# Disable PerSourcePenalties, they interfere with the rapid failed
# logins performed by some tests.
echo "PerSourcePenalties no" >/etc/ssh/sshd_config.d/99-no-penalties.conf
# Disable mDNS for systemd-resolved, mDNS always times out in our testing setup which makes
# multi machine tests time out as the resolved timeout is ~ 7 seconds.
mkdir -p /etc/systemd/resolved.conf.d
printf '[Resolve]\nMulticastDNS=false' > /etc/systemd/resolved.conf.d/disable-mdns.conf
# Enable serial console, for debugging networking problems
sed -i '/GRUB_CMDLINE_LINUX=/ s/"$/ console=ttyS0,115200"/' /etc/default/grub
grub-mkconfig -o /boot/grub/grub.cfg
# Setup sudoers for admin user
echo "%wheel ALL=(ALL) ALL" > /etc/sudoers.d/90-cockpit-wheel
useradd -c Builder builder
echo "builder ALL = NOPASSWD: /usr/sbin/makechrootpkg, /usr/sbin/mkarchroot, /usr/bin/*-x86_64-build" > /etc/sudoers.d/90-archbuild
BUILD_DEPS="\
asciidoctor \
base-devel \
cockpit \
git \
glib-networking \
glib2-devel \
gobject-introspection \
gtk-doc \
intltool \
json-glib \
krb5 \
libvirt-dbus \
networkmanager \
npm \
pcp \
xmlto \
python-installer \
python-pip \
python-wheel \
python-build \
podman \
systemd \
"
# Create build chroot for cockpit projects for offline builds, the base chroot
# is created in /var/lib/archbuild/cockpit
mkdir -p /var/lib/archbuild/cockpit
mkarchroot -C /etc/pacman.conf -M /etc/makepkg.conf -c /var/cache/pacman/pkg/ /var/lib/archbuild/cockpit/root ${BUILD_DEPS}
# Setup rootless podman
touch /etc/subuid /etc/subgid
usermod --add-subuids 100000-165535 --add-subgids 100000-165535 admin
# Setup some test registries, as none are specified by default.
echo 'unqualified-search-registries = ["docker.io", "quay.io"]' > /etc/containers/registries.conf
podman system migrate
# Generate C.UTF-8 locale
echo 'C.UTF-8 UTF-8' >> /etc/locale.gen
locale-gen
# Update the kernel as last step.
pacman -Syu --noconfirm
# Reduce image size, remove cloud-init
pacman -R --noconfirm --recursive --cascade cloud-init
# Reduce image size, remove devtools VCS support for non-git sources
pacman -R --noconfirm --nodeps --nodeps mercurial breezy subversion
# Causes some sort of race condition in waiting on NTP to be synced
# https://github.com/cockpit-project/bots/issues/3901#issuecomment-1260579703
systemctl disable systemd-time-wait-sync.service
# https://gitlab.archlinux.org/archlinux/packaging/packages/openssh/-/issues/16
# https://github.com/openssh/openssh-portable/pull/388
# https://github.com/openssh/openssh-portable/pull/593
echo 100::55:4e4b:4e4f:574e UNKNOWN | tee -a /etc/hosts
# Reduce image size, clear package cache (/var/cache/pacman/pkg)
rm -f /var/cache/pacman/pkg/*
/var/lib/testvm/podman-images.setup
/var/lib/testvm/zero-disk.setup