##// END OF EJS Templates
Don’t require apt lock to be available on build machine if there are no packages to install
Don’t require apt lock to be available on build machine if there are no packages to install

Fichier de la dernière révision:

r94:2ce085c56493
r106:8f781dfa765d
Show More
20-networking.sh
93 lines | 3.1 KiB | application/x-sh | BashLexer
Filip Pytloun
Refactor: split bootstrap actions and allow custom
r56 #
Jan Wagner
spliting more files, fix-uboot, fix-fbturbo, fix-locale
r67 # Setup Networking
Filip Pytloun
Refactor: split bootstrap actions and allow custom
r56 #
Jan Wagner
spliting more files, fix-uboot, fix-fbturbo, fix-locale
r67 # Load utility functions
Filip Pytloun
Refactor: split bootstrap actions and allow custom
r56 . ./functions.sh
Jan Wagner
comment-cleanup, net-cleanup, size-calc-fix, split-more, menuconfig
r71 # Install and setup hostname
drtyhlpr
Added Raspberry Pi 3 model support
r94 install_readonly files/network/hostname "${ETC_DIR}/hostname"
sed -i "s/^rpi2-jessie/${HOSTNAME}/" "${ETC_DIR}/hostname"
Jan Wagner
spliting more files, fix-uboot, fix-fbturbo, fix-locale
r67
Jan Wagner
comment-cleanup, net-cleanup, size-calc-fix, split-more, menuconfig
r71 # Install and setup hosts
drtyhlpr
Added Raspberry Pi 3 model support
r94 install_readonly files/network/hosts "${ETC_DIR}/hosts"
sed -i "s/rpi2-jessie/${HOSTNAME}/" "${ETC_DIR}/hosts"
Filip Pytloun
Refactor: split bootstrap actions and allow custom
r56
Jan Wagner
comment-cleanup, net-cleanup, size-calc-fix, split-more, menuconfig
r71 # Setup hostname entry with static IP
Filip Pytloun
Refactor: split bootstrap actions and allow custom
r56 if [ "$NET_ADDRESS" != "" ] ; then
Jan Wagner
Added: KERNELSRC_PREBUILT, KERNELSRC_ rename, fix-quotes
r75 NET_IP=$(echo "${NET_ADDRESS}" | cut -f 1 -d'/')
drtyhlpr
Added Raspberry Pi 3 model support
r94 sed -i "s/^127.0.1.1/${NET_IP}/" "${ETC_DIR}/hosts"
Filip Pytloun
Refactor: split bootstrap actions and allow custom
r56 fi
Jan Wagner
comment-cleanup, net-cleanup, size-calc-fix, split-more, menuconfig
r71 # Remove IPv6 hosts
if [ "$ENABLE_IPV6" = false ] ; then
drtyhlpr
Added Raspberry Pi 3 model support
r94 sed -i -e "/::[1-9]/d" -e "/^$/d" "${ETC_DIR}/hosts"
Filip Pytloun
Refactor: split bootstrap actions and allow custom
r56 fi
Jan Wagner
comment-cleanup, net-cleanup, size-calc-fix, split-more, menuconfig
r71 # Install hint about network configuration
drtyhlpr
Added Raspberry Pi 3 model support
r94 install_readonly files/network/interfaces "${ETC_DIR}/network/interfaces"
Filip Pytloun
Refactor: split bootstrap actions and allow custom
r56
Jan Wagner
comment-cleanup, net-cleanup, size-calc-fix, split-more, menuconfig
r71 # Install configuration for interface eth0
drtyhlpr
Added Raspberry Pi 3 model support
r94 install_readonly files/network/eth.network "${ETC_DIR}/systemd/network/eth.network"
Jan Wagner
comment-cleanup, net-cleanup, size-calc-fix, split-more, menuconfig
r71
Filip Pytloun
Refactor: split bootstrap actions and allow custom
r56 if [ "$ENABLE_DHCP" = true ] ; then
Jan Wagner
comment-cleanup, net-cleanup, size-calc-fix, split-more, menuconfig
r71 # Enable DHCP configuration for interface eth0
drtyhlpr
Added Raspberry Pi 3 model support
r94 sed -i -e "s/DHCP=.*/DHCP=yes/" -e "/DHCP/q" "${ETC_DIR}/systemd/network/eth.network"
Filip Pytloun
Refactor: split bootstrap actions and allow custom
r56
Jan Wagner
code cleanup and even more spliting
r70 # Set DHCP configuration to IPv4 only
Jan Wagner
spliting more files, fix-uboot, fix-fbturbo, fix-locale
r67 if [ "$ENABLE_IPV6" = false ] ; then
drtyhlpr
Added Raspberry Pi 3 model support
r94 sed -i "s/DHCP=.*/DHCP=v4/" "${ETC_DIR}/systemd/network/eth.network"
Jan Wagner
spliting more files, fix-uboot, fix-fbturbo, fix-locale
r67 fi
Jan Wagner
code cleanup and even more spliting
r70
Filip Pytloun
Refactor: split bootstrap actions and allow custom
r56 else # ENABLE_DHCP=false
Jan Wagner
comment-cleanup, net-cleanup, size-calc-fix, split-more, menuconfig
r71 # Set static network configuration for interface eth0
sed -i\
-e "s|DHCP=.*|DHCP=no|"\
-e "s|Address=\$|Address=${NET_ADDRESS}|"\
-e "s|Gateway=\$|Gateway=${NET_GATEWAY}|"\
-e "0,/DNS=\$/ s|DNS=\$|DNS=${NET_DNS_1}|"\
-e "0,/DNS=\$/ s|DNS=\$|DNS=${NET_DNS_2}|"\
-e "s|Domains=\$|Domains=${NET_DNS_DOMAINS}|"\
-e "0,/NTP=\$/ s|NTP=\$|NTP=${NET_NTP_1}|"\
-e "0,/NTP=\$/ s|NTP=\$|NTP=${NET_NTP_2}|"\
drtyhlpr
Added Raspberry Pi 3 model support
r94 "${ETC_DIR}/systemd/network/eth.network"
Filip Pytloun
Refactor: split bootstrap actions and allow custom
r56 fi
Jan Wagner
comment-cleanup, net-cleanup, size-calc-fix, split-more, menuconfig
r71 # Remove empty settings from network configuration
drtyhlpr
Added Raspberry Pi 3 model support
r94 sed -i "/.*=\$/d" "${ETC_DIR}/systemd/network/eth.network"
Jan Wagner
comment-cleanup, net-cleanup, size-calc-fix, split-more, menuconfig
r71
drtyhlpr
Added Debian stretch release support
r92 # Move systemd network configuration if required by Debian release
if [ "$RELEASE" = "stretch" ] ; then
drtyhlpr
Added Raspberry Pi 3 model support
r94 mv -v "${ETC_DIR}/systemd/network/eth.network" "${LIB_DIR}/systemd/network/10-eth.network"
rm -fr "${ETC_DIR}/systemd/network"
drtyhlpr
Added Debian stretch release support
r92 fi
Filip Pytloun
Refactor: split bootstrap actions and allow custom
r56 # Enable systemd-networkd service
chroot_exec systemctl enable systemd-networkd
Jan Wagner
comment-cleanup, net-cleanup, size-calc-fix, split-more, menuconfig
r71 # Install host.conf resolver configuration
drtyhlpr
Added Raspberry Pi 3 model support
r94 install_readonly files/network/host.conf "${ETC_DIR}/host.conf"
Jan Wagner
comment-cleanup, net-cleanup, size-calc-fix, split-more, menuconfig
r71
Filip Pytloun
Refactor: split bootstrap actions and allow custom
r56 # Enable network stack hardening
if [ "$ENABLE_HARDNET" = true ] ; then
Jan Wagner
comment-cleanup, net-cleanup, size-calc-fix, split-more, menuconfig
r71 # Install sysctl.d configuration files
drtyhlpr
Added Raspberry Pi 3 model support
r94 install_readonly files/sysctl.d/82-rpi-net-hardening.conf "${ETC_DIR}/sysctl.d/82-rpi-net-hardening.conf"
Filip Pytloun
Refactor: split bootstrap actions and allow custom
r56
Jan Wagner
comment-cleanup, net-cleanup, size-calc-fix, split-more, menuconfig
r71 # Setup resolver warnings about spoofed addresses
drtyhlpr
Added Raspberry Pi 3 model support
r94 sed -i "s/^# spoof warn/spoof warn/" "${ETC_DIR}/host.conf"
Filip Pytloun
Refactor: split bootstrap actions and allow custom
r56 fi
Stephen A. Brandli
Fixed: Enable systemd time sync.
r85
# Enable time sync
if [ "NET_NTP_1" != "" ] ; then
chroot_exec systemctl enable systemd-timesyncd.service
fi
drtyhlpr
Added Raspberry Pi 3 model support
r94
# Download the firmware binary blob required to use the RPi3 wireless interface
if [ "$ENABLE_WIRELESS" = true ] ; then
if [ ! -d ${WLAN_FIRMWARE_DIR} ] ; then
mkdir -p ${WLAN_FIRMWARE_DIR}
fi
wget -q -O "${WLAN_FIRMWARE_DIR}/brcmfmac43430-sdio.bin" "${WLAN_FIRMWARE_URL}/brcmfmac43430-sdio.bin"
wget -q -O "${WLAN_FIRMWARE_DIR}/brcmfmac43430-sdio.txt" "${WLAN_FIRMWARE_URL}/brcmfmac43430-sdio.txt"
fi