All pastes #946161 Raw Edit

Someone

public text v1 · immutable
·published 2008-03-17 14:25 UTC
rendered paste body
ifup()
{
        if [ "$1" = "" ]; then
                echo "usage: $0 ifup <interface_name>"
                return 1
        fi
        # don't bring up an interface that's already up
        [ "$(/sbin/ifconfig ${1} 2>/dev/null | grep UP)" ] && return 0
        eval iwcfg="\$wlan_${1}"
        if [ "$iwcfg" != "" ]; then
                sh -c "/usr/sbin/iwconfig $iwcfg"
                /bin/sleep 2
        fi
        eval ifcfg="\$${1}"
        if [ "$ifcfg" = "dhcp" ]; then
                # remove the .pid file if it exists
                rm -f /var/run/dhcpcd-${1}.{pid,cache} >/dev/null 2>&1
                /sbin/dhcpcd $DHCPCD_ARGS ${1}
        else
                /sbin/ifconfig $ifcfg
        fi
        return $?
}