Skip to content

Commit

Permalink
feat(vm::systemd): enable add-cloudflare-dns.service
Browse files Browse the repository at this point in the history
  • Loading branch information
2moe committed Apr 4, 2024
1 parent a4009d1 commit 16ad93b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
8 changes: 7 additions & 1 deletion .github/workflows/vm-minimal.yml
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,8 @@ jobs:
sshd_cfg=ssh/vm.sshd.conf
sudo install -Dm600 $sshd_cfg rootfs/etc/ssh/sshd_config.d/vm.conf
unlink $sshd_cfg
sudo cp -v ${{env.DEV_DIR}}/systemd/* rootfs/etc/systemd/system/
sudo cp -a rootfs kernel_r
sudo systemd-nspawn -D kernel_r sh -c 'apt-install linux-image-cloud-amd64'
Expand Down Expand Up @@ -160,8 +162,12 @@ jobs:
install -m644 resolv.conf /etc/resolv.conf
# serial@ttyS0
cp /usr/lib/systemd/system/serial-getty@.service /etc/systemd/system/serial-getty@ttyS0.service
systemctl disable systemd-networkd-wait-online.service
sed '/ExecStart=/ s@- $TERM@--autologin root --local-line ttyS0 xterm@' -i /etc/systemd/system/serial-getty@ttyS0.service
systemctl disable systemd-networkd-wait-online.service
systemctl set-default multi-user.target
systemctl enable add-cloudflare-dns.service
apt-get autopurge -y
apt-get clean
ls -lh /var/cache/apt
Expand Down
10 changes: 10 additions & 0 deletions assets/vm-minimal/systemd/add-cloudflare-dns.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[Unit]
Description=Update resolv.conf with Cloudflare DNS
After=network.target

[Service]
Type=oneshot
ExecStart=/bin/sh -c 'printf "nameserver 1.1.1.1\nnameserver 1.0.0.1\n" >> /etc/resolv.conf'

[Install]
WantedBy=default.target

0 comments on commit 16ad93b

Please sign in to comment.