DEJAVUFONTS="dejavu-fonts-ttf-2.33"
DESKTOP_FILE_UTILS="desktop-file-utils-0.20"
DHCP="dhcp-4.2.3-P2"
+DHCPCD="dhcpcd-6.6.4"
DIALOG="dialog_1.1-20120215.orig"
DIFFUTILS="diffutils-3.3"
DOCBOOK_DSSSL_VER="1.79"
# Load network interface card parameters
source /etc/sysconfig/network/ifconfig.${DEVICE}
+# Load DHCP client parameters
+source /etc/sysconfig/network/dhcp-client
+
+# Make sure DHCP client is available.
+if [ ! -x ${DHCP_PROG} ]; then
+ echo "Program \"${DHCP_PROG}\" is not executable."
+ exit ${EXIT_CODE_FAILURE}
+fi
+
# Check that the brctl program is present and executable.
check_brctl()
{
exit ${EXIT_CODE_WARNING}
fi
-if [ "x${BOOTPROTO}" = "xdhcp" -o "x${BOOTPROTO}" = "xwifi" ]; then
- # DHCP configuration
- # Load DHCP client parameters
- source /etc/sysconfig/network/dhcp-client
+case ${BOOTPROTO} in
+ dhcp)
+ cmd_run_log ${DHCP_PROG} ${DHCP_STOP} ${DEVICE} || \
+ exit ${EXIT_CODE_FAILURE}
+ ;;
- if [ ! -x ${DHCP_PROG} ]; then
- echo "Program \"${DHCP_PROG}\" is not executable."
- exit ${EXIT_CODE_FAILURE}
- fi
- cmd_run_log ${DHCP_PROG} ${DHCP_STOP} ${DEVICE} || exit ${EXIT_CODE_FAILURE}
-elif [ x${BOOTPROTO} = "xstatic" ]; then
- # Static configuration
- cmd_run_log ip addr flush ${DEVICE} || exit ${EXIT_CODE_FAILURE}
-elif [ x${BOOTPROTO} = "xpppoe" ]; then
- # PPPoE configuration
- cmd_run_log pppoe-stop
- cmd_run_log ip addr flush ${DEVICE} || exit ${EXIT_CODE_FAILURE}
-else
- exit 1
-fi
+ wifi)
+ cmd_run_log ${DHCP_PROG} ${DHCP_STOP} ${DEVICE} || \
+ exit ${EXIT_CODE_FAILURE}
+ echo "Stopping wpa_supplicant"
+ killall wpa_supplicant
+ ;;
-if [ "x${BOOTPROTO}" = "xwifi" ]; then
- echo "Stopping wpa_supplicant"
- killall wpa_supplicant
-fi
+ static)
+ ;;
+
+ pppoe)
+ cmd_run_log pppoe-stop
+ ;;
+
+ *)
+ echo "Invalid BOOTPROTO value: ${BOOTPROTO}"
+ exit ${EXIT_CODE_FAILURE}
+esac
+cmd_run_log ip addr flush ${DEVICE} || exit ${EXIT_CODE_FAILURE}
cmd_run_log ip link set ${DEVICE} down || exit ${EXIT_CODE_FAILURE}
# Determining if the interface is part of a bridge:
# Load network interface card parameters
source /etc/sysconfig/network/ifconfig.${DEVICE}
+# Load DHCP client parameters
+source /etc/sysconfig/network/dhcp-client
+
+# Make sure DHCP client is available.
+if [ ! -x ${DHCP_PROG} ]; then
+ echo "Program \"${DHCP_PROG}\" is not executable."
+ exit ${EXIT_CODE_FAILURE}
+fi
+
# Check that the brctl program is present and executable.
check_brctl()
{
# Static IP address protocol
proto_static()
{
- cmd_run_log ip addr add ${IPADDR}/${PREFIX_LENGTH} dev ${DEVICE} brd + ${IFSCOPE} &&
+ cmd_run_log ip addr add ${IPADDR}/${PREFIX_LENGTH} dev ${DEVICE} \
+ brd + ${IFSCOPE} || exit ${EXIT_CODE_FAILURE}
+
+ # Bring interface up
bring_if_up
if [ -n "${GATEWAY}" ]; then
- if ip route | grep -q default; then
- msg_log "Gateway already setup; skipping."
- else
- cmd_run_log_box "Adding default route to gateway ${GATEWAY} via ${DEVICE}" \
- ip route add default via ${GATEWAY} dev ${DEVICE}
- fi
+ cmd_run_log ip route add default via ${GATEWAY} || \
+ exit ${EXIT_CODE_FAILURE}
fi
}
# Obtain IP address from DHCP
proto_dhcp()
{
+ # Bring interface up
bring_if_up
- # Load DHCP client parameters
- source /etc/sysconfig/network/dhcp-client
-
- # Make sure no file named `/var/run/dhclient.pid' remains.
- if [ -f "/var/run/dhclient.pid" ]; then
- rm -f /var/run/dhclient.pid
- fi
-
- if [ ! -x "${DHCP_PROG}" ]; then
- echo "Program \"${DHCP_PROG}\" is not executable."
- exit ${EXIT_CODE_FAILURE}
- fi
-
cmd_run_log ${DHCP_PROG} ${DHCP_START} ${DEVICE}
}
fi
# Warning:
- # wpa_supplicant will connect to a given network SSID even if the case is incorrect
- # (MyNetwork and MYNETWORK will work). But the ssid network file configuration
- # case must match exactly what was returned by wpa_supplicant
+ # wpa_supplicant will connect to a given network SSID even if the case is
+ # incorrect (MyNetwork and MYNETWORK will work). But the ssid network file
+ # configuration case must match exactly what was returned by wpa_supplicant.
if [ ! -f "/etc/sysconfig/network/ssid/${SSID}" ]; then
echo "${0}: Missing network configuration file \"/etc/sysconfig/network/ssid/${SSID}\""
exit ${EXIT_CODE_FAILURE}
log_script_name "$0 $*"
-BACKGROUND_START=yes
-
# Load global network parameters
source /etc/sysconfig/network/network-parameters
network_start()
{
NUMBER_OF_IF_STARTED=0
- NUMBER_OF_IF_TO_START=$(echo ${INTERFACES_UP} | wc -w)
+ NUMBER_OF_IF_TO_START=$(echo ${INTERFACES} | wc -w)
- for i in ${INTERFACES_UP}; do
+ for i in ${INTERFACES}; do
if LANG=C egrep -q -L "^ONBOOT=\"?[Yy][Ee][Ss]\"?" ifconfig.$i ; then
local STR="Ethernet Adapter <$i> init"
local CMD="/etc/rc.d/init.d/ifup $i"
fi
}
-if [ x"${DNS_SERVER_ENA}" == xyes ]; then
- cat > /etc/dhclient-enter-hooks << "EOF"
-# If named is running, do not let dhclient create or modify resolv.conf
-# by specifying an empty function hook:
-make_resolv_conf(){
- :
+network_stop()
+{
+ for i in ${INTERFACES} ; do
+ if LC_ALL= LANG= ip link show dev $i 2> /dev/null | grep -q "UP";
+ then
+ cmd_run_log_box_warn "Ethernet Adapter <$i> stop" \
+ /etc/rc.d/init.d/ifdown "$i"
+ fi
+ done
+
+ ip route flush all
}
-EOF
- chmod u+x /etc/dhclient-enter-hooks
-else
- if [ -f /etc/dhclient-enter-hooks ]; then
- rm /etc/dhclient-enter-hooks
- fi
-fi
# See how we were called.
case "$1" in
stop)
clean_network_up_indication
-
- for i in ${INTERFACES_DN} ; do
- if LC_ALL= LANG= ip link show dev $i 2> /dev/null | grep -q "UP";
- then
- cmd_run_log_box_warn "Ethernet Adapter <$i> stop" \
- /etc/rc.d/init.d/ifdown "$i"
- fi
- done
+ network_stop
;;
restart)
ipkg ${EUDEV}
CFLAGS="" CPPFLAGS="" CXXFLAGS="" ipkg ${GRUB} --disable-werror
ipkg -m acnb ${DHCP}
+ipkg -m acnb ${DHCPCD}
if [ -n "${WIFI_SUPPORT}" ]; then
ipkg -m acnb ${LIBNL} "--disable-static"
# "/etc/sysconfig/network/network-parameters" file creation
echo "#!/bin/sh" > /etc/sysconfig/network/network-parameters
+echo "" >> /etc/sysconfig/network/network-parameters
+echo "# Run network script in the background, to speed-up boot time." >> \
+ /etc/sysconfig/network/network-parameters
+echo "BACKGROUND_START=no" >> /etc/sysconfig/network/network-parameters
+echo "" >> /etc/sysconfig/network/network-parameters
echo "DOMAINNAME=\"${DOMAIN}\"" >> /etc/sysconfig/network/network-parameters
-echo "INTERFACES_UP=\"lo ${INTERFACES}\"" >> /etc/sysconfig/network/network-parameters
-echo "INTERFACES_DN=\"${INTERFACES} lo\"" >> /etc/sysconfig/network/network-parameters
+echo "INTERFACES=\"lo ${INTERFACES}\"" >> /etc/sysconfig/network/network-parameters
cat >> /etc/sysconfig/network/network-parameters << EOF
"http://www.infodrom.org/projects/sysklogd/download"
fpkg -m gnu ${GRUB}
fpkg -e "tar.gz" ${DHCP} "ftp://ftp.isc.org/isc/dhcp/$(get_pkg_ver ${DHCP})"
+fpkg ${DHCPCD} "http://roy.marples.name/downloads/dhcpcd"
fpkg -e "tar.gz" ${ACPID} "http://www.tedfelix.com/linux"
fpkg -m hv ${HV_UTILITIES}
hvbuild_post()
{
- install -m 755 client/scripts/linux /sbin/dhclient-script
-
- # This is for the DHCP client
- cat > /etc/dhclient.conf << "EOF"
-# dhclient.conf
-
-timeout 15;
-
-interface "eth0"{
- supersede domain-name "_DOMAIN_";
- request subnet-mask, broadcast-address, time-offset, routers,
- domain-name, domain-name-servers, host-name;
- require subnet-mask, domain-name-servers;
-}
-EOF
-
- sed -i -e "s!_DOMAIN_!${DOMAIN}!g" /etc/dhclient.conf
-
- cat > /etc/sysconfig/network/dhcp-client << "EOF"
-# dhcp-client
-# DHCP client program informations
-#
-DHCP_PROG="/sbin/dhclient"
-DHCP_START="-q -1"
-DHCP_STOP="-q -r"
-EOF
-
# Create a base configuration file for a DHCP server.
cat > /etc/dhcpd.conf << EOF
# Configuration file for DHCP server.
--- /dev/null
+#!/bin/bash
+
+hvconfig_pre()
+{
+ CONFIGURE_OPTS="\
+ --libexecdir=/lib/dhcpcd \
+ --dbdir=/var/tmp"
+}
+
+hvbuild_post()
+{
+ cat > /etc/sysconfig/network/dhcp-client << "EOF"
+# dhcp-client
+# DHCP client program informations
+#
+DHCP_PROG="/sbin/dhcpcd"
+DHCP_START="-4 --noarp --timeout 5"
+DHCP_STOP="-4 --release"
+EOF
+}