X-Git-Url: https://git.rohieb.name/openwrt.git/blobdiff_plain/6dc988729c78347c590675fe4bfdb9bb408fffc7..684c3d2f3c7314ce8518e7cbf3892db6f5588e87:/package/base-files/default/etc/functions.sh?ds=sidebyside diff --git a/package/base-files/default/etc/functions.sh b/package/base-files/default/etc/functions.sh index c813e39a6..e7126473f 100755 --- a/package/base-files/default/etc/functions.sh +++ b/package/base-files/default/etc/functions.sh @@ -1,4 +1,4 @@ -#!/bin/ash +#!/bin/sh . /etc/nvram.sh alias debug=${DEBUG:-:} @@ -7,23 +7,13 @@ alias debug=${DEBUG:-:} if_valid () ( ifconfig "$1" >&- 2>&- || [ "${1%%[0-9]}" = "br" ] || - { - [ "${1%%[0-9]}" = "vlan" ] && ( - i=${1#vlan} - hwname=$(nvram get vlan${i}hwname) - hwaddr=$(nvram get ${hwname}macaddr) - [ -z "$hwaddr" ] && return 1 - - vif=$(ifconfig -a | awk '/^eth.*'$hwaddr'/ {print $1; exit}' IGNORECASE=1) - debug "# vlan$i => $vif" - - $DEBUG ifconfig $vif up - $DEBUG vconfig add $vif $i 2>&- - ) - } || { debug "# missing interface '$1' ignored"; false; } ) +hotplug_dev() { + env -i ACTION=$1 INTERFACE=$2 /sbin/hotplug net +} + bitcount () { local c=$1 echo $((