From 4aa8ac6985680eb12ba5c82422ecc50e2bb55447 Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Sat, 12 Mar 2016 16:07:25 +0100 Subject: spliting more files, fix-uboot, fix-fbturbo, fix-locale --- bootstrap.d/20-networking.sh | 43 +++++++++++++++++-------------------------- 1 file changed, 17 insertions(+), 26 deletions(-) (limited to 'bootstrap.d/20-networking.sh') diff --git a/bootstrap.d/20-networking.sh b/bootstrap.d/20-networking.sh index 4df6793..051c172 100644 --- a/bootstrap.d/20-networking.sh +++ b/bootstrap.d/20-networking.sh @@ -1,24 +1,25 @@ # -# Setup networking +# Setup Networking # +# Load utility functions . ./functions.sh # Set up IPv4 hosts -echo ${HOSTNAME} >$R/etc/hostname -cat <$R/etc/hosts -127.0.0.1 localhost -127.0.1.1 ${HOSTNAME} -EOM +install_readonly files/network/hostname $R/etc/hostname +sed -i -e "s/^rpi2-jessie/${HOSTNAME}/" $R/etc/hostname + +install_readonly files/network/hosts $R/etc/hosts +sed -i -e "s/rpi2-jessie/${HOSTNAME}/" $R/etc/hosts if [ "$NET_ADDRESS" != "" ] ; then -NET_IP=$(echo ${NET_ADDRESS} | cut -f 1 -d'/') -sed -i "s/^127.0.1.1/${NET_IP}/" $R/etc/hosts + NET_IP=$(echo ${NET_ADDRESS} | cut -f 1 -d'/') + sed -i "s/^127.0.1.1/${NET_IP}/" $R/etc/hosts fi # Set up IPv6 hosts if [ "$ENABLE_IPV6" = true ] ; then -cat <>$R/etc/hosts + cat <>$R/etc/hosts ::1 localhost ip6-localhost ip6-loopback ff02::1 ip6-allnodes @@ -27,28 +28,18 @@ EOM fi # Place hint about network configuration -cat <$R/etc/network/interfaces -# Debian switched to systemd-networkd configuration files. -# please configure your networks in '/etc/systemd/network/' -source /etc/interfaces.d/*.conf -EOM +install_readonly files/network/interfaces $R/etc/network/interfaces if [ "$ENABLE_DHCP" = true ] ; then # Enable systemd-networkd DHCP configuration for interface eth0 -cat <$R/etc/systemd/network/eth.network -[Match] -Name=eth0 - -[Network] -DHCP=yes -EOM +install_readonly files/network/eth.network $R/etc/systemd/network/eth.network # Set DHCP configuration to IPv4 only -if [ "$ENABLE_IPV6" = false ] ; then - sed -i "s/^DHCP=yes/DHCP=v4/" $R/etc/systemd/network/eth.network -fi + if [ "$ENABLE_IPV6" = false ] ; then + sed -i "s/^DHCP=yes/DHCP=v4/" $R/etc/systemd/network/eth.network + fi else # ENABLE_DHCP=false -cat <$R/etc/systemd/network/eth.network + cat <$R/etc/systemd/network/eth.network [Match] Name=eth0 @@ -69,7 +60,7 @@ chroot_exec systemctl enable systemd-networkd # Enable network stack hardening if [ "$ENABLE_HARDNET" = true ] ; then - install -o root -g root -m 644 files/sysctl.d/81-rpi-net-hardening.conf $R/etc/sysctl.d/81-rpi-net-hardening.conf + install_readonly files/sysctl.d/81-rpi-net-hardening.conf $R/etc/sysctl.d/81-rpi-net-hardening.conf # Enable resolver warnings about spoofed addresses cat <>$R/etc/host.conf -- cgit v1.2.3