Files
Coredesktop-Dev/vm/provision.sh
T
davidandClaude Opus 5.5 ff6b85b439 Leave a plain resolv.conf for NetworkManager in the base image
provision.sh deleted the cloud image's link to systemd-resolved's
resolv.conf, but systemd's tmpfiles put it back at the next boot. With
systemd-resolved off the link led nowhere, NetworkManager won't replace a
link it didn't make, and the VM had no DNS, so install.sh couldn't reach
archlinux.org. An empty file stops tmpfiles, and NetworkManager fills it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-05 07:36:59 -07:00

69 lines
2.6 KiB
Bash

#!/bin/bash
#
# Purpose : Turn Arch's cloud image into the machine CoreDesktop's README starts
# from: Arch with archinstall's desktop profile and GNOME. Run as root
# in the VM while building the smoketest's base image.
#
# Differences from a real archinstall machine, on purpose: the user (tester)
# logs in to GNOME automatically and has passwordless sudo, so the smoketest
# runs without anyone at the keyboard.
set -euo pipefail
USER_NAME=tester
echo "== Growing / to fill the disk"
btrfs filesystem resize max / || echo "Couldn't grow /; continuing."
df -h /
echo "== Sharing the host's package cache"
if ! grep -q '^pkgcache ' /etc/fstab; then
echo 'pkgcache /var/cache/pacman/pkg 9p trans=virtio,version=9p2000.L,msize=524288,nofail 0 0' >> /etc/fstab
fi
systemctl daemon-reload
mountpoint -q /var/cache/pacman/pkg || mount /var/cache/pacman/pkg \
|| echo "No shared package cache; packages download into the VM."
echo "== Installing GNOME"
pacman -Sy --needed --noconfirm archlinux-keyring
# archinstall's desktop profile with GNOME, NetworkManager and PipeWire
pacman -Su --needed --noconfirm \
gnome gnome-tweaks gdm \
networkmanager \
pipewire pipewire-alsa pipewire-pulse pipewire-jack wireplumber \
base-devel git sudo openssh nano vim htop wget smartmontools xdg-utils
echo "== Locale"
sed -i 's/^#en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen
locale-gen
echo LANG=en_US.UTF-8 > /etc/locale.conf
echo "== NetworkManager instead of systemd-networkd"
systemctl disable systemd-networkd.service systemd-networkd.socket systemd-resolved.service || true
# The cloud image's resolv.conf links to systemd-resolved's. NetworkManager
# only writes a plain file, and systemd's tmpfiles puts the link back at boot
# if the file is missing, so leave an empty one for NetworkManager to fill.
rm -f /etc/resolv.conf
touch /etc/resolv.conf
systemctl enable NetworkManager.service gdm.service sshd.service
# Arch's cloud image makes boot wait until the clock has synced, and sshd
# waits for that. Without systemd-networkd, systemd-timesyncd thinks it's
# offline and never syncs, so sshd would never start. archinstall doesn't
# turn this on, and QEMU sets the VM's clock from the host's.
systemctl disable systemd-time-wait-sync.service
echo "== Automatic login to GNOME as $USER_NAME"
cat > /etc/gdm/custom.conf << EOF
[daemon]
AutomaticLoginEnable=True
AutomaticLogin=$USER_NAME
EOF
echo "== Smoketest folder"
install -d -o "$USER_NAME" -g "$USER_NAME" /srv/smoketest
# cloud-init has done its job (the user, their SSH key and sudo rights)
touch /etc/cloud/cloud-init.disabled
echo "== Done"