blob: c89aae246bceca92cb2963af75f06e6434b3df74 (
plain)
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
|
#!/bin/sh
# Copyright 2022 Helmut Grohne <helmut@subdivi.de>
# SPDX-License-Identifier: MIT
#
# This is a mmdebstrap customize hook that enables and configures
# systemd-networkd on various Debian releases.
set -eu
TARGET=$1
SYSTEMD_VERSION=$(dpkg-query --root "$TARGET" -f '${Version}' -W systemd)
if test "${MMDEBSTRAP_MODE:-}" = chrootless; then
systemctl --root "$TARGET" enable systemd-networkd.service
else
chroot "$TARGET" systemctl enable systemd-networkd.service
fi
{
echo '[Match]'
echo 'Name=en*'
if dpkg --compare-versions "$SYSTEMD_VERSION" lt 220-7~; then
echo 'Name=eth*'
fi
echo '[Network]'
echo 'DHCP=yes'
if dpkg --compare-versions "$SYSTEMD_VERSION" lt 249; then
# This anchor is included by default since bullseye. Fails DNSSEC
# validation when missing.
echo 'DNSSECNegativeTrustAnchors=home.arpa'
fi
echo '[DHCP]'
echo 'UseDomains=yes'
} >"$TARGET/etc/systemd/network/20-wired.network"
|