[package] ppp: add hotplug helper for usb dsl modems to ppp-mod-pppoa package
authorJo-Philipp Wich <jow@openwrt.org>
Sun, 2 May 2010 16:40:58 +0000 (16:40 +0000)
committerJo-Philipp Wich <jow@openwrt.org>
Sun, 2 May 2010 16:40:58 +0000 (16:40 +0000)
SVN-Revision: 21302

package/ppp/Makefile
package/ppp/files/etc/hotplug.d/atm/20-usb-modem [new file with mode: 0644]

index 90e4590..222c85d 100644 (file)
@@ -149,6 +149,8 @@ define Package/ppp-mod-pppoa/install
                $(1)/usr/lib/pppd/$(PKG_VERSION)/
        $(INSTALL_DIR) $(1)/lib/network
        $(INSTALL_BIN) ./files/pppoa.sh $(1)/lib/network/
+       $(INSTALL_DIR) $(1)/etc/hotplug.d/atm
+       $(INSTALL_DATA) ./files/etc/hotplug.d/atm/20-usb-modem $(1)/etc/hotplug.d/atm/
 endef
 
 define Package/ppp-mod-pppoe/install
diff --git a/package/ppp/files/etc/hotplug.d/atm/20-usb-modem b/package/ppp/files/etc/hotplug.d/atm/20-usb-modem
new file mode 100644 (file)
index 0000000..ab9e3b7
--- /dev/null
@@ -0,0 +1,25 @@
+#!/bin/sh\r
+\r
+if [ "$ACTION" = "add" ]; then\r
+       include /lib/network\r
+       scan_interfaces\r
+\r
+       local found=0\r
+       local ifc\r
+       for ifc in $interfaces; do\r
+               local up\r
+               config_get_bool up "$ifc" up 0\r
+\r
+               local proto\r
+               config_get proto "$ifc" proto\r
+\r
+               if [ "$proto" = "pppoa" ] && [ "$up" != 1 ]; then\r
+                       found=1\r
+                       ( sleep 1; ifup "$ifc" ) &\r
+               fi\r
+       done\r
+\r
+       if [ "$found" != 1 ]; then\r
+               logger "Found no matching interface for DSL device $DEVICENAME"\r
+       fi\r
+fi\r