wwan: add a generic 3g/4g proto
[openwrt/openwrt.git] / package / network / utils / comgt / files / 3g.sh
index deca2c95e22cc5749ffbdf32d441365c15e6d0f7..968662675b42e4204af3813191ad55717c2727b5 100644 (file)
@@ -1,9 +1,13 @@
 #!/bin/sh
-INCLUDE_ONLY=1
 
-. ../netifd-proto.sh
-. ./ppp.sh
-init_proto "$@"
+[ -n "$INCLUDE_ONLY" ] || {
+       NOT_INCLUDED=1
+       INCLUDE_ONLY=1
+
+       . ../netifd-proto.sh
+       . ./ppp.sh
+       init_proto "$@"
+}
 
 proto_3g_init_config() {
        no_device=1
@@ -26,6 +30,7 @@ proto_3g_setup() {
        json_get_var pincode pincode
        json_get_var dialnumber dialnumber
 
+       [ -n "$dat_device" ] && device=$dat_device
        [ -e "$device" ] || {
                proto_set_available "$interface" 0
                return 1
@@ -101,4 +106,4 @@ proto_3g_teardown() {
        proto_kill_command "$interface"
 }
 
-add_protocol 3g
+[ -z "NOT_INCLUDED" ] || add_protocol 3g