Merged enhancements submitted by Stereo, thanks, closes #188 and #189
[openwrt/svn-archive/archive.git] / openwrt / package / base-files / default / sbin / hotplug
1 #!/bin/sh
2 [ "$1" = "firmware" -a "$ACTION" = "add" ] && {
3 [ -f "/lib/firmware/$FIRMWARE" ] && {
4 echo 1 > "/sys$DEVPATH/loading"
5 cp "/lib/firmware/$FIRMWARE" "/sys$DEVPATH/data"
6 echo 0 > "/sys$DEVPATH/loading"
7 }
8 exit 0
9 }
10
11 [ -e /tmp/.failsafe ] && {
12 export FAILSAFE=true
13 } || {
14 [ -e /etc/config/network ] && . /etc/config/network
15 }
16 . /etc/functions.sh
17 . /etc/network.overrides
18
19 PATH=/bin:/sbin:/usr/bin:/usr/sbin
20 LOGNAME=root
21 USER=root
22 export PATH LOGNAME USER
23
24 [ \! -z "$1" -a -d /etc/hotplug.d/$1 ] && {
25 for script in $(ls /etc/hotplug.d/$1/* 2>&-); do (
26 [ -f $script ] && . $script
27 ); done
28 }