#!/bin/bash # Copyright (c) 2004-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # Contributed by Roy Marples (uberlord@gentoo.org) . "${svclib}/sh/rc-services.sh" MODULES_DIR="${svclib}/net.modules.d" . "${MODULES_DIR}/system" . "${MODULES_DIR}/helpers.d/functions" conf="$(add_suffix /etc/conf.d/net)" [[ -e ${conf} ]] && source "${conf}" conf="$(add_suffix "/etc/conf.d/net.${interface}")" [[ -e ${conf} ]] && source "${conf}" # Create some dummy functions, so we can depend on a module after() { return; } before() { return; } need() { return; } provide() { return; } installed() { return; } functions() { return; } variables() { eval "${MODULE}_variables() { echo \"$*\"; }"; } # Guess which interface module to load - we prefer iproute2 if [[ -x /sbin/ip ]] ; then interface_module="iproute2" elif [[ -x /sbin/ifconfig ]] ; then interface_module="ifconfig" else echo "Can't find a known interface module" >&2 exit 1 fi # iwconfig is the best bet for wireless - we use wpa_supplicant # only if we need to if [[ -x /sbin/iwconfig ]] ; then wireless_module="iwconfig" elif [[ -x /sbin/wpa_supplicant \ && -S "/var/run/wpa_supplicant/${interface}" ]] ; then wireless_module="wpa_supplicant" fi MODULES=( "system" ) # Load our modules . "${MODULES_DIR}/${interface_module}" MODULE="interface" ${interface_module}_depend function_wrap "${interface_module}" interface if [[ -e "${MODULES_DIR}/macnet" ]] ; then . "${MODULES_DIR}/macnet" MODULE="macnet" macnet_depend fi . "${MODULES_DIR}/system" MODULE="system" system_depend if [[ -n ${wireless_module} ]] ; then . "${MODULES_DIR}/${wireless_module}" MODULE="${wireless_module}" ${wireless_module}_depend function_wrap "${wireless_module}" wireless . "${MODULES_DIR}/essidnet" fi # Dummy dhcp dhcp_variables() { echo "dhcp"; } # vim:ts=4