rename bash ubus scripts
authorSukru Senli <sukru.senli@inteno.se>
Fri, 23 Sep 2016 10:34:34 +0000 (12:34 +0200)
committerSukru Senli <sukru.senli@inteno.se>
Sat, 24 Sep 2016 11:22:20 +0000 (13:22 +0200)
26 files changed:
plugins/juci-broadcom-wl/ubus/juci.wireless [new file with mode: 0755]
plugins/juci-broadcom-wl/ubus/wireless [deleted file]
plugins/juci-ddns/ubus/ddns [deleted file]
plugins/juci-ddns/ubus/juci.ddns [new file with mode: 0755]
plugins/juci-diagnostics/ubus/diagnostics [deleted file]
plugins/juci-diagnostics/ubus/juci.diagnostics [new file with mode: 0755]
plugins/juci-diagnostics/ubus/juci.speedtest [new file with mode: 0755]
plugins/juci-diagnostics/ubus/speedtest [deleted file]
plugins/juci-firewall-fw3/ubus/firewall [deleted file]
plugins/juci-firewall-fw3/ubus/juci.firewall [new file with mode: 0755]
plugins/juci-inteno-provisioning/ubus/iup [deleted file]
plugins/juci-inteno-provisioning/ubus/juci.iup [new file with mode: 0755]
plugins/juci-minidlna/ubus/juci.minidlna [new file with mode: 0755]
plugins/juci-minidlna/ubus/minidlna [deleted file]
plugins/juci-mod-system/ubus/juci.service [new file with mode: 0755]
plugins/juci-mod-system/ubus/juci.system [new file with mode: 0755]
plugins/juci-mod-system/ubus/service [deleted file]
plugins/juci-mod-system/ubus/system [deleted file]
plugins/juci-network-netifd/ubus/juci.modems [new file with mode: 0755]
plugins/juci-network-netifd/ubus/juci.network [new file with mode: 0755]
plugins/juci-network-netifd/ubus/modems [deleted file]
plugins/juci-network-netifd/ubus/network [deleted file]
plugins/juci-sysupgrade/ubus/juci.sysupgrade [new file with mode: 0755]
plugins/juci-sysupgrade/ubus/sysupgrade [deleted file]
plugins/juci-upnp/ubus/juci.upnpd [new file with mode: 0755]
plugins/juci-upnp/ubus/upnpd [deleted file]

