aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2024-06-07 01:17:04 +0700
committerShulhan <ms@kilabit.info>2025-12-24 13:53:46 +0700
commit7c5aa938241175ba5cbc57468b6e4eeeb507df2a (patch)
treeca4b5d84f0ec187e0aa35ca35839118a33deae39
parentd768aa8ad922543302b5b6f6623fdbe4c2fd7271 (diff)
downloadcompute-archlinux-image-builder-7c5aa938241175ba5cbc57468b6e4eeeb507df2a.tar.xz
all: manage network with systemd-network
This remove dhclient and add polkit as dependencies for systemd-hostnamed.
-rw-r--r--README.md2
-rw-r--r--awwan.env2
-rwxr-xr-xbuild-arch-gce13
-rw-r--r--current-images.txt10
-rw-r--r--gcloud-image-test.aww5
-rw-r--r--sys/etc/systemd/network/10-eth0.network5
6 files changed, 26 insertions, 11 deletions
diff --git a/README.md b/README.md
index 7e670e2..631183d 100644
--- a/README.md
+++ b/README.md
@@ -10,6 +10,8 @@ installation, while still allowing it to be fully functional and optimized for
Compute Engine. Notable choices made and differences compared to a standard
Arch Linux installation are the following:
+- systemd-networkd is used to manage networks.
+- systemd-resolved is used to manage resolv.conf (DNS).
- systemd-boot is used with a UEFI-based boot and a GPT partition table.
- Serial console logging is enabled from kernel command line and journald is
configured to forward to it.
diff --git a/awwan.env b/awwan.env
index aa1c39b..a9326d1 100644
--- a/awwan.env
+++ b/awwan.env
@@ -5,5 +5,5 @@ region = asia-southeast1
zone = asia-southeast1-b
[host]
-image =arch-v20230912
+image = arch-v20240606
name = arch-test
diff --git a/build-arch-gce b/build-arch-gce
index ba500aa..eb9c751 100755
--- a/build-arch-gce
+++ b/build-arch-gce
@@ -71,7 +71,7 @@ rsync -r /var/lib/pacman/sync/ $mount_dir/var/lib/pacman/sync/
echo '- Installing Arch Linux.'
pacstrap -c -C "./sys/etc/pacman.conf" -- "$mount_dir" \
- base linux dosfstools e2fsprogs dhclient openssh sudo google-compute-engine \
+ base linux dosfstools e2fsprogs openssh polkit sudo google-compute-engine \
vim-minimal tmux mosh rsync unzip \
google-cloud-ops-agent-git google-compute-engine-oslogin
cp -f ./sys/etc/pacman.conf "$mount_dir/etc/pacman.conf"
@@ -133,6 +133,10 @@ echo '-- Configuring Google Cloud Ops Agent.'
mkdir -p $mount_dir/etc/google-cloud-ops-agent/
cp ./sys/etc/google-cloud-ops-agent/config.yaml $mount_dir/etc/google-cloud-ops-agent/
+echo '-- Configuring network.'
+mkdir -p $mount_dir/etc/systemd/network/
+cp ./sys/etc/systemd/network/10-eth0.network $mount_dir/etc/systemd/network/
+
arch-chroot -- "$mount_dir" /bin/bash -s <<-'EOS'
set -eEuo pipefail
trap 'echo "Error: \`$BASH_COMMAND\` exited with status $?"' ERR
@@ -144,6 +148,10 @@ arch-chroot -- "$mount_dir" /bin/bash -s <<-'EOS'
echo '-- Running locale-gen.'
locale-gen
+ echo '-- Enabling systemd-networkd.service.'
+ systemctl --quiet enable systemd-networkd.service
+ systemctl --quiet enable systemd-resolved.service
+
echo '-- Enabling sshd service.'
systemctl --quiet enable sshd.service
@@ -153,9 +161,6 @@ arch-chroot -- "$mount_dir" /bin/bash -s <<-'EOS'
echo '-- Enabling google-cloud-ops-agent.service'
systemctl --quiet enable google-cloud-ops-agent.service
- echo '-- Enabling other services.'
- systemctl --quiet enable dhclient@eth0.service
-
echo '-- Running mkinitcpio.'
mkinitcpio --nocolor --preset linux
diff --git a/current-images.txt b/current-images.txt
index f2ed289..5783ff3 100644
--- a/current-images.txt
+++ b/current-images.txt
@@ -1,6 +1,6 @@
NAME PROJECT FAMILY DEPRECATED STATUS
-arch-v20230812 arch-builder arch READY
-arch-v20230819 arch-builder arch READY
-arch-v20230902 arch-builder arch READY
-arch-v20230906 arch-builder arch READY
-arch-v20230912 arch-builder arch READY
+arch-v20240511 arch-builder arch READY
+arch-v20240518 arch-builder arch READY
+arch-v20240525 arch-builder arch READY
+arch-v20240601 arch-builder arch READY
+arch-v20240606 arch-builder arch READY
diff --git a/gcloud-image-test.aww b/gcloud-image-test.aww
index a52556e..6f8bf41 100644
--- a/gcloud-image-test.aww
+++ b/gcloud-image-test.aww
@@ -17,7 +17,10 @@ gcloud compute instances tail-serial-port-output {{.Val "host::name"}} \
gcloud compute ssh \
--zone={{.Val "gcloud::zone"}} \
- --command="lsblk -o NAME,UUID,MOUNTPOINTS; cat /etc/fstab; timedatectl show-timesync; localectl" \
+ --command="lsblk -o NAME,UUID,MOUNTPOINTS; cat /etc/fstab; \
+ cat /etc/resolv.conf; timedatectl show-timesync; localectl; \
+ sudo pacman -Sy" \
+ --quiet \
arch-test
gcloud compute ssh \
diff --git a/sys/etc/systemd/network/10-eth0.network b/sys/etc/systemd/network/10-eth0.network
new file mode 100644
index 0000000..e871c69
--- /dev/null
+++ b/sys/etc/systemd/network/10-eth0.network
@@ -0,0 +1,5 @@
+[Match]
+Name=eth0
+
+[Network]
+DHCP=yes