diff options
author | nbd <nbd@3c298f89-4303-0410-b956-a3cf2f4a3e73> | 2005-11-07 01:12:51 +0000 |
---|---|---|
committer | nbd <nbd@3c298f89-4303-0410-b956-a3cf2f4a3e73> | 2005-11-07 01:12:51 +0000 |
commit | 5dfad9395848f74699752473b825635c30fb5567 (patch) | |
tree | 523205d7071063e42f742aeabadd523f78b8504f /openwrt/package/base-files/default/etc/hotplug.d | |
parent | bdd94763c1c3c236e2bd8b2282dad526e08bbb66 (diff) |
add hotplug stuff to trunk/
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@2364 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'openwrt/package/base-files/default/etc/hotplug.d')
-rw-r--r-- | openwrt/package/base-files/default/etc/hotplug.d/net/01-wds | 5 | ||||
-rw-r--r-- | openwrt/package/base-files/default/etc/hotplug.d/usb/01-mount | 49 |
2 files changed, 54 insertions, 0 deletions
diff --git a/openwrt/package/base-files/default/etc/hotplug.d/net/01-wds b/openwrt/package/base-files/default/etc/hotplug.d/net/01-wds new file mode 100644 index 000000000..38bd69667 --- /dev/null +++ b/openwrt/package/base-files/default/etc/hotplug.d/net/01-wds @@ -0,0 +1,5 @@ +[ "${INTERFACE%%[0-9]*}" = "wds" ] && { + ifconfig $INTERFACE 0.0.0.0 up + /usr/sbin/brctl addif br0 $INTERFACE +} + diff --git a/openwrt/package/base-files/default/etc/hotplug.d/usb/01-mount b/openwrt/package/base-files/default/etc/hotplug.d/usb/01-mount new file mode 100644 index 000000000..c28ada204 --- /dev/null +++ b/openwrt/package/base-files/default/etc/hotplug.d/usb/01-mount @@ -0,0 +1,49 @@ +mount_storage() { + cd /dev/discs + for dev in disc*; do + [ -f /tmp/.${dev}_id ] || { + echo ${INTERFACE}${PRODUCT} > /tmp/.${dev}_id + mount | grep /mnt/${dev} || ( + [ -d /mnt/. ] || { + mkdir -p /tmp/mnt + ln -s /tmp/mnt / + } + cd $dev + for part in part*; do + path=/mnt/${dev}_${part##*part} + mkdir -p ${path} + mount ${part} ${path} + done + ) + } + done +} + +umount_storage() { + for tmp in /tmp/.*_id; do + id=$(cat $tmp 2>&-) + [ "${INTERFACE}${PRODUCT}" = "$id" ] && { + rm -f $tmp + disc=${tmp##*disc} + disc=${disc%%_id} + for disc in /mnt/disc${disc}*; do + umount -f $disc || umount -l $disc + done + } + done +} + +[ -f /proc/bus/usb/devices ] || mount -t usbfs none /proc/bus/usb + +case "$ACTION" in + add) + case "${INTERFACE%%/*}" in + 8) mount_storage ;; + esac + ;; + remove) + case "${INTERFACE%%/*}" in + 8) umount_storage ;; + esac + ;; +esac |