move around files
authorFelix Fietkau <nbd@openwrt.org>
Sun, 9 Oct 2011 23:55:38 +0000 (01:55 +0200)
committerFelix Fietkau <nbd@openwrt.org>
Sun, 9 Oct 2011 23:55:38 +0000 (01:55 +0200)
dummy/netifd-proto.sh [new file with mode: 0755]
dummy/proto/netifd-proto.sh [deleted symlink]
dummy/proto/ppp.sh
proto/netifd-proto.sh [deleted file]

diff --git a/dummy/netifd-proto.sh b/dummy/netifd-proto.sh
new file mode 100755 (executable)
index 0000000..d15505c
--- /dev/null
@@ -0,0 +1,65 @@
+. /usr/share/libubox/jshn.sh
+
+proto_config_add_generic() {
+       json_add_array ""
+       json_add_string "" "$1"
+       json_add_int "" "$2"
+       json_close_array
+}
+
+proto_config_add_int() {
+       proto_config_add_generic "$1" 5
+}
+
+proto_config_add_string() {
+       proto_config_add_generic "$1" 3
+}
+
+proto_config_add_boolean() {
+       proto_config_add_generic "$1" 7
+}
+
+add_default_handler() {
+       case "$(type $1 2>/dev/null)" in
+               *function*) return;;
+               *) eval "$1() { return; }"
+       esac
+}
+
+proto="$1"; shift
+cmd="$1"; shift
+interface="$1"; shift
+data="$1"; shift
+ifname="$1"; shift
+
+case "$cmd" in
+       dump)
+               add_protocol() {
+                       no_device=0
+                       available=0
+
+                       add_default_handler "$1_init_config"
+
+                       json_init
+                       json_add_string "name" "$1"
+                       eval "$1_init"
+                       json_add_boolean no-device "$no_device"
+                       json_add_boolean available "$available"
+                       json_add_array "config"
+                       eval "$1_init_config"
+                       json_close_array
+                       json_dump
+               }
+       ;;
+       *)
+               add_protocol() {
+                       [[ "$proto" == "$1" ]] || return 0
+
+                       case "$cmd" in
+                               setup) eval "$1_setup \"\$interface\" \"\$data\" \"\$ifname\"" ;;
+                               teardown) eval "$1_teardown \"\$interface\" \"\$data\" \"\$ifname\"" ;;
+                               *) return 1 ;;
+                       esac
+               }
+       ;;
+esac
diff --git a/dummy/proto/netifd-proto.sh b/dummy/proto/netifd-proto.sh
deleted file mode 120000 (symlink)
index b313293..0000000
+++ /dev/null
@@ -1 +0,0 @@
-../../proto/netifd-proto.sh
\ No newline at end of file
index 8e8ceb2..cd57145 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
 #!/bin/sh
 
-. netifd-proto.sh
+. ../netifd-proto.sh
 
 ppp_init_config() {
        proto_config_add_string "username"
 
 ppp_init_config() {
        proto_config_add_string "username"
diff --git a/proto/netifd-proto.sh b/proto/netifd-proto.sh
deleted file mode 100755 (executable)
index d15505c..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-. /usr/share/libubox/jshn.sh
-
-proto_config_add_generic() {
-       json_add_array ""
-       json_add_string "" "$1"
-       json_add_int "" "$2"
-       json_close_array
-}
-
-proto_config_add_int() {
-       proto_config_add_generic "$1" 5
-}
-
-proto_config_add_string() {
-       proto_config_add_generic "$1" 3
-}
-
-proto_config_add_boolean() {
-       proto_config_add_generic "$1" 7
-}
-
-add_default_handler() {
-       case "$(type $1 2>/dev/null)" in
-               *function*) return;;
-               *) eval "$1() { return; }"
-       esac
-}
-
-proto="$1"; shift
-cmd="$1"; shift
-interface="$1"; shift
-data="$1"; shift
-ifname="$1"; shift
-
-case "$cmd" in
-       dump)
-               add_protocol() {
-                       no_device=0
-                       available=0
-
-                       add_default_handler "$1_init_config"
-
-                       json_init
-                       json_add_string "name" "$1"
-                       eval "$1_init"
-                       json_add_boolean no-device "$no_device"
-                       json_add_boolean available "$available"
-                       json_add_array "config"
-                       eval "$1_init_config"
-                       json_close_array
-                       json_dump
-               }
-       ;;
-       *)
-               add_protocol() {
-                       [[ "$proto" == "$1" ]] || return 0
-
-                       case "$cmd" in
-                               setup) eval "$1_setup \"\$interface\" \"\$data\" \"\$ifname\"" ;;
-                               teardown) eval "$1_teardown \"\$interface\" \"\$data\" \"\$ifname\"" ;;
-                               *) return 1 ;;
-                       esac
-               }
-       ;;
-esac