mkimage-profiles/features.in/armh/rootfs/image-scripts.d/50-network
Michael Shigorin d9ca33af6d initial armh* features
These handle only VE-like products (think TWRP on Nexus 7);
the proper image support should be backported later on.

An experiment in layered configurations is still in its
early stages regarding ARM zoo...
2013-06-17 16:01:35 +04:00

74 lines
1.9 KiB
Bash
Executable File

#!/bin/sh
# DESCRIPTION
#
# Setup network settings
# 1. Truncate /etc/resolv.conf
# 2. Init /etc/hosts with "127.0.0.1 localhost"
# 3. Set hostname, domainname
# 4. Set defaults for NetworkManager.
# REQUIRES
#
# Nothing
# INFO
# At startup time hostname may be changed by live-hostname package.
. shell-config
NAME="init3-network"
verbose()
{
if [ -n "$GLOBAL_VERBOSE" ]; then
echo "HOOK: $NAME: $@"
fi
}
verbose "has started"
DOMAINNAME="localdomain"
HOSTNAME="localhost.localdomain"
verbose "Init /etc/hosts with 127.0.0.1 localhost"
/bin/echo "127.0.0.1 localhost localhost.localdomain" > /etc/hosts
verbose "Truncate /etc/resolv.conf"
/bin/echo nameserver 8.8.8.8 >/etc/resolv.conf
chkconfig network on
netcfg="/etc/sysconfig/network"
verbose "Enable networking, disable FORWARD_IPV4, set hostname to $HOSTNAME, domainname to $DOMAINNAME"
shell_config_set "$netcfg" NETWORKING yes
shell_config_set "$netcfg" FORWARD_IPV4 false
shell_config_set "$netcfg" HOSTNAME "$HOSTNAME"
shell_config_set "$netcfg" DOMAINNAME "$DOMAINNAME"
if [ -x /etc/init.d/connmand ]; then
verbose "Enable connmand and finish"
chkconfig --add connmand && chkconfig connmand on
exit 0
fi
verbose "Setup defaults for NetworkManager"
shell_config_set /etc/net/ifaces/default/options-eth BOOTPROTO dhcp
if [ -f /usr/sbin/NetworkManager ] ; then
chkconfig --add NetworkManager && chkconfig NetworkManager on
shell_config_set /etc/net/ifaces/default/options-eth NM_CONTROLLED yes
shell_config_set /etc/net/ifaces/default/options-eth DISABLED yes
#subst 's/NM_CONTROLLED=no/NM_CONTROLLED=yes/' /etc/net/ifaces/*/options ||:
else
verbose "Did you install NetworkManager? Can't find them."
# Don't assign configuration to interfaces, untill ifplugd detects cable presence
subst 's/USE_IFPLUGD=no/USE_IFPLUGD=yes/' /etc/net/ifaces/default/options-eth
fi
verbose "finished"