From 256c7475b00f6ae214e1db9f4893cce4315dc9fc Mon Sep 17 00:00:00 2001 From: lub Date: Sat, 21 Dec 2019 18:13:37 +0100 Subject: [PATCH] add networking config --- hardware/ovh_rise-1/network.sh | 16 ++++++++++++++++ post-debootstrap-installer.sh | 18 ++++++++++++++++-- 2 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 hardware/ovh_rise-1/network.sh diff --git a/hardware/ovh_rise-1/network.sh b/hardware/ovh_rise-1/network.sh new file mode 100644 index 0000000..bb78674 --- /dev/null +++ b/hardware/ovh_rise-1/network.sh @@ -0,0 +1,16 @@ +#!/bin/bash -e + +address=$(ip addr show dev eth0 scope global | grep -F 'inet ' | perl -pe 's#.*inet (.*?) .*#$1#') +gateway=$(echo "$address" | perl -pe 's#\d*/24$/#254#') + +# $interface differs from the live system because of different naming schemes +# see https://wiki.debian.org/NetworkInterfaceNames for more details +interface='eno1' + + +echo "[Match] +Name=$interface + +[Network] +Address=$address +Gateway=$gateway" > "/etc/systemd/network/${interface}.network" \ No newline at end of file diff --git a/post-debootstrap-installer.sh b/post-debootstrap-installer.sh index 970f164..d24501f 100755 --- a/post-debootstrap-installer.sh +++ b/post-debootstrap-installer.sh @@ -44,9 +44,18 @@ esp_uuid=$(blkid --output value "/hardware-setup/hardware/${1}/esp" | head -n1) sed -i "s/%esp_uuid%/${esp_uuid}/" /etc/fstab -### Docker +### networking -apt-get -y install docker-ce +# generate configs for systemd-networkd.service +# this is template specific +"/hardware-setup/hardware/${1}/network.sh" + +# systemd-networkd.service is disabled by default +systemctl enable systemd-networkd.service + +# set DNS +echo 'nameserver 1.1.1.1 +nameserver 8.8.8.8' > /etc/resolv.conf ### users @@ -67,6 +76,11 @@ for key in /hardware-setup/authorized_keys/*; do done +### Docker + +apt-get -y install docker-ce + + ### administration tools apt-get -y install \