distribution/packages/sysutils/systemd/scripts/network-base-setup

30 lines
724 B
Text
Raw Normal View History

2022-02-05 14:23:32 +00:00
#!/bin/sh
. /etc/profile
# Set hostname
HOSTNAME=$(get_setting system.hostname)
echo ${HOSTNAME} >/proc/sys/kernel/hostname
hostnamectl --transient hostname ${HOSTNAME}
avahi-set-host-name ${HOSTNAME}
2022-02-05 14:23:32 +00:00
# setup /etc/hosts
rm -f /run/libreelec/hosts
if [ -f /storage/.config/hosts.conf ]; then
cat /storage/.config/hosts.conf > /run/libreelec/hosts
fi
# setup /etc/resolv.conf
rm -f /run/libreelec/resolv.conf
if [ -f /storage/.config/resolv.conf ]; then
cat /storage/.config/resolv.conf > /run/libreelec/resolv.conf
elif [ -f /dev/.kernel_ipconfig -a -f /proc/net/pnp ]; then
cat /proc/net/pnp > /run/libreelec/resolv.conf
else
cat << EOF > /run/libreelec/resolv.conf
nameserver 8.8.8.8
nameserver 8.8.4.4
EOF
fi