Jacob Hrbek
1a85688c27
This is to provide a compatibility with nix such as GNU Guix to use the project painlessly without the need of deploying a sandboxed FHS environment. Signed-off-by: Jacob Hrbek <kreyren@rixotstudio.cz>
23 lines
500 B
Bash
23 lines
500 B
Bash
#!/usr/bin/env bash
|
|
|
|
set -e
|
|
|
|
# determine first ethernet device
|
|
eth="$(basename "$(find /sys/class/net/ -mindepth 1 -maxdepth 1 -iname 'e*' | head -n1)")"
|
|
[ -n "$eth" ] || eth="eth0"
|
|
|
|
# create a network configuration
|
|
cat > /etc/systemd/network/$eth.network << EOF
|
|
[Match]
|
|
Name=$eth
|
|
|
|
[Network]
|
|
DHCP=yes
|
|
EOF
|
|
|
|
# enable said network configuration
|
|
systemctl enable --now systemd-networkd.service
|
|
systemctl enable --now systemd-resolved.service
|
|
|
|
ln -sf /var/run/systemd/resolve/resolv.conf /etc/resolv.conf
|