diff --git a/plugins/juci-broadcom-wl/ubus/juci.wireless b/plugins/juci-broadcom-wl/ubus/juci.wireless
new file mode 100755 (executable)
index 0000000..30c9cc7
--- /dev/null
@@ -0,0 +1,78 @@
+#!/bin/sh
+
+. /usr/share/libubox/jshn.sh
+
+case "$1" in
+       list)
+               echo '{ "scan" : {"radio":"str"}, "scanresults" : {"radio":"str"}, "set_credentials" : {"ssid":"str", "encryption":"str", "key":"str"} }'
+       ;;
+       call)
+               case "$2" in
+                       scan)
+                               read input;
+
+                               json_load "$input"
+                               json_get_var radio radio
+
+                               [ -n "$radio" ] || return 1
+
+                               json_init
+                               json_add_boolean success $(wlctl -i $radio scan 2>&1 | grep -q Rejected && echo 0 || echo 1)
+                               json_dump
+                       ;;
+                       scanresults)
+                               read input;
+
+                               json_load "$input"
+                               json_get_var radio radio
+
+                               [ -n "$radio" ] || return 1
+
+                               scanfile=/tmp/"$radio"_scan_results
+
+                               wlctl -i $radio scanresults_summary | tr '\t' ' ' > $scanfile
+
+                               json_init
+                               json_add_array "access_points"
+                               while read -r line
+                               do
+                                       json_add_object ""
+                                       json_add_string bssid "$(echo $line | awk '{print$2}')"
+                                       json_add_string rssi "$(echo $line | awk '{print$4}')"
+                                       json_add_string frequency "$(echo $line | awk '{print$7}')"
+                                       json_add_string channel "$(echo $line | awk '{print$9}')"
+                                       json_add_string hwmodes "$(echo $line | awk '{print$11}')"
+                                       json_add_string ssid "$(echo $line | awk '{print$13}')"
+                                       json_select ..
+                               done < $scanfile
+                               rm -f $scanfile
+                               json_dump
+                       ;;
+                       set_credentials)
+                               read input;
+
+                               json_load "$input"
+                               json_get_var ssid ssid
+                               json_get_var key key
+                               json_get_var encryption encryption
+
+                               json_init
+
+                               if [ -z "$ssid" -o -z "$encryption" ]; then
+                                       json_add_string "encryption" "$encryption"
+                                       json_add_string "ssid" "$ssid"
+                                       json_add_string "error" "ssid and encryption needed"
+                                       json_dump
+                               elif [ "$encryption" != "none" -a -z "$key" ]; then
+                                       json_add_string "error" "key needed if encryption is not 'none'"
+                                       json_dump
+                               else
+                                       wifi import "$input" >/dev/null 2>&1 &
+                                       json_add_string "code" "success"
+                               fi
+
+                               json_dump
+                       ;;
+               esac
+       ;;
+esac
diff --git a/plugins/juci-broadcom-wl/ubus/wireless b/plugins/juci-broadcom-wl/ubus/wireless
deleted file mode 100755 (executable)
index 30c9cc7..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-#!/bin/sh
-
-. /usr/share/libubox/jshn.sh
-
-case "$1" in
-       list)
-               echo '{ "scan" : {"radio":"str"}, "scanresults" : {"radio":"str"}, "set_credentials" : {"ssid":"str", "encryption":"str", "key":"str"} }'
-       ;;
-       call)
-               case "$2" in
-                       scan)
-                               read input;
-
-                               json_load "$input"
-                               json_get_var radio radio
-
-                               [ -n "$radio" ] || return 1
-
-                               json_init
-                               json_add_boolean success $(wlctl -i $radio scan 2>&1 | grep -q Rejected && echo 0 || echo 1)
-                               json_dump
-                       ;;
-                       scanresults)
-                               read input;
-
-                               json_load "$input"
-                               json_get_var radio radio
-
-                               [ -n "$radio" ] || return 1
-
-                               scanfile=/tmp/"$radio"_scan_results
-
-                               wlctl -i $radio scanresults_summary | tr '\t' ' ' > $scanfile
-
-                               json_init
-                               json_add_array "access_points"
-                               while read -r line
-                               do
-                                       json_add_object ""
-                                       json_add_string bssid "$(echo $line | awk '{print$2}')"
-                                       json_add_string rssi "$(echo $line | awk '{print$4}')"
-                                       json_add_string frequency "$(echo $line | awk '{print$7}')"
-                                       json_add_string channel "$(echo $line | awk '{print$9}')"
-                                       json_add_string hwmodes "$(echo $line | awk '{print$11}')"
-                                       json_add_string ssid "$(echo $line | awk '{print$13}')"
-                                       json_select ..
-                               done < $scanfile
-                               rm -f $scanfile
-                               json_dump
-                       ;;
-                       set_credentials)
-                               read input;
-
-                               json_load "$input"
-                               json_get_var ssid ssid
-                               json_get_var key key
-                               json_get_var encryption encryption
-
-                               json_init
-
-                               if [ -z "$ssid" -o -z "$encryption" ]; then
-                                       json_add_string "encryption" "$encryption"
-                                       json_add_string "ssid" "$ssid"
-                                       json_add_string "error" "ssid and encryption needed"
-                                       json_dump
-                               elif [ "$encryption" != "none" -a -z "$key" ]; then
-                                       json_add_string "error" "key needed if encryption is not 'none'"
-                                       json_dump
-                               else
-                                       wifi import "$input" >/dev/null 2>&1 &
-                                       json_add_string "code" "success"
-                               fi
-
-                               json_dump
-                       ;;
-               esac
-       ;;
-esac
diff --git a/plugins/juci-ddns/ubus/ddns b/plugins/juci-ddns/ubus/ddns
deleted file mode 100755 (executable)
index e9aa142..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-#!/bin/sh
-
-. /usr/share/libubox/jshn.sh
-
-case "$1" in
-       list)
-               echo '{ "providers" : {} }'
-       ;;
-       call)
-               case "$2" in
-                       providers)
-                               json_init
-                               json_add_array "providers"
-                               for service in $(cat /usr/lib/ddns/services | awk '{print$1}' | tr -d '"'); do
-                                       json_add_string "" "$service"
-                               done
-                               json_dump
-                       ;;
-               esac
-       ;;
-esac
diff --git a/plugins/juci-ddns/ubus/juci.ddns b/plugins/juci-ddns/ubus/juci.ddns
new file mode 100755 (executable)
index 0000000..e9aa142
--- /dev/null
@@ -0,0 +1,21 @@
+#!/bin/sh
+
+. /usr/share/libubox/jshn.sh
+
+case "$1" in
+       list)
+               echo '{ "providers" : {} }'
+       ;;
+       call)
+               case "$2" in
+                       providers)
+                               json_init
+                               json_add_array "providers"
+                               for service in $(cat /usr/lib/ddns/services | awk '{print$1}' | tr -d '"'); do
+                                       json_add_string "" "$service"
+                               done
+                               json_dump
+                       ;;
+               esac
+       ;;
+esac
diff --git a/plugins/juci-diagnostics/ubus/diagnostics b/plugins/juci-diagnostics/ubus/diagnostics
deleted file mode 100755 (executable)
index c9c8ed2..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-#!/bin/sh
-
-. /usr/share/libubox/jshn.sh
-
-case "$1" in
-       list)
-               echo '{ "ping" : {"host":"str"}, "ping6" : {"host":"str"}, "traceroute" : {"host":"str"}, "traceroute6" : {"host":"str"} }'
-       ;;
-       call)
-               case "$2" in
-                       ping|ping6) CMND="$2 -c 5 -W 1" ;;
-                       traceroute|traceroute6) CMND="$2 -q 1 -w 1 -n" ;;
-                       *) return 1 ;;
-               esac
-
-               read input;
-
-               json_load "$input"
-               json_get_var host host
-       
-               json_init
-               json_add_string stdout "$($CMND $host)"
-               json_dump
-       ;;
-esac
diff --git a/plugins/juci-diagnostics/ubus/juci.diagnostics b/plugins/juci-diagnostics/ubus/juci.diagnostics
new file mode 100755 (executable)
index 0000000..c9c8ed2
--- /dev/null
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+. /usr/share/libubox/jshn.sh
+
+case "$1" in
+       list)
+               echo '{ "ping" : {"host":"str"}, "ping6" : {"host":"str"}, "traceroute" : {"host":"str"}, "traceroute6" : {"host":"str"} }'
+       ;;
+       call)
+               case "$2" in
+                       ping|ping6) CMND="$2 -c 5 -W 1" ;;
+                       traceroute|traceroute6) CMND="$2 -q 1 -w 1 -n" ;;
+                       *) return 1 ;;
+               esac
+
+               read input;
+
+               json_load "$input"
+               json_get_var host host
+       
+               json_init
+               json_add_string stdout "$($CMND $host)"
+               json_dump
+       ;;
+esac
diff --git a/plugins/juci-diagnostics/ubus/juci.speedtest b/plugins/juci-diagnostics/ubus/juci.speedtest
new file mode 100755 (executable)
index 0000000..cc65bd9
--- /dev/null
@@ -0,0 +1,26 @@
+#!/bin/sh
+
+. /usr/share/libubox/jshn.sh
+
+case "$1" in
+       list)
+               echo '{ "run" : {"testmode":"str","packetsize":32,"address":"str","port":32} }'
+       ;;
+       call)
+               case "$2" in
+                       run)
+                               if pidof tptest-run >/dev/null; then
+                                       json_init
+                                       json_add_string "error" "there is already a speedtest going on"
+                                       json_dump
+                               else
+                                       read input
+                                       tptest-run "$input" >/dev/null 2>&1 &
+                                       json_init
+                                       json_add_string "success" "speedtest is started"
+                                       json_dump
+                               fi
+                       ;;
+               esac
+       ;;
+esac
diff --git a/plugins/juci-diagnostics/ubus/speedtest b/plugins/juci-diagnostics/ubus/speedtest
deleted file mode 100755 (executable)
index cc65bd9..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-#!/bin/sh
-
-. /usr/share/libubox/jshn.sh
-
-case "$1" in
-       list)
-               echo '{ "run" : {"testmode":"str","packetsize":32,"address":"str","port":32} }'
-       ;;
-       call)
-               case "$2" in
-                       run)
-                               if pidof tptest-run >/dev/null; then
-                                       json_init
-                                       json_add_string "error" "there is already a speedtest going on"
-                                       json_dump
-                               else
-                                       read input
-                                       tptest-run "$input" >/dev/null 2>&1 &
-                                       json_init
-                                       json_add_string "success" "speedtest is started"
-                                       json_dump
-                               fi
-                       ;;
-               esac
-       ;;
-esac
diff --git a/plugins/juci-firewall-fw3/ubus/firewall b/plugins/juci-firewall-fw3/ubus/firewall
deleted file mode 100755 (executable)
index 8f7f5c0..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-#!/bin/sh
-
-. /usr/share/libubox/jshn.sh
-
-case "$1" in
-       list)
-               echo '{ "excluded_ports" : {} }'
-       ;;
-       call)
-               case "$2" in
-                       excluded_ports)
-                               json_init
-                               json_add_string result "$(cat /tmp/fw_used_ports 2>/dev/null)"
-                               json_dump
-                       ;;
-               esac
-       ;;
-esac
diff --git a/plugins/juci-firewall-fw3/ubus/juci.firewall b/plugins/juci-firewall-fw3/ubus/juci.firewall
new file mode 100755 (executable)
index 0000000..8f7f5c0
--- /dev/null
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+. /usr/share/libubox/jshn.sh
+
+case "$1" in
+       list)
+               echo '{ "excluded_ports" : {} }'
+       ;;
+       call)
+               case "$2" in
+                       excluded_ports)
+                               json_init
+                               json_add_string result "$(cat /tmp/fw_used_ports 2>/dev/null)"
+                               json_dump
+                       ;;
+               esac
+       ;;
+esac
diff --git a/plugins/juci-inteno-provisioning/ubus/iup b/plugins/juci-inteno-provisioning/ubus/iup
deleted file mode 100755 (executable)
index ff6c208..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-#!/bin/sh
-
-. /usr/share/libubox/jshn.sh
-
-case "$1" in
-       list)
-               echo '{ "backup" : {"filename":"str"} }'
-       ;;
-       call)
-               case "$2" in
-                       backup)
-                               read input
-
-                               json_load "$input"
-                               json_get_var filename filename
-
-                               if [ -n "$filename" ]; then
-                                       filename="/tmp/$filename"
-                               else
-                                       filename="/tmp/iup-backup.tmp"
-                               fi
-                               
-                               json_init
-                               json_add_string stdout "$(sysupgrade -u $filename)"
-                               json_dump
-                       ;;
-               esac
-       ;;
-esac
diff --git a/plugins/juci-inteno-provisioning/ubus/juci.iup b/plugins/juci-inteno-provisioning/ubus/juci.iup
new file mode 100755 (executable)
index 0000000..ff6c208
--- /dev/null
@@ -0,0 +1,29 @@
+#!/bin/sh
+
+. /usr/share/libubox/jshn.sh
+
+case "$1" in
+       list)
+               echo '{ "backup" : {"filename":"str"} }'
+       ;;
+       call)
+               case "$2" in
+                       backup)
+                               read input
+
+                               json_load "$input"
+                               json_get_var filename filename
+
+                               if [ -n "$filename" ]; then
+                                       filename="/tmp/$filename"
+                               else
+                                       filename="/tmp/iup-backup.tmp"
+                               fi
+                               
+                               json_init
+                               json_add_string stdout "$(sysupgrade -u $filename)"
+                               json_dump
+                       ;;
+               esac
+       ;;
+esac
diff --git a/plugins/juci-minidlna/ubus/juci.minidlna b/plugins/juci-minidlna/ubus/juci.minidlna
new file mode 100755 (executable)
index 0000000..c04803b
--- /dev/null
@@ -0,0 +1,26 @@
+#!/bin/sh
+
+. /usr/share/libubox/jshn.sh
+
+case "$1" in
+       list)
+               echo '{ "status" : {} }'
+       ;;
+       call)
+               case "$2" in
+                       status)
+                               info="$(cat /tmp/minidlna.status 2>/dev/null)"
+                               image=$(echo $info | awk -F[\ ,:] '{print$6}')
+                               audio=$(echo $info | awk -F[\ ,:] '{print$2}')
+                               video=$(echo $info | awk -F[\ ,:] '{print$4}')
+
+                               json_init
+                               json_add_object count
+                               json_add_int audio $audio
+                               json_add_int video $video
+                               json_add_int image $image
+                               json_dump
+                       ;;
+               esac
+       ;;
+esac
diff --git a/plugins/juci-minidlna/ubus/minidlna b/plugins/juci-minidlna/ubus/minidlna
deleted file mode 100755 (executable)
index c04803b..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-#!/bin/sh
-
-. /usr/share/libubox/jshn.sh
-
-case "$1" in
-       list)
-               echo '{ "status" : {} }'
-       ;;
-       call)
-               case "$2" in
-                       status)
-                               info="$(cat /tmp/minidlna.status 2>/dev/null)"
-                               image=$(echo $info | awk -F[\ ,:] '{print$6}')
-                               audio=$(echo $info | awk -F[\ ,:] '{print$2}')
-                               video=$(echo $info | awk -F[\ ,:] '{print$4}')
-
-                               json_init
-                               json_add_object count
-                               json_add_int audio $audio
-                               json_add_int video $video
-                               json_add_int image $image
-                               json_dump
-                       ;;
-               esac
-       ;;
-esac
diff --git a/plugins/juci-mod-system/ubus/juci.service b/plugins/juci-mod-system/ubus/juci.service
new file mode 100755 (executable)
index 0000000..3a0ed6e
--- /dev/null
@@ -0,0 +1,74 @@
+#!/bin/sh
+
+. /usr/share/libubox/jshn.sh
+
+service_list() {
+       ubus call service list
+}
+
+handle_service() {
+       local action=$1
+       local service=$2
+
+       json_init
+       if [ -f /etc/init.d/$service ]; then
+               /etc/init.d/$service $action >/dev/null 2>&1 &
+               json_add_string success "$name $action"
+       else
+               json_add_string error "Invalid service!"
+       fi
+       json_dump
+}
+
+service_status() {
+       ubus call service list
+}
+
+case "$1" in
+       list)
+               echo '{ "list" : {}, "start" : {"name":"str"}, "stop" : {"name":"str"}, "enable" : {"name":"str"}, "disable" : {"name":"str"}, "reload" : {"name":"str"}, "restart" : {"name":"str"}, "status" : {"name":"str"} }'
+       ;;
+       call)
+               case "$2" in
+                       list)
+                               local enabled=0
+                               local running=0
+                               local start=0
+
+                               json_init
+                               json_add_array "services"
+                               for serv in $(ls /etc/init.d/); do
+                                       running=$(ubus -t 1 call service list "{'name':'$serv'}" | grep running | grep -q true && echo 1 || echo 0)
+                                       ls /etc/rc.d/S*$serv >/dev/null 2>&1 && enabled=1 || enabled=0
+                                       start=$(ls /etc/rc.d/S*$serv 2>/dev/null | awk -F"$serv" '{print$1}' | cut -d'S' -f2)
+                                       json_add_object ""
+                                       json_add_string name $serv
+                                       json_add_boolean enabled $enabled
+                                       json_add_boolean running $running
+                                       json_add_int start $start
+                                       json_select ..
+                               done
+                               json_dump
+                       ;;
+                       start|stop|enable|disable|reload|restart)
+                               read input
+                               json_load "$input"
+                               json_get_var name name
+                               [ -n "$name" ] && handle_service $2 $name
+                       ;;
+                       status)
+                               local running=0
+
+                               read input
+                               json_load "$input"
+                               json_get_var name name
+
+                               running=$(ubus -t 1 call service list "{'name':'$name'}" | grep running | grep -q true && echo 1 || echo 0)
+                               json_init
+                               json_add_boolean running $running
+                               json_dump
+                       ;;
+               esac
+       ;;
+esac
+
diff --git a/plugins/juci-mod-system/ubus/juci.system b/plugins/juci-mod-system/ubus/juci.system
new file mode 100755 (executable)
index 0000000..cfd0622
--- /dev/null
@@ -0,0 +1,438 @@
+#!/bin/sh
+
+. /usr/share/libubox/jshn.sh
+
+populate_timezones() {
+cat >> /tmp/timezones <<EOF
+{
+       "zones": {
+               "UTC" : "UTC",
+               "Africa/Abidjan" : "GMT0",
+               "Africa/Accra" : "GMT0",
+               "Africa/Addis Ababa" : "EAT-3",
+               "Africa/Algiers" : "CET-1",
+               "Africa/Asmara" : "EAT-3",
+               "Africa/Bamako" : "GMT0",
+               "Africa/Bangui" : "WAT-1",
+               "Africa/Banjul" : "GMT0",
+               "Africa/Bissau" : "GMT0",
+               "Africa/Blantyre" : "CAT-2",
+               "Africa/Brazzaville" : "WAT-1",
+               "Africa/Bujumbura" : "CAT-2",
+               "Africa/Casablanca" : "WET0",
+               "Africa/Ceuta" : "CET-1CEST,M3.5.0,M10.5.0/3",
+               "Africa/Conakry" : "GMT0",
+               "Africa/Dakar" : "GMT0",
+               "Africa/Dar es Salaam" : "EAT-3",
+               "Africa/Djibouti" : "EAT-3",
+               "Africa/Douala" : "WAT-1",
+               "Africa/El Aaiun" : "WET0",
+               "Africa/Freetown" : "GMT0",
+               "Africa/Gaborone" : "CAT-2",
+               "Africa/Harare" : "CAT-2",
+               "Africa/Johannesburg" : "SAST-2",
+               "Africa/Kampala" : "EAT-3",
+               "Africa/Khartoum" : "EAT-3",
+               "Africa/Kigali" : "CAT-2",
+               "Africa/Kinshasa" : "WAT-1",
+               "Africa/Lagos" : "WAT-1",
+               "Africa/Libreville" : "WAT-1",
+               "Africa/Lome" : "GMT0",
+               "Africa/Luanda" : "WAT-1",
+               "Africa/Lubumbashi" : "CAT-2",
+               "Africa/Lusaka" : "CAT-2",
+               "Africa/Malabo" : "WAT-1",
+               "Africa/Maputo" : "CAT-2",
+               "Africa/Maseru" : "SAST-2",
+               "Africa/Mbabane" : "SAST-2",
+               "Africa/Mogadishu" : "EAT-3",
+               "Africa/Monrovia" : "GMT0",
+               "Africa/Nairobi" : "EAT-3",
+               "Africa/Ndjamena" : "WAT-1",
+               "Africa/Niamey" : "WAT-1",
+               "Africa/Nouakchott" : "GMT0",
+               "Africa/Ouagadougou" : "GMT0",
+               "Africa/Porto-Novo" : "WAT-1",
+               "Africa/Sao Tome" : "GMT0",
+               "Africa/Tripoli" : "EET-2",
+               "Africa/Tunis" : "CET-1",
+               "Africa/Windhoek" : "WAT-1WAST,M9.1.0,M4.1.0",
+               "America/Adak" : "HAST10HADT,M3.2.0,M11.1.0",
+               "America/Anchorage" : "AKST9AKDT,M3.2.0,M11.1.0",
+               "America/Anguilla" : "AST4",
+               "America/Antigua" : "AST4",
+               "America/Araguaina" : "BRT3",
+               "America/Argentina/Buenos Aires" : "ART3",
+               "America/Argentina/Catamarca" : "ART3",
+               "America/Argentina/Cordoba" : "ART3",
+               "America/Argentina/Jujuy" : "ART3",
+               "America/Argentina/La Rioja" : "ART3",
+               "America/Argentina/Mendoza" : "ART3",
+               "America/Argentina/Rio Gallegos" : "ART3",
+               "America/Argentina/Salta" : "ART3",
+               "America/Argentina/San Juan" : "ART3",
+               "America/Argentina/Tucuman" : "ART3",
+               "America/Argentina/Ushuaia" : "ART3",
+               "America/Aruba" : "AST4",
+               "America/Asuncion" : "PYT4PYST,M10.1.0/0,M4.2.0/0",
+               "America/Atikokan" : "EST5",
+               "America/Bahia" : "BRT3",
+               "America/Barbados" : "AST4",
+               "America/Belem" : "BRT3",
+               "America/Belize" : "CST6",
+               "America/Blanc-Sablon" : "AST4",
+               "America/Boa Vista" : "AMT4",
+               "America/Bogota" : "COT5",
+               "America/Boise" : "MST7MDT,M3.2.0,M11.1.0",
+               "America/Cambridge Bay" : "MST7MDT,M3.2.0,M11.1.0",
+               "America/Campo Grande" : "AMT4AMST,M10.3.0/0,M2.3.0/0",
+               "America/Cancun" : "CST6CDT,M4.1.0,M10.5.0",
+               "America/Caracas" : "VET4:30",
+               "America/Cayenne" : "GFT3",
+               "America/Cayman" : "EST5",
+               "America/Chicago" : "CST6CDT,M3.2.0,M11.1.0",
+               "America/Chihuahua" : "MST7MDT,M4.1.0,M10.5.0",
+               "America/Costa Rica" : "CST6",
+               "America/Cuiaba" : "AMT4AMST,M10.3.0/0,M2.3.0/0",
+               "America/Curacao" : "AST4",
+               "America/Danmarkshavn" : "GMT0",
+               "America/Dawson" : "PST8PDT,M3.2.0,M11.1.0",
+               "America/Dawson Creek" : "MST7",
+               "America/Denver" : "MST7MDT,M3.2.0,M11.1.0",
+               "America/Detroit" : "EST5EDT,M3.2.0,M11.1.0",
+               "America/Dominica" : "AST4",
+               "America/Edmonton" : "MST7MDT,M3.2.0,M11.1.0",
+               "America/Eirunepe" : "AMT4",
+               "America/El Salvador" : "CST6",
+               "America/Fortaleza" : "BRT3",
+               "America/Glace Bay" : "AST4ADT,M3.2.0,M11.1.0",
+               "America/Goose Bay" : "AST4ADT,M3.2.0/0:01,M11.1.0/0:01",
+               "America/Grand Turk" : "EST5EDT,M3.2.0,M11.1.0",
+               "America/Grenada" : "AST4",
+               "America/Guadeloupe" : "AST4",
+               "America/Guatemala" : "CST6",
+               "America/Guayaquil" : "ECT5",
+               "America/Guyana" : "GYT4",
+               "America/Halifax" : "AST4ADT,M3.2.0,M11.1.0",
+               "America/Havana" : "CST5CDT,M3.2.0/0,M10.5.0/1",
+               "America/Hermosillo" : "MST7",
+               "America/Indiana/Indianapolis" : "EST5EDT,M3.2.0,M11.1.0",
+               "America/Indiana/Knox" : "CST6CDT,M3.2.0,M11.1.0",
+               "America/Indiana/Marengo" : "EST5EDT,M3.2.0,M11.1.0",
+               "America/Indiana/Petersburg" : "EST5EDT,M3.2.0,M11.1.0",
+               "America/Indiana/Tell City" : "CST6CDT,M3.2.0,M11.1.0",
+               "America/Indiana/Vevay" : "EST5EDT,M3.2.0,M11.1.0",
+               "America/Indiana/Vincennes" : "EST5EDT,M3.2.0,M11.1.0",
+               "America/Indiana/Winamac" : "EST5EDT,M3.2.0,M11.1.0",
+               "America/Inuvik" : "MST7MDT,M3.2.0,M11.1.0",
+               "America/Iqaluit" : "EST5EDT,M3.2.0,M11.1.0",
+               "America/Jamaica" : "EST5",
+               "America/Juneau" : "AKST9AKDT,M3.2.0,M11.1.0",
+               "America/Kentucky/Louisville" : "EST5EDT,M3.2.0,M11.1.0",
+               "America/Kentucky/Monticello" : "EST5EDT,M3.2.0,M11.1.0",
+               "America/La Paz" : "BOT4",
+               "America/Lima" : "PET5",
+               "America/Los Angeles" : "PST8PDT,M3.2.0,M11.1.0",
+               "America/Maceio" : "BRT3",
+               "America/Managua" : "CST6",
+               "America/Manaus" : "AMT4",
+               "America/Marigot" : "AST4",
+               "America/Martinique" : "AST4",
+               "America/Matamoros" : "CST6CDT,M3.2.0,M11.1.0",
+               "America/Mazatlan" : "MST7MDT,M4.1.0,M10.5.0",
+               "America/Menominee" : "CST6CDT,M3.2.0,M11.1.0",
+               "America/Merida" : "CST6CDT,M4.1.0,M10.5.0",
+               "America/Mexico City" : "CST6CDT,M4.1.0,M10.5.0",
+               "America/Miquelon" : "PMST3PMDT,M3.2.0,M11.1.0",
+               "America/Moncton" : "AST4ADT,M3.2.0,M11.1.0",
+               "America/Monterrey" : "CST6CDT,M4.1.0,M10.5.0",
+               "America/Montevideo" : "UYT3UYST,M10.1.0,M3.2.0",
+               "America/Montreal" : "EST5EDT,M3.2.0,M11.1.0",
+               "America/Montserrat" : "AST4",
+               "America/Nassau" : "EST5EDT,M3.2.0,M11.1.0",
+               "America/New York" : "EST5EDT,M3.2.0,M11.1.0",
+               "America/Nipigon" : "EST5EDT,M3.2.0,M11.1.0",
+               "America/Nome" : "AKST9AKDT,M3.2.0,M11.1.0",
+               "America/Noronha" : "FNT2",
+               "America/North Dakota/Center" : "CST6CDT,M3.2.0,M11.1.0",
+               "America/North Dakota/New Salem" : "CST6CDT,M3.2.0,M11.1.0",
+               "America/Ojinaga" : "MST7MDT,M3.2.0,M11.1.0",
+               "America/Panama" : "EST5",
+               "America/Pangnirtung" : "EST5EDT,M3.2.0,M11.1.0",
+               "America/Paramaribo" : "SRT3",
+               "America/Phoenix" : "MST7",
+               "America/Port of Spain" : "AST4",
+               "America/Port-au-Prince" : "EST5",
+               "America/Porto Velho" : "AMT4",
+               "America/Puerto Rico" : "AST4",
+               "America/Rainy River" : "CST6CDT,M3.2.0,M11.1.0",
+               "America/Rankin Inlet" : "CST6CDT,M3.2.0,M11.1.0",
+               "America/Recife" : "BRT3",
+               "America/Regina" : "CST6",
+               "America/Rio Branco" : "AMT4",
+               "America/Santa Isabel" : "PST8PDT,M4.1.0,M10.5.0",
+               "America/Santarem" : "BRT3",
+               "America/Santo Domingo" : "AST4",
+               "America/Sao Paulo" : "BRT3BRST,M10.3.0/0,M2.3.0/0",
+               "America/Scoresbysund" : "EGT1EGST,M3.5.0/0,M10.5.0/1",
+               "America/Shiprock" : "MST7MDT,M3.2.0,M11.1.0",
+               "America/St Barthelemy" : "AST4",
+               "America/St Johns" : "NST3:30NDT,M3.2.0/0:01,M11.1.0/0:01",
+               "America/St Kitts" : "AST4",
+               "America/St Lucia" : "AST4",
+               "America/St Thomas" : "AST4",
+               "America/St Vincent" : "AST4",
+               "America/Swift Current" : "CST6",
+               "America/Tegucigalpa" : "CST6",
+               "America/Thule" : "AST4ADT,M3.2.0,M11.1.0",
+               "America/Thunder Bay" : "EST5EDT,M3.2.0,M11.1.0",
+               "America/Tijuana" : "PST8PDT,M3.2.0,M11.1.0",
+               "America/Toronto" : "EST5EDT,M3.2.0,M11.1.0",
+               "America/Tortola" : "AST4",
+               "America/Vancouver" : "PST8PDT,M3.2.0,M11.1.0",
+               "America/Whitehorse" : "PST8PDT,M3.2.0,M11.1.0",
+               "America/Winnipeg" : "CST6CDT,M3.2.0,M11.1.0",
+               "America/Yakutat" : "AKST9AKDT,M3.2.0,M11.1.0",
+               "America/Yellowknife" : "MST7MDT,M3.2.0,M11.1.0",
+               "Antarctica/Casey" : "WST-8",
+               "Antarctica/Davis" : "DAVT-7",
+               "Antarctica/DumontDUrville" : "DDUT-10",
+               "Antarctica/Macquarie" : "MIST-11",
+               "Antarctica/Mawson" : "MAWT-5",
+               "Antarctica/McMurdo" : "NZST-12NZDT,M9.5.0,M4.1.0/3",
+               "Antarctica/Rothera" : "ROTT3",
+               "Antarctica/South Pole" : "NZST-12NZDT,M9.5.0,M4.1.0/3",
+               "Antarctica/Syowa" : "SYOT-3",
+               "Antarctica/Vostok" : "VOST-6",
+               "Arctic/Longyearbyen" : "CET-1CEST,M3.5.0,M10.5.0/3",
+               "Asia/Aden" : "AST-3",
+               "Asia/Almaty" : "ALMT-6",
+               "Asia/Anadyr" : "ANAT-11ANAST,M3.5.0,M10.5.0/3",
+               "Asia/Aqtau" : "AQTT-5",
+               "Asia/Aqtobe" : "AQTT-5",
+               "Asia/Ashgabat" : "TMT-5",
+               "Asia/Baghdad" : "AST-3",
+               "Asia/Bahrain" : "AST-3",
+               "Asia/Baku" : "AZT-4AZST,M3.5.0/4,M10.5.0/5",
+               "Asia/Bangkok" : "ICT-7",
+               "Asia/Beirut" : "EET-2EEST,M3.5.0/0,M10.5.0/0",
+               "Asia/Bishkek" : "KGT-6",
+               "Asia/Brunei" : "BNT-8",
+               "Asia/Choibalsan" : "CHOT-8",
+               "Asia/Chongqing" : "CST-8",
+               "Asia/Colombo" : "IST-5:30",
+               "Asia/Damascus" : "EET-2EEST,M4.1.5/0,M10.5.5/0",
+               "Asia/Dhaka" : "BDT-6",
+               "Asia/Dili" : "TLT-9",
+               "Asia/Dubai" : "GST-4",
+               "Asia/Dushanbe" : "TJT-5",
+               "Asia/Gaza" : "EET-2EEST,M3.5.6/0:01,M9.1.5",
+               "Asia/Harbin" : "CST-8",
+               "Asia/Ho Chi Minh" : "ICT-7",
+               "Asia/Hong Kong" : "HKT-8",
+               "Asia/Hovd" : "HOVT-7",
+               "Asia/Irkutsk" : "IRKT-8IRKST,M3.5.0,M10.5.0/3",
+               "Asia/Jakarta" : "WIT-7",
+               "Asia/Jayapura" : "EIT-9",
+               "Asia/Kabul" : "AFT-4:30",
+               "Asia/Kamchatka" : "PETT-11PETST,M3.5.0,M10.5.0/3",
+               "Asia/Karachi" : "PKT-5",
+               "Asia/Kashgar" : "CST-8",
+               "Asia/Kathmandu" : "NPT-5:45",
+               "Asia/Kolkata" : "IST-5:30",
+               "Asia/Krasnoyarsk" : "KRAT-7KRAST,M3.5.0,M10.5.0/3",
+               "Asia/Kuala Lumpur" : "MYT-8",
+               "Asia/Kuching" : "MYT-8",
+               "Asia/Kuwait" : "AST-3",
+               "Asia/Macau" : "CST-8",
+               "Asia/Magadan" : "MAGT-11MAGST,M3.5.0,M10.5.0/3",
+               "Asia/Makassar" : "CIT-8",
+               "Asia/Manila" : "PHT-8",
+               "Asia/Muscat" : "GST-4",
+               "Asia/Nicosia" : "EET-2EEST,M3.5.0/3,M10.5.0/4",
+               "Asia/Novokuznetsk" : "NOVT-6NOVST,M3.5.0,M10.5.0/3",
+               "Asia/Novosibirsk" : "NOVT-6NOVST,M3.5.0,M10.5.0/3",
+               "Asia/Omsk" : "OMST-7",
+               "Asia/Oral" : "ORAT-5",
+               "Asia/Phnom Penh" : "ICT-7",
+               "Asia/Pontianak" : "WIT-7",
+               "Asia/Pyongyang" : "KST-9",
+               "Asia/Qatar" : "AST-3",
+               "Asia/Qyzylorda" : "QYZT-6",
+               "Asia/Rangoon" : "MMT-6:30",
+               "Asia/Riyadh" : "AST-3",
+               "Asia/Sakhalin" : "SAKT-10SAKST,M3.5.0,M10.5.0/3",
+               "Asia/Samarkand" : "UZT-5",
+               "Asia/Seoul" : "KST-9",
+               "Asia/Shanghai" : "CST-8",
+               "Asia/Singapore" : "SGT-8",
+               "Asia/Taipei" : "CST-8",
+               "Asia/Tashkent" : "UZT-5",
+               "Asia/Tbilisi" : "GET-4",
+               "Asia/Tehran" : "IRST-3:30IRDT,80/0,264/0",
+               "Asia/Thimphu" : "BTT-6",
+               "Asia/Tokyo" : "JST-9",
+               "Asia/Ulaanbaatar" : "ULAT-8",
+               "Asia/Urumqi" : "CST-8",
+               "Asia/Vientiane" : "ICT-7",
+               "Asia/Vladivostok" : "VLAT-10VLAST,M3.5.0,M10.5.0/3",
+               "Asia/Yakutsk" : "YAKT-9YAKST,M3.5.0,M10.5.0/3",
+               "Asia/Yekaterinburg" : "YEKT-5YEKST,M3.5.0,M10.5.0/3",
+               "Asia/Yerevan" : "AMT-4AMST,M3.5.0,M10.5.0/3",
+               "Atlantic/Azores" : "AZOT1AZOST,M3.5.0/0,M10.5.0/1",
+               "Atlantic/Bermuda" : "AST4ADT,M3.2.0,M11.1.0",
+               "Atlantic/Canary" : "WET0WEST,M3.5.0/1,M10.5.0",
+               "Atlantic/Cape Verde" : "CVT1",
+               "Atlantic/Faroe" : "WET0WEST,M3.5.0/1,M10.5.0",
+               "Atlantic/Madeira" : "WET0WEST,M3.5.0/1,M10.5.0",
+               "Atlantic/Reykjavik" : "GMT0",
+               "Atlantic/South Georgia" : "GST2",
+               "Atlantic/St Helena" : "GMT0",
+               "Atlantic/Stanley" : "FKT4FKST,M9.1.0,M4.3.0",
+               "Australia/Adelaide" : "CST-9:30CST,M10.1.0,M4.1.0/3",
+               "Australia/Brisbane" : "EST-10",
+               "Australia/Broken Hill" : "CST-9:30CST,M10.1.0,M4.1.0/3",
+               "Australia/Currie" : "EST-10EST,M10.1.0,M4.1.0/3",
+               "Australia/Darwin" : "CST-9:30",
+               "Australia/Eucla" : "CWST-8:45",
+               "Australia/Hobart" : "EST-10EST,M10.1.0,M4.1.0/3",
+               "Australia/Lindeman" : "EST-10",
+               "Australia/Lord Howe" : "LHST-10:30LHST-11,M10.1.0,M4.1.0",
+               "Australia/Melbourne" : "EST-10EST,M10.1.0,M4.1.0/3",
+               "Australia/Perth" : "WST-8",
+               "Australia/Sydney" : "EST-10EST,M10.1.0,M4.1.0/3",
+               "Europe/Amsterdam" : "CET-1CEST,M3.5.0,M10.5.0/3",
+               "Europe/Andorra" : "CET-1CEST,M3.5.0,M10.5.0/3",
+               "Europe/Athens" : "EET-2EEST,M3.5.0/3,M10.5.0/4",
+               "Europe/Belgrade" : "CET-1CEST,M3.5.0,M10.5.0/3",
+               "Europe/Berlin" : "CET-1CEST,M3.5.0,M10.5.0/3",
+               "Europe/Bratislava" : "CET-1CEST,M3.5.0,M10.5.0/3",
+               "Europe/Brussels" : "CET-1CEST,M3.5.0,M10.5.0/3",
+               "Europe/Bucharest" : "EET-2EEST,M3.5.0/3,M10.5.0/4",
+               "Europe/Budapest" : "CET-1CEST,M3.5.0,M10.5.0/3",
+               "Europe/Chisinau" : "EET-2EEST,M3.5.0/3,M10.5.0/4",
+               "Europe/Copenhagen" : "CET-1CEST,M3.5.0,M10.5.0/3",
+               "Europe/Dublin" : "GMT0IST,M3.5.0/1,M10.5.0",
+               "Europe/Gibraltar" : "CET-1CEST,M3.5.0,M10.5.0/3",
+               "Europe/Guernsey" : "GMT0BST,M3.5.0/1,M10.5.0",
+               "Europe/Helsinki" : "EET-2EEST,M3.5.0/3,M10.5.0/4",
+               "Europe/Isle of Man" : "GMT0BST,M3.5.0/1,M10.5.0",
+               "Europe/Istanbul" : "EET-2EEST,M3.5.0/3,M10.5.0/4",
+               "Europe/Jersey" : "GMT0BST,M3.5.0/1,M10.5.0",
+               "Europe/Kaliningrad" : "EET-2EEST,M3.5.0,M10.5.0/3",
+               "Europe/Kiev" : "EET-2EEST,M3.5.0/3,M10.5.0/4",
+               "Europe/Lisbon" : "WET0WEST,M3.5.0/1,M10.5.0",
+               "Europe/Ljubljana" : "CET-1CEST,M3.5.0,M10.5.0/3",
+               "Europe/London" : "GMT0BST,M3.5.0/1,M10.5.0",
+               "Europe/Luxembourg" : "CET-1CEST,M3.5.0,M10.5.0/3",
+               "Europe/Madrid" : "CET-1CEST,M3.5.0,M10.5.0/3",
+               "Europe/Malta" : "CET-1CEST,M3.5.0,M10.5.0/3",
+               "Europe/Mariehamn" : "EET-2EEST,M3.5.0/3,M10.5.0/4",
+               "Europe/Minsk" : "EET-2EEST,M3.5.0,M10.5.0/3",
+               "Europe/Monaco" : "CET-1CEST,M3.5.0,M10.5.0/3",
+               "Europe/Moscow" : "MSK-4",
+               "Europe/Oslo" : "CET-1CEST,M3.5.0,M10.5.0/3",
+               "Europe/Paris" : "CET-1CEST,M3.5.0,M10.5.0/3",
+               "Europe/Podgorica" : "CET-1CEST,M3.5.0,M10.5.0/3",
+               "Europe/Prague" : "CET-1CEST,M3.5.0,M10.5.0/3",
+               "Europe/Riga" : "EET-2EEST,M3.5.0/3,M10.5.0/4",
+               "Europe/Rome" : "CET-1CEST,M3.5.0,M10.5.0/3",
+               "Europe/Samara" : "SAMT-3SAMST,M3.5.0,M10.5.0/3",
+               "Europe/San Marino" : "CET-1CEST,M3.5.0,M10.5.0/3",
+               "Europe/Sarajevo" : "CET-1CEST,M3.5.0,M10.5.0/3",
+               "Europe/Simferopol" : "EET-2EEST,M3.5.0/3,M10.5.0/4",
+               "Europe/Skopje" : "CET-1CEST,M3.5.0,M10.5.0/3",
+               "Europe/Sofia" : "EET-2EEST,M3.5.0/3,M10.5.0/4",
+               "Europe/Stockholm" : "CET-1CEST,M3.5.0,M10.5.0/3",
+               "Europe/Tallinn" : "EET-2EEST,M3.5.0/3,M10.5.0/4",
+               "Europe/Tirane" : "CET-1CEST,M3.5.0,M10.5.0/3",
+               "Europe/Uzhgorod" : "EET-2EEST,M3.5.0/3,M10.5.0/4",
+               "Europe/Vaduz" : "CET-1CEST,M3.5.0,M10.5.0/3",
+               "Europe/Vatican" : "CET-1CEST,M3.5.0,M10.5.0/3",
+               "Europe/Vienna" : "CET-1CEST,M3.5.0,M10.5.0/3",
+               "Europe/Vilnius" : "EET-2EEST,M3.5.0/3,M10.5.0/4",
+               "Europe/Volgograd" : "VOLT-3VOLST,M3.5.0,M10.5.0/3",
+               "Europe/Warsaw" : "CET-1CEST,M3.5.0,M10.5.0/3",
+               "Europe/Zagreb" : "CET-1CEST,M3.5.0,M10.5.0/3",
+               "Europe/Zaporozhye" : "EET-2EEST,M3.5.0/3,M10.5.0/4",
+               "Europe/Zurich" : "CET-1CEST,M3.5.0,M10.5.0/3",
+               "Indian/Antananarivo" : "EAT-3",
+               "Indian/Chagos" : "IOT-6",
+               "Indian/Christmas" : "CXT-7",
+               "Indian/Cocos" : "CCT-6:30",
+               "Indian/Comoro" : "EAT-3",
+               "Indian/Kerguelen" : "TFT-5",
+               "Indian/Mahe" : "SCT-4",
+               "Indian/Maldives" : "MVT-5",
+               "Indian/Mauritius" : "MUT-4",
+               "Indian/Mayotte" : "EAT-3",
+               "Indian/Reunion" : "RET-4",
+               "Pacific/Apia" : "WST11",
+               "Pacific/Auckland" : "NZST-12NZDT,M9.5.0,M4.1.0/3",
+               "Pacific/Chatham" : "CHAST-12:45CHADT,M9.5.0/2:45,M4.1.0/3:45",
+               "Pacific/Efate" : "VUT-11",
+               "Pacific/Enderbury" : "PHOT-13",
+               "Pacific/Fakaofo" : "TKT10",
+               "Pacific/Fiji" : "FJT-12",
+               "Pacific/Funafuti" : "TVT-12",
+               "Pacific/Galapagos" : "GALT6",
+               "Pacific/Gambier" : "GAMT9",
+               "Pacific/Guadalcanal" : "SBT-11",
+               "Pacific/Guam" : "ChST-10",
+               "Pacific/Honolulu" : "HST10",
+               "Pacific/Johnston" : "HST10",
+               "Pacific/Kiritimati" : "LINT-14",
+               "Pacific/Kosrae" : "KOST-11",
+               "Pacific/Kwajalein" : "MHT-12",
+               "Pacific/Majuro" : "MHT-12",
+               "Pacific/Marquesas" : "MART9:30",
+               "Pacific/Midway" : "SST11",
+               "Pacific/Nauru" : "NRT-12",
+               "Pacific/Niue" : "NUT11",
+               "Pacific/Norfolk" : "NFT-11:30",
+               "Pacific/Noumea" : "NCT-11",
+               "Pacific/Pago Pago" : "SST11",
+               "Pacific/Palau" : "PWT-9",
+               "Pacific/Pitcairn" : "PST8",
+               "Pacific/Ponape" : "PONT-11",
+               "Pacific/Port Moresby" : "PGT-10",
+               "Pacific/Rarotonga" : "CKT10",
+               "Pacific/Saipan" : "ChST-10",
+               "Pacific/Tahiti" : "TAHT10",
+               "Pacific/Tarawa" : "GILT-12",
+               "Pacific/Tongatapu" : "TOT-13",
+               "Pacific/Truk" : "TRUT-10",
+               "Pacific/Wake" : "WAKT-12",
+               "Pacific/Wallis" : "WFT-12"
+       }
+}
+EOF
+}
+
+case "$1" in
+       list)
+               echo '{ "defaultreset" : {}, "reboot" : {}, "zonelist" : {} }'
+       ;;
+       call)
+               case "$2" in
+                       defaultreset)
+                               ubus send defaultreset 2>/dev/null
+                               /sbin/defaultreset >/dev/null 2>&1 &
+                               json_init
+                               json_add_string "success" "defaultreset"
+                               json_dump
+                       ;;
+                       reboot)
+                               /sbin/reboot >/dev/null 2>&1 &
+                               json_init
+                               json_add_string "success" "reboot"
+                               json_dump
+                       ;;
+                       zonelist)
+                               [ -f /tmp/timezones ] || populate_timezones
+                               [ -f /tmp/timezones ] && cat /tmp/timezones
+                       ;;
+               esac
+       ;;
+esac
+
diff --git a/plugins/juci-mod-system/ubus/service b/plugins/juci-mod-system/ubus/service
deleted file mode 100755 (executable)
index 3a0ed6e..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-#!/bin/sh
-
-. /usr/share/libubox/jshn.sh
-
-service_list() {
-       ubus call service list
-}
-
-handle_service() {
-       local action=$1
-       local service=$2
-
-       json_init
-       if [ -f /etc/init.d/$service ]; then
-               /etc/init.d/$service $action >/dev/null 2>&1 &
-               json_add_string success "$name $action"
-       else
-               json_add_string error "Invalid service!"
-       fi
-       json_dump
-}
-
-service_status() {
-       ubus call service list
-}
-
-case "$1" in
-       list)
-               echo '{ "list" : {}, "start" : {"name":"str"}, "stop" : {"name":"str"}, "enable" : {"name":"str"}, "disable" : {"name":"str"}, "reload" : {"name":"str"}, "restart" : {"name":"str"}, "status" : {"name":"str"} }'
-       ;;
-       call)
-               case "$2" in
-                       list)
-                               local enabled=0
-                               local running=0
-                               local start=0
-
-                               json_init
-                               json_add_array "services"
-                               for serv in $(ls /etc/init.d/); do
-                                       running=$(ubus -t 1 call service list "{'name':'$serv'}" | grep running | grep -q true && echo 1 || echo 0)
-                                       ls /etc/rc.d/S*$serv >/dev/null 2>&1 && enabled=1 || enabled=0
-                                       start=$(ls /etc/rc.d/S*$serv 2>/dev/null | awk -F"$serv" '{print$1}' | cut -d'S' -f2)
-                                       json_add_object ""
-                                       json_add_string name $serv
-                                       json_add_boolean enabled $enabled
-                                       json_add_boolean running $running
-                                       json_add_int start $start
-                                       json_select ..
-                               done
-                               json_dump
-                       ;;
-                       start|stop|enable|disable|reload|restart)
-                               read input
-                               json_load "$input"
-                               json_get_var name name
-                               [ -n "$name" ] && handle_service $2 $name
-                       ;;
-                       status)
-                               local running=0
-
-                               read input
-                               json_load "$input"
-                               json_get_var name name
-
-                               running=$(ubus -t 1 call service list "{'name':'$name'}" | grep running | grep -q true && echo 1 || echo 0)
-                               json_init
-                               json_add_boolean running $running
-                               json_dump
-                       ;;
-               esac
-       ;;
-esac
-
diff --git a/plugins/juci-mod-system/ubus/system b/plugins/juci-mod-system/ubus/system
deleted file mode 100755 (executable)
index cfd0622..0000000
+++ /dev/null
@@ -1,438 +0,0 @@
-#!/bin/sh
-
-. /usr/share/libubox/jshn.sh
-
-populate_timezones() {
-cat >> /tmp/timezones <<EOF
-{
-       "zones": {
-               "UTC" : "UTC",
-               "Africa/Abidjan" : "GMT0",
-               "Africa/Accra" : "GMT0",
-               "Africa/Addis Ababa" : "EAT-3",
-               "Africa/Algiers" : "CET-1",
-               "Africa/Asmara" : "EAT-3",
-               "Africa/Bamako" : "GMT0",
-               "Africa/Bangui" : "WAT-1",
-               "Africa/Banjul" : "GMT0",
-               "Africa/Bissau" : "GMT0",
-               "Africa/Blantyre" : "CAT-2",
-               "Africa/Brazzaville" : "WAT-1",
-               "Africa/Bujumbura" : "CAT-2",
-               "Africa/Casablanca" : "WET0",
-               "Africa/Ceuta" : "CET-1CEST,M3.5.0,M10.5.0/3",
-               "Africa/Conakry" : "GMT0",
-               "Africa/Dakar" : "GMT0",
-               "Africa/Dar es Salaam" : "EAT-3",
-               "Africa/Djibouti" : "EAT-3",
-               "Africa/Douala" : "WAT-1",
-               "Africa/El Aaiun" : "WET0",
-               "Africa/Freetown" : "GMT0",
-               "Africa/Gaborone" : "CAT-2",
-               "Africa/Harare" : "CAT-2",
-               "Africa/Johannesburg" : "SAST-2",
-               "Africa/Kampala" : "EAT-3",
-               "Africa/Khartoum" : "EAT-3",
-               "Africa/Kigali" : "CAT-2",
-               "Africa/Kinshasa" : "WAT-1",
-               "Africa/Lagos" : "WAT-1",
-               "Africa/Libreville" : "WAT-1",
-               "Africa/Lome" : "GMT0",
-               "Africa/Luanda" : "WAT-1",
-               "Africa/Lubumbashi" : "CAT-2",
-               "Africa/Lusaka" : "CAT-2",
-               "Africa/Malabo" : "WAT-1",
-               "Africa/Maputo" : "CAT-2",
-               "Africa/Maseru" : "SAST-2",
-               "Africa/Mbabane" : "SAST-2",
-               "Africa/Mogadishu" : "EAT-3",
-               "Africa/Monrovia" : "GMT0",
-               "Africa/Nairobi" : "EAT-3",
-               "Africa/Ndjamena" : "WAT-1",
-               "Africa/Niamey" : "WAT-1",
-               "Africa/Nouakchott" : "GMT0",
-               "Africa/Ouagadougou" : "GMT0",
-               "Africa/Porto-Novo" : "WAT-1",
-               "Africa/Sao Tome" : "GMT0",
-               "Africa/Tripoli" : "EET-2",
-               "Africa/Tunis" : "CET-1",
-               "Africa/Windhoek" : "WAT-1WAST,M9.1.0,M4.1.0",
-               "America/Adak" : "HAST10HADT,M3.2.0,M11.1.0",
-               "America/Anchorage" : "AKST9AKDT,M3.2.0,M11.1.0",
-               "America/Anguilla" : "AST4",
-               "America/Antigua" : "AST4",
-               "America/Araguaina" : "BRT3",
-               "America/Argentina/Buenos Aires" : "ART3",
-               "America/Argentina/Catamarca" : "ART3",
-               "America/Argentina/Cordoba" : "ART3",
-               "America/Argentina/Jujuy" : "ART3",
-               "America/Argentina/La Rioja" : "ART3",
-               "America/Argentina/Mendoza" : "ART3",
-               "America/Argentina/Rio Gallegos" : "ART3",
-               "America/Argentina/Salta" : "ART3",
-               "America/Argentina/San Juan" : "ART3",
-               "America/Argentina/Tucuman" : "ART3",
-               "America/Argentina/Ushuaia" : "ART3",
-               "America/Aruba" : "AST4",
-               "America/Asuncion" : "PYT4PYST,M10.1.0/0,M4.2.0/0",
-               "America/Atikokan" : "EST5",
-               "America/Bahia" : "BRT3",
-               "America/Barbados" : "AST4",
-               "America/Belem" : "BRT3",
-               "America/Belize" : "CST6",
-               "America/Blanc-Sablon" : "AST4",
-               "America/Boa Vista" : "AMT4",
-               "America/Bogota" : "COT5",
-               "America/Boise" : "MST7MDT,M3.2.0,M11.1.0",
-               "America/Cambridge Bay" : "MST7MDT,M3.2.0,M11.1.0",
-               "America/Campo Grande" : "AMT4AMST,M10.3.0/0,M2.3.0/0",
-               "America/Cancun" : "CST6CDT,M4.1.0,M10.5.0",
-               "America/Caracas" : "VET4:30",
-               "America/Cayenne" : "GFT3",
-               "America/Cayman" : "EST5",
-               "America/Chicago" : "CST6CDT,M3.2.0,M11.1.0",
-               "America/Chihuahua" : "MST7MDT,M4.1.0,M10.5.0",
-               "America/Costa Rica" : "CST6",
-               "America/Cuiaba" : "AMT4AMST,M10.3.0/0,M2.3.0/0",
-               "America/Curacao" : "AST4",
-               "America/Danmarkshavn" : "GMT0",
-               "America/Dawson" : "PST8PDT,M3.2.0,M11.1.0",
-               "America/Dawson Creek" : "MST7",
-               "America/Denver" : "MST7MDT,M3.2.0,M11.1.0",
-               "America/Detroit" : "EST5EDT,M3.2.0,M11.1.0",
-               "America/Dominica" : "AST4",
-               "America/Edmonton" : "MST7MDT,M3.2.0,M11.1.0",
-               "America/Eirunepe" : "AMT4",
-               "America/El Salvador" : "CST6",
-               "America/Fortaleza" : "BRT3",
-               "America/Glace Bay" : "AST4ADT,M3.2.0,M11.1.0",
-               "America/Goose Bay" : "AST4ADT,M3.2.0/0:01,M11.1.0/0:01",
-               "America/Grand Turk" : "EST5EDT,M3.2.0,M11.1.0",
-               "America/Grenada" : "AST4",
-               "America/Guadeloupe" : "AST4",
-               "America/Guatemala" : "CST6",
-               "America/Guayaquil" : "ECT5",
-               "America/Guyana" : "GYT4",
-               "America/Halifax" : "AST4ADT,M3.2.0,M11.1.0",
-               "America/Havana" : "CST5CDT,M3.2.0/0,M10.5.0/1",
-               "America/Hermosillo" : "MST7",
-               "America/Indiana/Indianapolis" : "EST5EDT,M3.2.0,M11.1.0",
-               "America/Indiana/Knox" : "CST6CDT,M3.2.0,M11.1.0",
-               "America/Indiana/Marengo" : "EST5EDT,M3.2.0,M11.1.0",
-               "America/Indiana/Petersburg" : "EST5EDT,M3.2.0,M11.1.0",
-               "America/Indiana/Tell City" : "CST6CDT,M3.2.0,M11.1.0",
-               "America/Indiana/Vevay" : "EST5EDT,M3.2.0,M11.1.0",
-               "America/Indiana/Vincennes" : "EST5EDT,M3.2.0,M11.1.0",
-               "America/Indiana/Winamac" : "EST5EDT,M3.2.0,M11.1.0",
-               "America/Inuvik" : "MST7MDT,M3.2.0,M11.1.0",
-               "America/Iqaluit" : "EST5EDT,M3.2.0,M11.1.0",
-               "America/Jamaica" : "EST5",
-               "America/Juneau" : "AKST9AKDT,M3.2.0,M11.1.0",
-               "America/Kentucky/Louisville" : "EST5EDT,M3.2.0,M11.1.0",
-               "America/Kentucky/Monticello" : "EST5EDT,M3.2.0,M11.1.0",
-               "America/La Paz" : "BOT4",
-               "America/Lima" : "PET5",
-               "America/Los Angeles" : "PST8PDT,M3.2.0,M11.1.0",
-               "America/Maceio" : "BRT3",
-               "America/Managua" : "CST6",
-               "America/Manaus" : "AMT4",
-               "America/Marigot" : "AST4",
-               "America/Martinique" : "AST4",
-               "America/Matamoros" : "CST6CDT,M3.2.0,M11.1.0",
-               "America/Mazatlan" : "MST7MDT,M4.1.0,M10.5.0",
-               "America/Menominee" : "CST6CDT,M3.2.0,M11.1.0",
-               "America/Merida" : "CST6CDT,M4.1.0,M10.5.0",
-               "America/Mexico City" : "CST6CDT,M4.1.0,M10.5.0",
-               "America/Miquelon" : "PMST3PMDT,M3.2.0,M11.1.0",
-               "America/Moncton" : "AST4ADT,M3.2.0,M11.1.0",
-               "America/Monterrey" : "CST6CDT,M4.1.0,M10.5.0",
-               "America/Montevideo" : "UYT3UYST,M10.1.0,M3.2.0",
-               "America/Montreal" : "EST5EDT,M3.2.0,M11.1.0",
-               "America/Montserrat" : "AST4",
-               "America/Nassau" : "EST5EDT,M3.2.0,M11.1.0",
-               "America/New York" : "EST5EDT,M3.2.0,M11.1.0",
-               "America/Nipigon" : "EST5EDT,M3.2.0,M11.1.0",
-               "America/Nome" : "AKST9AKDT,M3.2.0,M11.1.0",
-               "America/Noronha" : "FNT2",
-               "America/North Dakota/Center" : "CST6CDT,M3.2.0,M11.1.0",
-               "America/North Dakota/New Salem" : "CST6CDT,M3.2.0,M11.1.0",
-               "America/Ojinaga" : "MST7MDT,M3.2.0,M11.1.0",
-               "America/Panama" : "EST5",
-               "America/Pangnirtung" : "EST5EDT,M3.2.0,M11.1.0",
-               "America/Paramaribo" : "SRT3",
-               "America/Phoenix" : "MST7",
-               "America/Port of Spain" : "AST4",
-               "America/Port-au-Prince" : "EST5",
-               "America/Porto Velho" : "AMT4",
-               "America/Puerto Rico" : "AST4",
-               "America/Rainy River" : "CST6CDT,M3.2.0,M11.1.0",
-               "America/Rankin Inlet" : "CST6CDT,M3.2.0,M11.1.0",
-               "America/Recife" : "BRT3",
-               "America/Regina" : "CST6",
-               "America/Rio Branco" : "AMT4",
-               "America/Santa Isabel" : "PST8PDT,M4.1.0,M10.5.0",
-               "America/Santarem" : "BRT3",
-               "America/Santo Domingo" : "AST4",
-               "America/Sao Paulo" : "BRT3BRST,M10.3.0/0,M2.3.0/0",
-               "America/Scoresbysund" : "EGT1EGST,M3.5.0/0,M10.5.0/1",
-               "America/Shiprock" : "MST7MDT,M3.2.0,M11.1.0",
-               "America/St Barthelemy" : "AST4",
-               "America/St Johns" : "NST3:30NDT,M3.2.0/0:01,M11.1.0/0:01",
-               "America/St Kitts" : "AST4",
-               "America/St Lucia" : "AST4",
-               "America/St Thomas" : "AST4",
-               "America/St Vincent" : "AST4",
-               "America/Swift Current" : "CST6",
-               "America/Tegucigalpa" : "CST6",
-               "America/Thule" : "AST4ADT,M3.2.0,M11.1.0",
-               "America/Thunder Bay" : "EST5EDT,M3.2.0,M11.1.0",
-               "America/Tijuana" : "PST8PDT,M3.2.0,M11.1.0",
-               "America/Toronto" : "EST5EDT,M3.2.0,M11.1.0",
-               "America/Tortola" : "AST4",
-               "America/Vancouver" : "PST8PDT,M3.2.0,M11.1.0",
-               "America/Whitehorse" : "PST8PDT,M3.2.0,M11.1.0",
-               "America/Winnipeg" : "CST6CDT,M3.2.0,M11.1.0",
-               "America/Yakutat" : "AKST9AKDT,M3.2.0,M11.1.0",
-               "America/Yellowknife" : "MST7MDT,M3.2.0,M11.1.0",
-               "Antarctica/Casey" : "WST-8",
-               "Antarctica/Davis" : "DAVT-7",
-               "Antarctica/DumontDUrville" : "DDUT-10",
-               "Antarctica/Macquarie" : "MIST-11",
-               "Antarctica/Mawson" : "MAWT-5",
-               "Antarctica/McMurdo" : "NZST-12NZDT,M9.5.0,M4.1.0/3",
-               "Antarctica/Rothera" : "ROTT3",
-               "Antarctica/South Pole" : "NZST-12NZDT,M9.5.0,M4.1.0/3",
-               "Antarctica/Syowa" : "SYOT-3",
-               "Antarctica/Vostok" : "VOST-6",
-               "Arctic/Longyearbyen" : "CET-1CEST,M3.5.0,M10.5.0/3",
-               "Asia/Aden" : "AST-3",
-               "Asia/Almaty" : "ALMT-6",
-               "Asia/Anadyr" : "ANAT-11ANAST,M3.5.0,M10.5.0/3",
-               "Asia/Aqtau" : "AQTT-5",
-               "Asia/Aqtobe" : "AQTT-5",
-               "Asia/Ashgabat" : "TMT-5",
-               "Asia/Baghdad" : "AST-3",
-               "Asia/Bahrain" : "AST-3",
-               "Asia/Baku" : "AZT-4AZST,M3.5.0/4,M10.5.0/5",
-               "Asia/Bangkok" : "ICT-7",
-               "Asia/Beirut" : "EET-2EEST,M3.5.0/0,M10.5.0/0",
-               "Asia/Bishkek" : "KGT-6",
-               "Asia/Brunei" : "BNT-8",
-               "Asia/Choibalsan" : "CHOT-8",
-               "Asia/Chongqing" : "CST-8",
-               "Asia/Colombo" : "IST-5:30",
-               "Asia/Damascus" : "EET-2EEST,M4.1.5/0,M10.5.5/0",
-               "Asia/Dhaka" : "BDT-6",
-               "Asia/Dili" : "TLT-9",
-               "Asia/Dubai" : "GST-4",
-               "Asia/Dushanbe" : "TJT-5",
-               "Asia/Gaza" : "EET-2EEST,M3.5.6/0:01,M9.1.5",
-               "Asia/Harbin" : "CST-8",
-               "Asia/Ho Chi Minh" : "ICT-7",
-               "Asia/Hong Kong" : "HKT-8",
-               "Asia/Hovd" : "HOVT-7",
-               "Asia/Irkutsk" : "IRKT-8IRKST,M3.5.0,M10.5.0/3",
-               "Asia/Jakarta" : "WIT-7",
-               "Asia/Jayapura" : "EIT-9",
-               "Asia/Kabul" : "AFT-4:30",
-               "Asia/Kamchatka" : "PETT-11PETST,M3.5.0,M10.5.0/3",
-               "Asia/Karachi" : "PKT-5",
-               "Asia/Kashgar" : "CST-8",
-               "Asia/Kathmandu" : "NPT-5:45",
-               "Asia/Kolkata" : "IST-5:30",
-               "Asia/Krasnoyarsk" : "KRAT-7KRAST,M3.5.0,M10.5.0/3",
-               "Asia/Kuala Lumpur" : "MYT-8",
-               "Asia/Kuching" : "MYT-8",
-               "Asia/Kuwait" : "AST-3",
-               "Asia/Macau" : "CST-8",
-               "Asia/Magadan" : "MAGT-11MAGST,M3.5.0,M10.5.0/3",
-               "Asia/Makassar" : "CIT-8",
-               "Asia/Manila" : "PHT-8",
-               "Asia/Muscat" : "GST-4",
-               "Asia/Nicosia" : "EET-2EEST,M3.5.0/3,M10.5.0/4",
-               "Asia/Novokuznetsk" : "NOVT-6NOVST,M3.5.0,M10.5.0/3",
-               "Asia/Novosibirsk" : "NOVT-6NOVST,M3.5.0,M10.5.0/3",
-               "Asia/Omsk" : "OMST-7",
-               "Asia/Oral" : "ORAT-5",
-               "Asia/Phnom Penh" : "ICT-7",
-               "Asia/Pontianak" : "WIT-7",
-               "Asia/Pyongyang" : "KST-9",
-               "Asia/Qatar" : "AST-3",
-               "Asia/Qyzylorda" : "QYZT-6",
-               "Asia/Rangoon" : "MMT-6:30",
-               "Asia/Riyadh" : "AST-3",
-               "Asia/Sakhalin" : "SAKT-10SAKST,M3.5.0,M10.5.0/3",
-               "Asia/Samarkand" : "UZT-5",
-               "Asia/Seoul" : "KST-9",
-               "Asia/Shanghai" : "CST-8",
-               "Asia/Singapore" : "SGT-8",
-               "Asia/Taipei" : "CST-8",
-               "Asia/Tashkent" : "UZT-5",
-               "Asia/Tbilisi" : "GET-4",
-               "Asia/Tehran" : "IRST-3:30IRDT,80/0,264/0",
-               "Asia/Thimphu" : "BTT-6",
-               "Asia/Tokyo" : "JST-9",
-               "Asia/Ulaanbaatar" : "ULAT-8",
-               "Asia/Urumqi" : "CST-8",
-               "Asia/Vientiane" : "ICT-7",
-               "Asia/Vladivostok" : "VLAT-10VLAST,M3.5.0,M10.5.0/3",
-               "Asia/Yakutsk" : "YAKT-9YAKST,M3.5.0,M10.5.0/3",
-               "Asia/Yekaterinburg" : "YEKT-5YEKST,M3.5.0,M10.5.0/3",
-               "Asia/Yerevan" : "AMT-4AMST,M3.5.0,M10.5.0/3",
-               "Atlantic/Azores" : "AZOT1AZOST,M3.5.0/0,M10.5.0/1",
-               "Atlantic/Bermuda" : "AST4ADT,M3.2.0,M11.1.0",
-               "Atlantic/Canary" : "WET0WEST,M3.5.0/1,M10.5.0",
-               "Atlantic/Cape Verde" : "CVT1",
-               "Atlantic/Faroe" : "WET0WEST,M3.5.0/1,M10.5.0",
-               "Atlantic/Madeira" : "WET0WEST,M3.5.0/1,M10.5.0",
-               "Atlantic/Reykjavik" : "GMT0",
-               "Atlantic/South Georgia" : "GST2",
-               "Atlantic/St Helena" : "GMT0",
-               "Atlantic/Stanley" : "FKT4FKST,M9.1.0,M4.3.0",
-               "Australia/Adelaide" : "CST-9:30CST,M10.1.0,M4.1.0/3",
-               "Australia/Brisbane" : "EST-10",
-               "Australia/Broken Hill" : "CST-9:30CST,M10.1.0,M4.1.0/3",
-               "Australia/Currie" : "EST-10EST,M10.1.0,M4.1.0/3",
-               "Australia/Darwin" : "CST-9:30",
-               "Australia/Eucla" : "CWST-8:45",
-               "Australia/Hobart" : "EST-10EST,M10.1.0,M4.1.0/3",
-               "Australia/Lindeman" : "EST-10",
-               "Australia/Lord Howe" : "LHST-10:30LHST-11,M10.1.0,M4.1.0",
-               "Australia/Melbourne" : "EST-10EST,M10.1.0,M4.1.0/3",
-               "Australia/Perth" : "WST-8",
-               "Australia/Sydney" : "EST-10EST,M10.1.0,M4.1.0/3",
-               "Europe/Amsterdam" : "CET-1CEST,M3.5.0,M10.5.0/3",
-               "Europe/Andorra" : "CET-1CEST,M3.5.0,M10.5.0/3",
-               "Europe/Athens" : "EET-2EEST,M3.5.0/3,M10.5.0/4",
-               "Europe/Belgrade" : "CET-1CEST,M3.5.0,M10.5.0/3",
-               "Europe/Berlin" : "CET-1CEST,M3.5.0,M10.5.0/3",
-               "Europe/Bratislava" : "CET-1CEST,M3.5.0,M10.5.0/3",
-               "Europe/Brussels" : "CET-1CEST,M3.5.0,M10.5.0/3",
-               "Europe/Bucharest" : "EET-2EEST,M3.5.0/3,M10.5.0/4",
-               "Europe/Budapest" : "CET-1CEST,M3.5.0,M10.5.0/3",
-               "Europe/Chisinau" : "EET-2EEST,M3.5.0/3,M10.5.0/4",
-               "Europe/Copenhagen" : "CET-1CEST,M3.5.0,M10.5.0/3",
-               "Europe/Dublin" : "GMT0IST,M3.5.0/1,M10.5.0",
-               "Europe/Gibraltar" : "CET-1CEST,M3.5.0,M10.5.0/3",
-               "Europe/Guernsey" : "GMT0BST,M3.5.0/1,M10.5.0",
-               "Europe/Helsinki" : "EET-2EEST,M3.5.0/3,M10.5.0/4",
-               "Europe/Isle of Man" : "GMT0BST,M3.5.0/1,M10.5.0",
-               "Europe/Istanbul" : "EET-2EEST,M3.5.0/3,M10.5.0/4",
-               "Europe/Jersey" : "GMT0BST,M3.5.0/1,M10.5.0",
-               "Europe/Kaliningrad" : "EET-2EEST,M3.5.0,M10.5.0/3",
-               "Europe/Kiev" : "EET-2EEST,M3.5.0/3,M10.5.0/4",
-               "Europe/Lisbon" : "WET0WEST,M3.5.0/1,M10.5.0",
-               "Europe/Ljubljana" : "CET-1CEST,M3.5.0,M10.5.0/3",
-               "Europe/London" : "GMT0BST,M3.5.0/1,M10.5.0",
-               "Europe/Luxembourg" : "CET-1CEST,M3.5.0,M10.5.0/3",
-               "Europe/Madrid" : "CET-1CEST,M3.5.0,M10.5.0/3",
-               "Europe/Malta" : "CET-1CEST,M3.5.0,M10.5.0/3",
-               "Europe/Mariehamn" : "EET-2EEST,M3.5.0/3,M10.5.0/4",
-               "Europe/Minsk" : "EET-2EEST,M3.5.0,M10.5.0/3",
-               "Europe/Monaco" : "CET-1CEST,M3.5.0,M10.5.0/3",
-               "Europe/Moscow" : "MSK-4",
-               "Europe/Oslo" : "CET-1CEST,M3.5.0,M10.5.0/3",
-               "Europe/Paris" : "CET-1CEST,M3.5.0,M10.5.0/3",
-               "Europe/Podgorica" : "CET-1CEST,M3.5.0,M10.5.0/3",
-               "Europe/Prague" : "CET-1CEST,M3.5.0,M10.5.0/3",
-               "Europe/Riga" : "EET-2EEST,M3.5.0/3,M10.5.0/4",
-               "Europe/Rome" : "CET-1CEST,M3.5.0,M10.5.0/3",
-               "Europe/Samara" : "SAMT-3SAMST,M3.5.0,M10.5.0/3",
-               "Europe/San Marino" : "CET-1CEST,M3.5.0,M10.5.0/3",
-               "Europe/Sarajevo" : "CET-1CEST,M3.5.0,M10.5.0/3",
-               "Europe/Simferopol" : "EET-2EEST,M3.5.0/3,M10.5.0/4",
-               "Europe/Skopje" : "CET-1CEST,M3.5.0,M10.5.0/3",
-               "Europe/Sofia" : "EET-2EEST,M3.5.0/3,M10.5.0/4",
-               "Europe/Stockholm" : "CET-1CEST,M3.5.0,M10.5.0/3",
-               "Europe/Tallinn" : "EET-2EEST,M3.5.0/3,M10.5.0/4",
-               "Europe/Tirane" : "CET-1CEST,M3.5.0,M10.5.0/3",
-               "Europe/Uzhgorod" : "EET-2EEST,M3.5.0/3,M10.5.0/4",
-               "Europe/Vaduz" : "CET-1CEST,M3.5.0,M10.5.0/3",
-               "Europe/Vatican" : "CET-1CEST,M3.5.0,M10.5.0/3",
-               "Europe/Vienna" : "CET-1CEST,M3.5.0,M10.5.0/3",
-               "Europe/Vilnius" : "EET-2EEST,M3.5.0/3,M10.5.0/4",
-               "Europe/Volgograd" : "VOLT-3VOLST,M3.5.0,M10.5.0/3",
-               "Europe/Warsaw" : "CET-1CEST,M3.5.0,M10.5.0/3",
-               "Europe/Zagreb" : "CET-1CEST,M3.5.0,M10.5.0/3",
-               "Europe/Zaporozhye" : "EET-2EEST,M3.5.0/3,M10.5.0/4",
-               "Europe/Zurich" : "CET-1CEST,M3.5.0,M10.5.0/3",
-               "Indian/Antananarivo" : "EAT-3",
-               "Indian/Chagos" : "IOT-6",
-               "Indian/Christmas" : "CXT-7",
-               "Indian/Cocos" : "CCT-6:30",
-               "Indian/Comoro" : "EAT-3",
-               "Indian/Kerguelen" : "TFT-5",
-               "Indian/Mahe" : "SCT-4",
-               "Indian/Maldives" : "MVT-5",
-               "Indian/Mauritius" : "MUT-4",
-               "Indian/Mayotte" : "EAT-3",
-               "Indian/Reunion" : "RET-4",
-               "Pacific/Apia" : "WST11",
-               "Pacific/Auckland" : "NZST-12NZDT,M9.5.0,M4.1.0/3",
-               "Pacific/Chatham" : "CHAST-12:45CHADT,M9.5.0/2:45,M4.1.0/3:45",
-               "Pacific/Efate" : "VUT-11",
-               "Pacific/Enderbury" : "PHOT-13",
-               "Pacific/Fakaofo" : "TKT10",
-               "Pacific/Fiji" : "FJT-12",
-               "Pacific/Funafuti" : "TVT-12",
-               "Pacific/Galapagos" : "GALT6",
-               "Pacific/Gambier" : "GAMT9",
-               "Pacific/Guadalcanal" : "SBT-11",
-               "Pacific/Guam" : "ChST-10",
-               "Pacific/Honolulu" : "HST10",
-               "Pacific/Johnston" : "HST10",
-               "Pacific/Kiritimati" : "LINT-14",
-               "Pacific/Kosrae" : "KOST-11",
-               "Pacific/Kwajalein" : "MHT-12",
-               "Pacific/Majuro" : "MHT-12",
-               "Pacific/Marquesas" : "MART9:30",
-               "Pacific/Midway" : "SST11",
-               "Pacific/Nauru" : "NRT-12",
-               "Pacific/Niue" : "NUT11",
-               "Pacific/Norfolk" : "NFT-11:30",
-               "Pacific/Noumea" : "NCT-11",
-               "Pacific/Pago Pago" : "SST11",
-               "Pacific/Palau" : "PWT-9",
-               "Pacific/Pitcairn" : "PST8",
-               "Pacific/Ponape" : "PONT-11",
-               "Pacific/Port Moresby" : "PGT-10",
-               "Pacific/Rarotonga" : "CKT10",
-               "Pacific/Saipan" : "ChST-10",
-               "Pacific/Tahiti" : "TAHT10",
-               "Pacific/Tarawa" : "GILT-12",
-               "Pacific/Tongatapu" : "TOT-13",
-               "Pacific/Truk" : "TRUT-10",
-               "Pacific/Wake" : "WAKT-12",
-               "Pacific/Wallis" : "WFT-12"
-       }
-}
-EOF
-}
-
-case "$1" in
-       list)
-               echo '{ "defaultreset" : {}, "reboot" : {}, "zonelist" : {} }'
-       ;;
-       call)
-               case "$2" in
-                       defaultreset)
-                               ubus send defaultreset 2>/dev/null
-                               /sbin/defaultreset >/dev/null 2>&1 &
-                               json_init
-                               json_add_string "success" "defaultreset"
-                               json_dump
-                       ;;
-                       reboot)
-                               /sbin/reboot >/dev/null 2>&1 &
-                               json_init
-                               json_add_string "success" "reboot"
-                               json_dump
-                       ;;
-                       zonelist)
-                               [ -f /tmp/timezones ] || populate_timezones
-                               [ -f /tmp/timezones ] && cat /tmp/timezones
-                       ;;
-               esac
-       ;;
-esac
-
diff --git a/plugins/juci-network-netifd/ubus/juci.modems b/plugins/juci-network-netifd/ubus/juci.modems
new file mode 100755 (executable)
index 0000000..4f1e48b
--- /dev/null
@@ -0,0 +1,23 @@
+#!/bin/sh
+
+. /usr/share/libubox/jshn.sh
+
+case "$1" in
+       list)
+               echo '{ "list" : {} }'
+       ;;
+       call)
+               case "$2" in
+                       list)
+                               modems="$(ls /dev/tty[S,USB,ACM]*)"
+
+                               json_init
+                               json_add_array "modems"
+                               for mdm in $modems; do
+                                       json_add_string "" "$mdm"
+                               done
+                               json_dump
+                       ;;
+               esac
+       ;;
+esac
diff --git a/plugins/juci-network-netifd/ubus/juci.network b/plugins/juci-network-netifd/ubus/juci.network
new file mode 100755 (executable)
index 0000000..d6f907e
--- /dev/null
@@ -0,0 +1,160 @@
+#!/bin/sh
+
+. /usr/share/libubox/jshn.sh
+
+case "$1" in
+       list)
+               echo '{ "arp" : {}, "ipv4routes" : {}, "ipv6routes" : {}, "ipv6neigh" : {}, "load" : {}, "nameservers" : {}, "nat_table" : {}, "protocols" : {}, "services" : {} }'
+       ;;
+       call)
+               case "$2" in
+                       arp)
+                               local arpfile=/tmp/arptable
+                               cat /proc/net/arp | tail -n +2 | tr '*' '-' > $arpfile
+                               json_init
+                               json_add_array "clients"
+                               while read -r line
+                               do
+                                       json_add_object ""
+                                       json_add_string ipaddr "$(echo $line | awk '{print$1}')"
+                                       json_add_string hw "$(echo $line | awk '{print$2}')"
+                                       json_add_string flags "$(echo $line | awk '{print$3}')"
+                                       json_add_string macaddr "$(echo $line | awk '{print$4}')"
+                                       json_add_string mask "$(echo $line | awk '{print$5}' | tr '-' '*')"
+                                       json_add_string device "$(echo $line | awk '{print$6}')"
+                                       json_select ..
+                               done < $arpfile
+                               rm -f $arpfile
+                               json_dump
+                       ;;
+                       ipv4routes)
+                               local routesfile=/tmp/ipv4routes
+                               route -n | tail -n +3 > $routesfile
+                               json_init
+                               json_add_array "routes"
+                               while read -r line
+                               do
+                                       json_add_object ""
+                                       json_add_string destination "$(echo $line | awk '{print$1}')"
+                                       json_add_string gateway "$(echo $line | awk '{print$2}')"
+                                       json_add_string mask "$(echo $line | awk '{print$3}')"
+                                       json_add_string flags "$(echo $line | awk '{print$4}')"
+                                       json_add_string metric "$(echo $line | awk '{print$5}')"
+                                       json_add_string ref "$(echo $line | awk '{print$6}')"
+                                       json_add_string use "$(echo $line | awk '{print$7}')"
+                                       json_add_string iface "$(echo $line | awk '{print$8}')"
+                                       json_select ..
+                               done < $routesfile
+                               rm -f $routesfile
+                               json_dump
+                       ;;
+                       ipv6routes)
+                               local routes6file=/tmp/ipv6routes
+                               route -A inet6 | tail -n +3 > $routes6file
+                               json_init
+                               json_add_array "routes"
+                               while read -r line
+                               do
+                                       json_add_object ""
+                                       json_add_string destination "$(echo $line | awk '{print$1}')"
+                                       json_add_string next_hop "$(echo $line | awk '{print$2}')"
+                                       json_add_string flags "$(echo $line | awk '{print$3}')"
+                                       json_add_string metric "$(echo $line | awk '{print$4}')"
+                                       json_add_string ref "$(echo $line | awk '{print$5}')"
+                                       json_add_string use "$(echo $line | awk '{print$6}')"
+                                       json_add_string iface "$(echo $line | awk '{print$7}')"
+                                       json_select ..
+                               done < $routes6file
+                               rm -f $routes6file
+                               json_dump
+                       ;;
+                       ipv6neigh)
+                               local neigh6file=/tmp/ipv6neigh
+                               ip -6 neigh > $neigh6file
+                               json_init
+                               json_add_array "neighbors"
+                               while read -r line
+                               do
+                                       json_add_object ""
+                                       json_add_string ip6addr "$(echo $line | awk '{print$1}')"
+                                       json_add_string device "$(echo $line | awk '{print$3}')"
+                                       json_add_string macaddr "$(echo $line | awk '{print$5}')"
+                                       router=$(echo $line | awk '{print$6}' | grep -q router && echo 1 || echo 0)
+                                       json_add_boolean router $router
+                                       if [ $router -eq 1 ]; then
+                                               json_add_string ip6status "$(echo $line | awk '{print$7}')"
+                                       else
+                                               json_add_string ip6status "$(echo $line | awk '{print$6}')"
+                                       fi
+                                       json_select ..
+                               done < $neigh6file
+                               rm -f $neigh6file
+                               json_dump                               
+                       ;;
+                       load)
+                               json_init 
+                               json_add_int "active_connections" $(cat /proc/sys/net/netfilter/nf_conntrack_count)
+                               json_add_int "max_connections" $(cat /proc/sys/net/netfilter/nf_conntrack_max)
+                               json_dump
+                       ;;
+                       nameservers)
+                               json_init 
+                               json_add_array "nameservers"; 
+                               for ns in `awk '/nameserver/{print $2}' /var/resolv.conf.auto`; do
+                                       json_add_string "" $ns; 
+                               done
+                               json_close_array
+                               json_dump
+                       ;;
+                       nat_table)
+                               local nattable=/tmp/nattable
+                               cat /proc/net/ip_conntrack | grep tcp > $nattable
+                               json_init
+                               json_add_array "table"
+                               while read -r line
+                               do
+                                       json_add_object ""
+                                       json_add_string proto "$(echo $line | awk '{print$1}')"
+                                       json_add_string state "$(echo $line | awk '{print$4}')"
+                                       json_add_string local_ip "$(echo $line | awk '{print$9}')"
+                                       json_add_string remote_ip "$(echo $line | awk '{print$10}')"
+                                       json_add_string local_port "$(echo $line | awk '{print$11}')"
+                                       json_add_string remote_port "$(echo $line | awk '{print$12}')"
+                                       json_select ..
+                               done < $nattable
+                               rm -f $nattable
+                               json_dump
+                       ;;
+                       protocols)
+                               json_init
+                               json_add_array "protocols"
+                               for p in $(grep -roh 'proto_\(.*\)_init' /lib/netifd/proto/ | sed -e 's|proto_\(.*\)_init|\1|g'); do
+                                       json_add_string "" $p
+                               done
+                               json_dump
+                       ;;
+                       services)
+                               local netstatlist=/tmp/netstatlist
+                               netstat -plan | grep -w LISTEN | tr -d '*' > $netstatlist
+                               json_init
+                               json_add_array "list"
+                               while read -r line
+                               do
+                                       json_add_object ""
+                                       json_add_string proto "$(echo $line | awk '{print$1}')"
+                                       lip="$(echo $line | awk '{print$4}')"
+                                       lport="$(echo $line | awk '{print$4}' | awk -F':' '{print$NF}')"
+                                       lip=${lip%:$lport}
+                                       json_add_string listen_ip $lip
+                                       json_add_string listen_port $lport
+                                       json_add_string state "$(echo $line | awk '{print$6}')"
+                                       json_add_string pid "$(echo $line | awk '{print$7}' | cut -d'/' -f1)"
+                                       json_add_string name "$(echo $line | awk '{print$7}' | cut -d'/' -f2)"
+                                       json_select ..
+                               done < $netstatlist
+                               rm -f $netstatlist
+                               json_dump
+                       ;;
+               esac
+       ;;
+esac
diff --git a/plugins/juci-network-netifd/ubus/modems b/plugins/juci-network-netifd/ubus/modems
deleted file mode 100755 (executable)
index 4f1e48b..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-#!/bin/sh
-
-. /usr/share/libubox/jshn.sh
-
-case "$1" in
-       list)
-               echo '{ "list" : {} }'
-       ;;
-       call)
-               case "$2" in
-                       list)
-                               modems="$(ls /dev/tty[S,USB,ACM]*)"
-
-                               json_init
-                               json_add_array "modems"
-                               for mdm in $modems; do
-                                       json_add_string "" "$mdm"
-                               done
-                               json_dump
-                       ;;
-               esac
-       ;;
-esac
diff --git a/plugins/juci-network-netifd/ubus/network b/plugins/juci-network-netifd/ubus/network
deleted file mode 100755 (executable)
index d6f907e..0000000
+++ /dev/null
@@ -1,160 +0,0 @@
-#!/bin/sh
-
-. /usr/share/libubox/jshn.sh
-
-case "$1" in
-       list)
-               echo '{ "arp" : {}, "ipv4routes" : {}, "ipv6routes" : {}, "ipv6neigh" : {}, "load" : {}, "nameservers" : {}, "nat_table" : {}, "protocols" : {}, "services" : {} }'
-       ;;
-       call)
-               case "$2" in
-                       arp)
-                               local arpfile=/tmp/arptable
-                               cat /proc/net/arp | tail -n +2 | tr '*' '-' > $arpfile
-                               json_init
-                               json_add_array "clients"
-                               while read -r line
-                               do
-                                       json_add_object ""
-                                       json_add_string ipaddr "$(echo $line | awk '{print$1}')"
-                                       json_add_string hw "$(echo $line | awk '{print$2}')"
-                                       json_add_string flags "$(echo $line | awk '{print$3}')"
-                                       json_add_string macaddr "$(echo $line | awk '{print$4}')"
-                                       json_add_string mask "$(echo $line | awk '{print$5}' | tr '-' '*')"
-                                       json_add_string device "$(echo $line | awk '{print$6}')"
-                                       json_select ..
-                               done < $arpfile
-                               rm -f $arpfile
-                               json_dump
-                       ;;
-                       ipv4routes)
-                               local routesfile=/tmp/ipv4routes
-                               route -n | tail -n +3 > $routesfile
-                               json_init
-                               json_add_array "routes"
-                               while read -r line
-                               do
-                                       json_add_object ""
-                                       json_add_string destination "$(echo $line | awk '{print$1}')"
-                                       json_add_string gateway "$(echo $line | awk '{print$2}')"
-                                       json_add_string mask "$(echo $line | awk '{print$3}')"
-                                       json_add_string flags "$(echo $line | awk '{print$4}')"
-                                       json_add_string metric "$(echo $line | awk '{print$5}')"
-                                       json_add_string ref "$(echo $line | awk '{print$6}')"
-                                       json_add_string use "$(echo $line | awk '{print$7}')"
-                                       json_add_string iface "$(echo $line | awk '{print$8}')"
-                                       json_select ..
-                               done < $routesfile
-                               rm -f $routesfile
-                               json_dump
-                       ;;
-                       ipv6routes)
-                               local routes6file=/tmp/ipv6routes
-                               route -A inet6 | tail -n +3 > $routes6file
-                               json_init
-                               json_add_array "routes"
-                               while read -r line
-                               do
-                                       json_add_object ""
-                                       json_add_string destination "$(echo $line | awk '{print$1}')"
-                                       json_add_string next_hop "$(echo $line | awk '{print$2}')"
-                                       json_add_string flags "$(echo $line | awk '{print$3}')"
-                                       json_add_string metric "$(echo $line | awk '{print$4}')"
-                                       json_add_string ref "$(echo $line | awk '{print$5}')"
-                                       json_add_string use "$(echo $line | awk '{print$6}')"
-                                       json_add_string iface "$(echo $line | awk '{print$7}')"
-                                       json_select ..
-                               done < $routes6file
-                               rm -f $routes6file
-                               json_dump
-                       ;;
-                       ipv6neigh)
-                               local neigh6file=/tmp/ipv6neigh
-                               ip -6 neigh > $neigh6file
-                               json_init
-                               json_add_array "neighbors"
-                               while read -r line
-                               do
-                                       json_add_object ""
-                                       json_add_string ip6addr "$(echo $line | awk '{print$1}')"
-                                       json_add_string device "$(echo $line | awk '{print$3}')"
-                                       json_add_string macaddr "$(echo $line | awk '{print$5}')"
-                                       router=$(echo $line | awk '{print$6}' | grep -q router && echo 1 || echo 0)
-                                       json_add_boolean router $router
-                                       if [ $router -eq 1 ]; then
-                                               json_add_string ip6status "$(echo $line | awk '{print$7}')"
-                                       else
-                                               json_add_string ip6status "$(echo $line | awk '{print$6}')"
-                                       fi
-                                       json_select ..
-                               done < $neigh6file
-                               rm -f $neigh6file
-                               json_dump                               
-                       ;;
-                       load)
-                               json_init 
-                               json_add_int "active_connections" $(cat /proc/sys/net/netfilter/nf_conntrack_count)
-                               json_add_int "max_connections" $(cat /proc/sys/net/netfilter/nf_conntrack_max)
-                               json_dump
-                       ;;
-                       nameservers)
-                               json_init 
-                               json_add_array "nameservers"; 
-                               for ns in `awk '/nameserver/{print $2}' /var/resolv.conf.auto`; do
-                                       json_add_string "" $ns; 
-                               done
-                               json_close_array
-                               json_dump
-                       ;;
-                       nat_table)
-                               local nattable=/tmp/nattable
-                               cat /proc/net/ip_conntrack | grep tcp > $nattable
-                               json_init
-                               json_add_array "table"
-                               while read -r line
-                               do
-                                       json_add_object ""
-                                       json_add_string proto "$(echo $line | awk '{print$1}')"
-                                       json_add_string state "$(echo $line | awk '{print$4}')"
-                                       json_add_string local_ip "$(echo $line | awk '{print$9}')"
-                                       json_add_string remote_ip "$(echo $line | awk '{print$10}')"
-                                       json_add_string local_port "$(echo $line | awk '{print$11}')"
-                                       json_add_string remote_port "$(echo $line | awk '{print$12}')"
-                                       json_select ..
-                               done < $nattable
-                               rm -f $nattable
-                               json_dump
-                       ;;
-                       protocols)
-                               json_init
-                               json_add_array "protocols"
-                               for p in $(grep -roh 'proto_\(.*\)_init' /lib/netifd/proto/ | sed -e 's|proto_\(.*\)_init|\1|g'); do
-                                       json_add_string "" $p
-                               done
-                               json_dump
-                       ;;
-                       services)
-                               local netstatlist=/tmp/netstatlist
-                               netstat -plan | grep -w LISTEN | tr -d '*' > $netstatlist
-                               json_init
-                               json_add_array "list"
-                               while read -r line
-                               do
-                                       json_add_object ""
-                                       json_add_string proto "$(echo $line | awk '{print$1}')"
-                                       lip="$(echo $line | awk '{print$4}')"
-                                       lport="$(echo $line | awk '{print$4}' | awk -F':' '{print$NF}')"
-                                       lip=${lip%:$lport}
-                                       json_add_string listen_ip $lip
-                                       json_add_string listen_port $lport
-                                       json_add_string state "$(echo $line | awk '{print$6}')"
-                                       json_add_string pid "$(echo $line | awk '{print$7}' | cut -d'/' -f1)"
-                                       json_add_string name "$(echo $line | awk '{print$7}' | cut -d'/' -f2)"
-                                       json_select ..
-                               done < $netstatlist
-                               rm -f $netstatlist
-                               json_dump
-                       ;;
-               esac
-       ;;
-esac
diff --git a/plugins/juci-sysupgrade/ubus/juci.sysupgrade b/plugins/juci-sysupgrade/ubus/juci.sysupgrade
new file mode 100755 (executable)
index 0000000..1c53807
--- /dev/null
@@ -0,0 +1,114 @@
+#!/bin/sh
+
+#juci.system.conf
+#      features
+#      restore
+#juci.system.upgrade
+#      check
+#      start
+
+. /usr/share/libubox/jshn.sh
+
+case "$1" in
+       list)
+               echo '{ "clean":{}, "test":{"path":"str"}, "start":{"path":"str","keep":32}, "check":{"type":"str"}, "create-backup":{"pass":"str"}, "restore-backup":{"pass":"str"}, "features":{} }'
+       ;;
+       call)
+               case "$2" in
+                       features)
+                               json_init
+                               json_add_boolean comment 0
+                               if [ -n "$(openssl version 2>/dev/null)" ]; then
+                                       json_add_boolean encryption 1
+                               else
+                                       json_add_boolean encryption 0
+                               fi
+                               json_dump
+                       ;;
+                       create-backup)
+                               local output=""
+
+                               read input
+                               json_load "$input"
+                               json_get_var pass pass ""
+
+                               if [ -n "$pass" ]; then
+                                       output="$(sysupgrade --create-backup /tmp/backup.tar.gz -p $pass)"
+                               else
+                                       output="$(sysupgrade --create-backup /tmp/backup.tar.gz)"
+                               fi
+
+                               json_init
+                               json_add_string output "$output"
+                               json_dump                               
+                       ;;
+                       restore-backup)
+                               local error=""
+                               local stdout=""
+
+                               read input
+                               json_load "$input"
+                               json_get_var pass pass ""
+
+                               if [ -n "$pass" ]; then
+                                       decrypt="$(openssl des3 -d -in /tmp/backup.tar.gz -out /tmp/backup.tar.gz.dec -pass pass:$pass 2>/dev/null && echo OK)"
+                                       if [ "$decrypt" == "OK" ]; then
+                                               mv /tmp/backup.tar.gz.dec /tmp/backup.tar.gz
+                                               stdout="$(sysupgrade --restore-backup /tmp/backup.tar.gz)"
+                                       else
+                                               error="Invalid Password!"
+                                       fi
+                               else
+                                       result="$(sysupgrade --restore-backup /tmp/backup.tar.gz)"
+                                       if [ "result" == "" ]; then
+                                               stdout="$result"
+                                       else
+                                               error="$result"
+                                       fi
+                               fi
+
+                               json_init
+                               if [ -n "$stdout" ]; then
+                                       json_add_string stdout "$stdout"
+                               else
+                                       json_add_string error "$error"
+                               fi
+                               json_dump
+                       ;;
+                       check)
+                               read input
+                               json_load "$input"
+                               json_get_var type type
+
+
+                               json_init
+                               case "$type" in
+                                       online)
+                                               json_add_string online "$(sysupgrade --online 2>/dev/null)"
+                                       ;;
+                                       usb)
+                                               json_add_string usb "$(sysupgrade --usb 2>/dev/null)"
+                                       ;;
+                               esac
+
+                               json_dump
+                       ;;
+                       start)
+                               read input
+                               json_load "$input"
+                               json_get_var keep keep 1
+                               json_get_var path path "/tmp/firmware.bin"
+
+                               [ "$keep" == "1" ] && keep="" || keep="-n"
+                               sysupgrade $keep $path
+                       ;;
+                       test)
+                               read input
+                               json_load "$input"
+                               json_get_var path path "/tmp/firmware.bin"
+
+                               sysupgrade --test $path
+                       ;;
+               esac
+       ;;
+esac
diff --git a/plugins/juci-sysupgrade/ubus/sysupgrade b/plugins/juci-sysupgrade/ubus/sysupgrade
deleted file mode 100755 (executable)
index 1c53807..0000000
+++ /dev/null
@@ -1,114 +0,0 @@
-#!/bin/sh
-
-#juci.system.conf
-#      features
-#      restore
-#juci.system.upgrade
-#      check
-#      start
-
-. /usr/share/libubox/jshn.sh
-
-case "$1" in
-       list)
-               echo '{ "clean":{}, "test":{"path":"str"}, "start":{"path":"str","keep":32}, "check":{"type":"str"}, "create-backup":{"pass":"str"}, "restore-backup":{"pass":"str"}, "features":{} }'
-       ;;
-       call)
-               case "$2" in
-                       features)
-                               json_init
-                               json_add_boolean comment 0
-                               if [ -n "$(openssl version 2>/dev/null)" ]; then
-                                       json_add_boolean encryption 1
-                               else
-                                       json_add_boolean encryption 0
-                               fi
-                               json_dump
-                       ;;
-                       create-backup)
-                               local output=""
-
-                               read input
-                               json_load "$input"
-                               json_get_var pass pass ""
-
-                               if [ -n "$pass" ]; then
-                                       output="$(sysupgrade --create-backup /tmp/backup.tar.gz -p $pass)"
-                               else
-                                       output="$(sysupgrade --create-backup /tmp/backup.tar.gz)"
-                               fi
-
-                               json_init
-                               json_add_string output "$output"
-                               json_dump                               
-                       ;;
-                       restore-backup)
-                               local error=""
-                               local stdout=""
-
-                               read input
-                               json_load "$input"
-                               json_get_var pass pass ""
-
-                               if [ -n "$pass" ]; then
-                                       decrypt="$(openssl des3 -d -in /tmp/backup.tar.gz -out /tmp/backup.tar.gz.dec -pass pass:$pass 2>/dev/null && echo OK)"
-                                       if [ "$decrypt" == "OK" ]; then
-                                               mv /tmp/backup.tar.gz.dec /tmp/backup.tar.gz
-                                               stdout="$(sysupgrade --restore-backup /tmp/backup.tar.gz)"
-                                       else
-                                               error="Invalid Password!"
-                                       fi
-                               else
-                                       result="$(sysupgrade --restore-backup /tmp/backup.tar.gz)"
-                                       if [ "result" == "" ]; then
-                                               stdout="$result"
-                                       else
-                                               error="$result"
-                                       fi
-                               fi
-
-                               json_init
-                               if [ -n "$stdout" ]; then
-                                       json_add_string stdout "$stdout"
-                               else
-                                       json_add_string error "$error"
-                               fi
-                               json_dump
-                       ;;
-                       check)
-                               read input
-                               json_load "$input"
-                               json_get_var type type
-
-
-                               json_init
-                               case "$type" in
-                                       online)
-                                               json_add_string online "$(sysupgrade --online 2>/dev/null)"
-                                       ;;
-                                       usb)
-                                               json_add_string usb "$(sysupgrade --usb 2>/dev/null)"
-                                       ;;
-                               esac
-
-                               json_dump
-                       ;;
-                       start)
-                               read input
-                               json_load "$input"
-                               json_get_var keep keep 1
-                               json_get_var path path "/tmp/firmware.bin"
-
-                               [ "$keep" == "1" ] && keep="" || keep="-n"
-                               sysupgrade $keep $path
-                       ;;
-                       test)
-                               read input
-                               json_load "$input"
-                               json_get_var path path "/tmp/firmware.bin"
-
-                               sysupgrade --test $path
-                       ;;
-               esac
-       ;;
-esac
diff --git a/plugins/juci-upnp/ubus/juci.upnpd b/plugins/juci-upnp/ubus/juci.upnpd
new file mode 100755 (executable)
index 0000000..30e3a8e
--- /dev/null
@@ -0,0 +1,38 @@
+#!/bin/sh
+
+#root@Inteno:/# iptables --line-numbers -t nat -xnvL MINIUPNPD | tail -n +3
+#1           0        0 DNAT       udp  --  *      *       0.0.0.0/0            0.0.0.0/0            udp dpt:15418 to:192.168.1.241:15418
+#2           0        0 DNAT       tcp  --  *      *       0.0.0.0/0            0.0.0.0/0            tcp dpt:15418 to:192.168.1.241:15418
+
+. /usr/share/libubox/jshn.sh
+
+case "$1" in
+       list)
+               echo '{ "ports" : {} }'
+       ;;
+       call)
+               case "$2" in
+                       ports)
+                               upnpfile="/tmp/upnp.status"
+
+                               iptables --line-numbers -t nat -xnvL MINIUPNPD | tail -n +3 | tr '*' '-' | sed 's/ \+/ /g' > $upnpfile
+                               json_init
+                               json_add_array "ports"
+                               while read -r line
+                               do
+                                       json_add_object ""
+                                       json_add_string num "$(echo $line | awk '{print$1}')"
+                                       json_add_string bytes "$(echo $line | awk '{print$3}')"
+                                       json_add_string target "$(echo $line | awk '{print$4}')"
+                                       json_add_string proto "$(echo $line | awk '{print$5}')"
+                                       json_add_string opt "$(echo $line | awk '{print$6}')"
+                                       json_add_string src "$(echo $line | awk '{print$12}' | awk -F'dpt:' '{print$2}')"
+                                       json_add_string dst "$(echo $line | awk '{print$13}' | awk -F'to:' '{print$2}')"
+                                       json_select ..
+                               done < $upnpfile
+                               rm -f $upnpfile
+                               json_dump
+                       ;;
+               esac
+       ;;
+esac
diff --git a/plugins/juci-upnp/ubus/upnpd b/plugins/juci-upnp/ubus/upnpd
deleted file mode 100755 (executable)
index 30e3a8e..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-#!/bin/sh
-
-#root@Inteno:/# iptables --line-numbers -t nat -xnvL MINIUPNPD | tail -n +3
-#1           0        0 DNAT       udp  --  *      *       0.0.0.0/0            0.0.0.0/0            udp dpt:15418 to:192.168.1.241:15418
-#2           0        0 DNAT       tcp  --  *      *       0.0.0.0/0            0.0.0.0/0            tcp dpt:15418 to:192.168.1.241:15418
-
-. /usr/share/libubox/jshn.sh
-
-case "$1" in
-       list)
-               echo '{ "ports" : {} }'
-       ;;
-       call)
-               case "$2" in
-                       ports)
-                               upnpfile="/tmp/upnp.status"
-
-                               iptables --line-numbers -t nat -xnvL MINIUPNPD | tail -n +3 | tr '*' '-' | sed 's/ \+/ /g' > $upnpfile
-                               json_init
-                               json_add_array "ports"
-                               while read -r line
-                               do
-                                       json_add_object ""
-                                       json_add_string num "$(echo $line | awk '{print$1}')"
-                                       json_add_string bytes "$(echo $line | awk '{print$3}')"
-                                       json_add_string target "$(echo $line | awk '{print$4}')"
-                                       json_add_string proto "$(echo $line | awk '{print$5}')"
-                                       json_add_string opt "$(echo $line | awk '{print$6}')"
-                                       json_add_string src "$(echo $line | awk '{print$12}' | awk -F'dpt:' '{print$2}')"
-                                       json_add_string dst "$(echo $line | awk '{print$13}' | awk -F'to:' '{print$2}')"
-                                       json_select ..
-                               done < $upnpfile
-                               rm -f $upnpfile
-                               json_dump
-                       ;;
-               esac
-       ;;
-esac