Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
easycwmp
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
certo
easycwmp
Commits
e5fd0ab8
Commit
e5fd0ab8
authored
Sep 15, 2019
by
Vladimir Bashkirtsev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updated easycwmp to 1.8.1
parent
e1f0a4a4
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
608 additions
and
64 deletions
+608
-64
EasyCwmp-1.8.1.tar.gz
EasyCwmp-1.8.1.tar.gz
+0
-0
Makefile
Makefile
+16
-16
easycwmp-1.5.3-blank-device.patch
easycwmp-1.5.3-blank-device.patch
+0
-48
easycwmp-1.5.3.tar.gz
easycwmp-1.5.3.tar.gz
+0
-0
easycwmp-1.8.1-blank_device.patch
easycwmp-1.8.1-blank_device.patch
+592
-0
No files found.
EasyCwmp-1.8.1.tar.gz
0 → 100644
View file @
e5fd0ab8
File added
Makefile
View file @
e5fd0ab8
all
:
easycwmp-service device-info easycwmp-config
all
:
easycwmp-service device-info easycwmp-config
tar
xf
easycwmp-1.5.3
.tar.gz
tar
xf
EasyCwmp-1.8.1
.tar.gz
patch
-Np1
-d
easycwmp-
1.5.3 < easycwmp-1.5.3-blank-
device.patch
patch
-Np1
-d
easycwmp-
EasyCwmp-1.8.1 < easycwmp-1.8.1-blank_
device.patch
cd
easycwmp-
1.5.3
&&
autoreconf
-i
cd
easycwmp-
EasyCwmp-1.8.1
&&
autoreconf
-i
cd
easycwmp-
1.5.3
&&
./configure
--prefix
=
/usr
--enable-jsonc
=
1
cd
easycwmp-
EasyCwmp-1.8.1
&&
./configure
--prefix
=
/usr
--enable-jsonc
=
1
$(MAKE)
-C
easycwmp-
1.5.3
$(MAKE)
-C
easycwmp-
EasyCwmp-1.8.1
$(MAKE)
-C
easycwmp-
1.5.3
install
$(MAKE)
-C
easycwmp-
EasyCwmp-1.8.1
install
install
-v
-Dm755
-d
/usr/share/easycwmp/functions
install
-v
-Dm755
-d
/usr/share/easycwmp/functions
install
-v
-Dm755
-d
/etc/easycwmp
install
-v
-Dm755
-d
/etc/easycwmp
install
-v
-Dm755
easycwmp-
1.5.3
/ext/openwrt/scripts/easycwmp.sh /usr/sbin/easycwmp
install
-v
-Dm755
easycwmp-
EasyCwmp-1.8.1
/ext/openwrt/scripts/easycwmp.sh /usr/sbin/easycwmp
install
-v
-Dm755
easycwmp-
1.5.3
/ext/openwrt/scripts/defaults /usr/share/easycwmp/defaults
install
-v
-Dm755
easycwmp-
EasyCwmp-1.8.1
/ext/openwrt/scripts/defaults /usr/share/easycwmp/defaults
install
-v
-Dm755
easycwmp-
1.5.3
/ext/openwrt/scripts/functions/common/common /usr/share/easycwmp/functions/common
install
-v
-Dm755
easycwmp-
EasyCwmp-1.8.1
/ext/openwrt/scripts/functions/common/common /usr/share/easycwmp/functions/common
install
-v
-Dm755
easycwmp-
1.5.3
/ext/openwrt/scripts/functions/common/device_info /usr/share/easycwmp/functions/device_info
install
-v
-Dm755
easycwmp-
EasyCwmp-1.8.1
/ext/openwrt/scripts/functions/common/device_info /usr/share/easycwmp/functions/device_info
install
-v
-Dm755
easycwmp-
1.5.3
/ext/openwrt/scripts/functions/common/management_server /usr/share/easycwmp/functions/management_server
install
-v
-Dm755
easycwmp-
EasyCwmp-1.8.1
/ext/openwrt/scripts/functions/common/management_server /usr/share/easycwmp/functions/management_server
install
-v
-Dm755
easycwmp-
1.5.3
/ext/openwrt/scripts/functions/common/ipping_launch /usr/share/easycwmp/functions/ipping_launch
install
-v
-Dm755
easycwmp-
EasyCwmp-1.8.1
/ext/openwrt/scripts/functions/common/ipping_launch /usr/share/easycwmp/functions/ipping_launch
install
-v
-Dm755
easycwmp-
1.5.3
/ext/openwrt/scripts/functions/tr181/root /usr/share/easycwmp/functions/root
install
-v
-Dm755
easycwmp-
EasyCwmp-1.8.1
/ext/openwrt/scripts/functions/tr181/root /usr/share/easycwmp/functions/root
install
-v
-Dm755
easycwmp-
1.5.3
/ext/openwrt/scripts/functions/tr181/ip /usr/share/easycwmp/functions/ip
install
-v
-Dm755
easycwmp-
EasyCwmp-1.8.1
/ext/openwrt/scripts/functions/tr181/ip /usr/share/easycwmp/functions/ip
install
-v
-Dm755
easycwmp-
1.5.3
/ext/openwrt/scripts/functions/tr181/ipping_diagnostic /usr/share/easycwmp/functions/ipping_diagnostic
install
-v
-Dm755
easycwmp-
EasyCwmp-1.8.1
/ext/openwrt/scripts/functions/tr181/ipping_diagnostic /usr/share/easycwmp/functions/ipping_diagnostic
install
-v
-Dm755
ip /usr/share/easycwmp/functions/ip
install
-v
-Dm755
ip /usr/share/easycwmp/functions/ip
install
-v
-Dm755
ssh /usr/share/easycwmp/functions/ssh
install
-v
-Dm755
ssh /usr/share/easycwmp/functions/ssh
install
-v
-Dm755
easycwmp-init-device-info /usr/sbin/easycwmp-init-device-info
install
-v
-Dm755
easycwmp-init-device-info /usr/sbin/easycwmp-init-device-info
...
@@ -25,7 +25,7 @@ all: easycwmp-service device-info easycwmp-config
...
@@ -25,7 +25,7 @@ all: easycwmp-service device-info easycwmp-config
tar
xf ../openwrt/openwrt.tar.xz
-C
/
tar
xf ../openwrt/openwrt.tar.xz
-C
/
@
echo
"
$$
EASYCWMP_SERVICE"
>
/lib/systemd/system/easycwmpd.service
@
echo
"
$$
EASYCWMP_SERVICE"
>
/lib/systemd/system/easycwmpd.service
ln
-s
/lib/systemd/system/easycwmpd.service /etc/systemd/system/multi-user.target.wants/easycwmpd.service
ln
-s
/lib/systemd/system/easycwmpd.service /etc/systemd/system/multi-user.target.wants/easycwmpd.service
rm
-rf
easycwmp-
1.5.3
rm
-rf
easycwmp-
EasyCwmp-1.8.1
easycwmp-service
:
easycwmp-service
:
define
EASYCWMP_SERVICE
define
EASYCWMP_SERVICE
...
...
easycwmp-1.5.3-blank-device.patch
deleted
100644 → 0
View file @
e1f0a4a4
diff -uNr easycwmp-1.5.3/ext/openwrt/scripts/easycwmp.sh easycwmp-1.5.3-blank-device/ext/openwrt/scripts/easycwmp.sh
--- easycwmp-1.5.3/ext/openwrt/scripts/easycwmp.sh 2017-06-01 18:25:35.000000000 +0930
+++ easycwmp-1.5.3-blank-device/ext/openwrt/scripts/easycwmp.sh 2018-08-29 20:14:07.261196306 +0930
@@ -354,11 +354,7 @@
return
fi
if [ "$action" = "factory_reset" ]; then
- if [ "`which jffs2_mark_erase`" != "" ]; then
- jffs2_mark_erase "rootfs_data"
- else
- /sbin/jffs2mark -y
- fi
+ touch /data/.factorydefault
sync
reboot
fi
diff -uNr easycwmp-1.5.3/ext/openwrt/scripts/functions/common/device_info easycwmp-1.5.3-blank-device/ext/openwrt/scripts/functions/common/device_info
--- easycwmp-1.5.3/ext/openwrt/scripts/functions/common/device_info 2017-06-01 18:25:35.000000000 +0930
+++ easycwmp-1.5.3-blank-device/ext/openwrt/scripts/functions/common/device_info 2018-08-29 20:14:07.262196310 +0930
@@ -25,11 +25,12 @@
common_execute_method_param "$DMROOT.DeviceInfo.SerialNumber" "0" "$UCI_GET easycwmp.@device[0].serial_number" "" "" "1"
common_execute_method_param "$DMROOT.DeviceInfo.HardwareVersion" "0" "$UCI_GET easycwmp.@device[0].hardware_version" "" "" "1"
common_execute_method_param "$DMROOT.DeviceInfo.SoftwareVersion" "0" "$UCI_GET easycwmp.@device[0].software_version" "" "" "1"
- common_execute_method_param "$DMROOT.DeviceInfo.UpTime" "0" "device_info_get_uptime" "" "xsd:unsignedInt"
+ common_execute_method_param "$DMROOT.DeviceInfo.UpTime" "0" "device_info_get_uptime" "" "xsd:unsignedInt" "1"
common_execute_method_param "$DMROOT.DeviceInfo.DeviceLog" "0" "dmesg | tail -n1"
common_execute_method_obj "$DMROOT.DeviceInfo.MemoryStatus." "0"
common_execute_method_param "$DMROOT.DeviceInfo.MemoryStatus.Total" "0" "device_info_get_total_memory"
common_execute_method_param "$DMROOT.DeviceInfo.MemoryStatus.Free" "0" "device_info_get_free_memory"
+ common_execute_method_param "$DMROOT.DeviceInfo.HostName" "1" "hostname" "device_info_set_hostname" "" "1"
return 0;
;;
esac
@@ -54,6 +55,14 @@
return 0
}
+device_info_set_hostname() {
+ local val="$1"
+ hostname $val
+ echo "127.0.0.1 localhost $val" > /etc/hosts
+ echo "$val" > /etc/hostname
+ return 0
+}
+
device_info_get_uptime() {
awk -F '.' '{ print $1 }' /proc/uptime
}
easycwmp-1.5.3.tar.gz
deleted
100644 → 0
View file @
e1f0a4a4
File deleted
easycwmp-1.8.1-blank_device.patch
0 → 100644
View file @
e5fd0ab8
diff -uNr easycwmp-EasyCwmp-1.8.1/ext/openwrt/scripts/easycwmp.sh easycwmp-EasyCwmp-1.8.1-blank_device/ext/openwrt/scripts/easycwmp.sh
--- easycwmp-EasyCwmp-1.8.1/ext/openwrt/scripts/easycwmp.sh 2019-06-24 19:29:07.000000000 +0930
+++ easycwmp-EasyCwmp-1.8.1-blank_device/ext/openwrt/scripts/easycwmp.sh 2019-09-15 22:50:09.046556997 +0930
@@ -399,11 +399,7 @@
return
fi
if [ "$action" = "factory_reset" ]; then
- if [ "`which jffs2_mark_erase`" != "" ]; then
- jffs2_mark_erase "rootfs_data"
- else
- /sbin/jffs2mark -y
- fi
+ touch /data/.factorydefault
sync
reboot
fi
diff -uNr easycwmp-EasyCwmp-1.8.1/ext/openwrt/scripts/easycwmp.sh.orig easycwmp-EasyCwmp-1.8.1-blank_device/ext/openwrt/scripts/easycwmp.sh.orig
--- easycwmp-EasyCwmp-1.8.1/ext/openwrt/scripts/easycwmp.sh.orig 1970-01-01 09:30:00.000000000 +0930
+++ easycwmp-EasyCwmp-1.8.1-blank_device/ext/openwrt/scripts/easycwmp.sh.orig 2019-06-24 19:29:07.000000000 +0930
@@ -0,0 +1,540 @@
+#!/bin/sh
+# Copyright (C) 2012-2014 PIVA Software <www.pivasoftware.com>
+# Author: MOHAMED Kallel <mohamed.kallel@pivasoftware.com>
+# Author: AHMED Zribi <ahmed.zribi@pivasoftware.com>
+# Author: ANIS ELLOUZE <anis.ellouze@pivasoftware.com>
+# Copyright (C) 2011-2012 Luka Perkov <freecwmp@lukaperkov.net>
+
+. /lib/functions.sh
+. /usr/share/libubox/jshn.sh
+. /usr/share/easycwmp/defaults
+
+UCI_GET="/sbin/uci -q ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} get"
+UCI_SET="/sbin/uci -q ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} set"
+UCI_SHOW="/sbin/uci -q ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} show"
+UCI_COMMIT="/sbin/uci -q ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} commit"
+UCI_ADD="/sbin/uci -q ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} add"
+UCI_DELETE="/sbin/uci -q ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} delete"
+UCI_ADD_LIST="/sbin/uci -q ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} add_list"
+UCI_DEL_LIST="/sbin/uci -q ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} del_list"
+UCI_REVERT="/sbin/uci -q ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} revert"
+UCI_CHANGES="/sbin/uci -q ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} changes"
+UCI_BATCH="/sbin/uci -q ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} batch"
+
+DOWNLOAD_DIR="/tmp/easycwmp_download"
+EASYCWMP_PROMPT="easycwmp>"
+set_fault_tmp_file="/tmp/.easycwmp_set_fault_tmp"
+apply_service_tmp_file="/tmp/.easycwmp_apply_service"
+set_command_tmp_file="/tmp/.easycwmp_set_command_tmp"
+FUNCTION_PATH="/usr/share/easycwmp/functions"
+NOTIF_PARAM_VALUES="/tmp/.easycwmp_notif_param_value"
+easycwmp_config_changed=""
+uci_change_packages=""
+uci_change_services=""
+g_fault_code=""
+
+prefix_list=""
+entry_execute_method_list=""
+entry_execute_method_list_forcedinform=""
+entry_method_root=""
+
+g_entry_param=""
+g_entry_method=""
+g_entry_arg=""
+# Fault codes
+E_REQUEST_DENIED="1"
+E_INTERNAL_ERROR="2"
+E_INVALID_ARGUMENTS="3"
+E_RESOURCES_EXCEEDED="4"
+E_INVALID_PARAMETER_NAME="5"
+E_INVALID_PARAMETER_TYPE="6"
+E_INVALID_PARAMETER_VALUE="7"
+E_NON_WRITABLE_PARAMETER="8"
+E_NOTIFICATION_REJECTED="9"
+E_DOWNLOAD_FAILURE="10"
+E_UPLOAD_FAILURE="11"
+E_FILE_TRANSFER_AUTHENTICATION_FAILURE="12"
+E_FILE_TRANSFER_UNSUPPORTED_PROTOCOL="13"
+E_DOWNLOAD_FAIL_MULTICAST_GROUP="14"
+E_DOWNLOAD_FAIL_CONTACT_SERVER="15"
+E_DOWNLOAD_FAIL_ACCESS_FILE="16"
+E_DOWNLOAD_FAIL_COMPLETE_DOWNLOAD="17"
+E_DOWNLOAD_FAIL_FILE_CORRUPTED="18"
+E_DOWNLOAD_FAIL_FILE_AUTHENTICATION="19"
+
+easycwmp_usage() {
+cat << EOF
+USAGE: $1 command [parameter] [values]
+command:
+ get [value|notification|name]
+ set [value|notification]
+ apply [value|notification|object|service]
+ add [object]
+ delete [object]
+ download
+ upload
+ factory_reset
+ reboot
+ inform [parameter|device_id]
+ --json-input
+EOF
+}
+
+__arg1=""; __arg2=""; __arg3=""; __arg4=""; __arg5="";
+
+json_get_opt() {
+ __arg1=""; __arg2=""; __arg3=""; __arg4=""; __arg5="";
+
+ json_init
+ json_load "$1"
+ local command class
+ json_get_var command command
+ case "$command" in
+ set|get|add|delete)
+ json_get_var class class
+ json_get_var __arg1 parameter
+ json_get_var __arg2 argument
+ if [ "$class" != "" ]; then
+ action="$command""_$class"
+ else
+ action="$command""_value"
+ fi
+ ;;
+ download)
+ action="download"
+ json_get_var __arg1 url
+ json_get_var __arg2 file_type
+ json_get_var __arg3 file_size
+ json_get_var __arg4 user_name
+ json_get_var __arg5 password
+ ;;
+ upload)
+ action="upload"
+ json_get_var __arg1 url
+ json_get_var __arg2 file_type
+ json_get_var __arg3 user_name
+ json_get_var __arg4 password
+ ;;
+ factory_reset|reboot)
+ action="$command"
+ ;;
+ inform)
+ json_get_var class class
+ if [ "$class" != "" ]; then
+ action="inform_$class"
+ else
+ action="inform_parameter"
+ fi
+ ;;
+ apply)
+ json_get_var class class
+ json_get_var __arg1 argument
+ if [ "$class" != "" ]; then
+ action="apply_$class"
+ else
+ action="apply_value"
+ fi
+ ;;
+ end)
+ action="end"
+ echo "$EASYCWMP_PROMPT"
+ ;;
+ update_value_change)
+ action="update_value_change"
+ ;;
+ check_value_change)
+ action="check_value_change"
+ ;;
+ exit)
+ exit 0
+ ;;
+ esac
+}
+
+case "$1" in
+ set|get|add|delete)
+ if [ "$2" = "notification" -o "$2" = "value" -o "$2" = "name" -o "$2" = "object" ]; then
+ __arg1="$3"
+ __arg2="$4"
+ action="$1_""$2"
+ else
+ __arg1="$2"
+ __arg2="$3"
+ action="$1""_value"
+ fi
+ ;;
+ download)
+ action="download"
+ __arg1="$2"
+ __arg2="$3"
+ __arg3="$4"
+ __arg4="$5"
+ __arg5="$6"
+ ;;
+ upload)
+ action="upload"
+ __arg1="$2"
+ __arg2="$3"
+ __arg3="$4"
+ __arg4="$5"
+ ;;
+ factory_reset|reboot)
+ action="$1"
+ ;;
+ inform)
+ if [ "$2" != "" ]; then
+ action="inform_$2"
+ else
+ action="inform_parameter"
+ fi
+ ;;
+ apply)
+ if [ "$2" != "" ]; then
+ __arg1="$3"
+ action="apply_$2"
+ else
+ __arg1="$2"
+ action="apply_value"
+ fi
+ ;;
+ --json-input)
+ action="json_input"
+ ;;
+ update_value_change)
+ action="update_value_change"
+ ;;
+ check_value_change)
+ action="check_value_change"
+ ;;
+ *)
+ easycwmp_usage $0
+ ;;
+esac
+
+
+if [ -z "$action" ]; then
+ echo invalid action \'$1\'
+ exit 1
+fi
+
+dmscripts=`ls $FUNCTION_PATH`
+. $FUNCTION_PATH/root
+for dms in $dmscripts; do
+ [ "$dms" != "root" ] && . $FUNCTION_PATH/$dms
+done
+
+prefix_list="$DMROOT. $prefix_list"
+entry_execute_method_list="$entry_method_root $entry_execute_method_list"
+
+handle_action() {
+ if [ "$action" = "get_value" ]; then
+ (common_entry_get_value "$__arg1")
+ local fault="$?"
+ if [ "$fault" != "0" ]; then
+ common_json_output_fault "$__arg1" "$((fault+9000))"
+ fi
+ return
+ fi
+
+ if [ "$action" = "get_name" ]; then
+ [ "`echo $__arg2 | awk '{print tolower($0)}'`" = "false" ] && __arg2="0"
+ [ "`echo $__arg2 | awk '{print tolower($0)}'`" = "true" ] && __arg2="1"
+ if [ "$__arg2" != "0" -a "$__arg2" != "1" ]; then
+ common_json_output_fault "$__arg1" "$((E_INVALID_ARGUMENTS+9000))"
+ return
+ fi
+ (common_entry_get_name "$__arg1" "$__arg2")
+ local fault="$?"
+ if [ "$fault" != "0" ]; then
+ common_json_output_fault "$__arg1" "$((fault+9000))"
+ fi
+ return
+ fi
+
+ if [ "$action" = "get_notification" ]; then
+ (common_entry_get_notification "$__arg1")
+ local fault="$?"
+ if [ "$fault" != "0" ]; then
+ common_json_output_fault "$__arg1" "$((fault+9000))"
+ fi
+ return
+ fi
+
+ if [ "$action" = "set_value" ]; then
+ (common_entry_set_value "$__arg1" "$__arg2")
+ local fault="$?"
+ if [ "$fault" != "0" ]; then
+ common_set_parameter_fault "$__arg1" "$((fault+9000))"
+ fi
+ return
+ fi
+
+ if [ "$action" = "set_notification" ]; then
+ (common_entry_set_notification "$__arg1" "$__arg2")
+ local fault="$?"
+ if [ "$fault" != "0" ]; then
+ common_set_parameter_fault "$__arg1" "$((fault+9000))"
+ fi
+ return
+ fi
+
+ if [ "$action" = "download" ]; then
+# TODO: check firmaware size with falsh to be improved
+ dl_size=`df |grep "/tmp$" | awk '{print $4;}'`
+ [ -n "$dl_size" ] && dl_size_byte=$((${dl_size}*1024))
+ if [ -n "$dl_size" -a "$dl_size_byte" -lt "$__arg3" ]; then
+ let fault_code=9000+$E_DOWNLOAD_FAILURE
+ common_json_output_fault "" "$fault_code"
+ else
+ rm -rf $DOWNLOAD_DIR 2> /dev/null
+ mkdir -p $DOWNLOAD_DIR
+ local dw_url="$__arg1"
+ [ "$__arg4" != "" -o "$__arg5" != "" ] && dw_url=`echo "$__arg1" | sed -e "s@://@://$__arg4:$__arg5\@@g"`
+ wget -P $DOWNLOAD_DIR "$dw_url"
+ fault_code="$?"
+ if [ "$fault_code" != "0" ]; then
+ rm -rf $DOWNLOAD_DIR 2> /dev/null
+ let fault_code=9000+$E_DOWNLOAD_FAILURE
+ common_json_output_fault "" "$fault_code"
+ else
+ common_json_output_status "1"
+ fi
+ fi
+ return
+ fi
+
+ if [ "$action" = "upload" ]; then
+
+ local up_url="$__arg1"
+ SERIAL_NUMBER=`$UCI_GET easycwmp.@device[0].serial_number`
+
+ [ "$__arg3" != "" -o "$__arg4" != "" ] && up_url=`echo "$__arg1" | sed -e "s@://@://$__arg3:$__arg4\@@g"`
+
+ case "$__arg2" in
+ *"Vendor Log File"*)
+ logread > "/tmp/log$SERIAL_NUMBER.log"
+ if [ "$__arg3" != "" ]; then
+ curl --user $__arg3:$__arg4 --connect-timeout 30 --upload-file /tmp/log$SERIAL_NUMBER.log $up_url
+ else
+ curl -T --connect-timeout 30 "/tmp/log$SERIAL_NUMBER.log" "$up_url"
+ fi
+
+
+ fault_code="$?"
+ rm -f "/tmp/log$SERIAL_NUMBER.log"
+ ;;
+ *"Vendor Configuration File"*)
+
+ sysupgrade --create-backup "/tmp/config$SERIAL_NUMBER.tar.gz"
+ if [ "$__arg3" != "" ]; then
+ curl --user $__arg3:$__arg4 --connect-timeout 30 --upload-file /tmp/config$SERIAL_NUMBER.tar.gz $up_url
+ else
+ curl -T --connect-timeout 30 "/tmp/config$SERIAL_NUMBER.tar.gz" "$up_url"
+ fi
+ fault_code="$?"
+ rm -f "/tmp/config$SERIAL_NUMBER.tar.gz"
+ ;;
+ *)
+ common_json_output_fault "" "$(($E_INVALID_ARGUMENTS+9000))"
+ return
+ ;;
+ esac
+
+ if [ "$fault_code" != "0" ]; then
+ let fault_code=9000+$E_UPLOAD_FAILURE
+ common_json_output_fault "" "$fault_code"
+ else
+ common_json_output_status "1"
+ fi
+ return
+ fi
+
+ if [ "$action" = "apply_download" ]; then
+ if [ "$__arg1" = "3 Vendor Configuration File" ]; then
+ dwfile=`ls $DOWNLOAD_DIR`
+ if [ "$dwfile" != "" ]; then
+ dwfile="$DOWNLOAD_DIR/$dwfile"
+ if [ ${dwfile%.gz} != $dwfile -o ${dwfile%.bz2} != $dwfile ]; then
+ sysupgrade --restore-backup $dwfile
+ fault_code="$?"
+ else
+ /sbin/uci import < $dwfile
+ fault_code="$?"
+ [ "$fault_code" = "0" ] && $UCI_COMMIT
+ fi
+ if [ "$fault_code" != "0" ]; then
+ let fault_code=$E_DOWNLOAD_FAIL_FILE_CORRUPTED+9000
+ common_json_output_fault "" "$fault_code"
+ else
+ sync
+ reboot
+ common_json_output_status "1"
+ fi
+ else
+ let fault_code=$E_DOWNLOAD_FAILURE+9000
+ common_json_output_fault "" "$fault_code"
+ fi
+ elif [ "$__arg1" = "1 Firmware Upgrade Image" ]; then
+ local gr_backup=`grep "^/etc/easycwmp/\.backup\.xml" /etc/sysupgrade.conf`
+ [ -z $gr_backup ] && echo "/etc/easycwmp/.backup.xml" >> /etc/sysupgrade.conf
+ dwfile=`ls $DOWNLOAD_DIR`
+ if [ "$dwfile" != "" ]; then
+ dwfile="$DOWNLOAD_DIR/$dwfile"
+ /sbin/sysupgrade $dwfile
+ fault_code="$?"
+ if [ "$fault_code" != "0" ]; then
+ let fault_code=$E_DOWNLOAD_FAIL_FILE_CORRUPTED+9000
+ common_json_output_fault "" "$fault_code"
+ else
+ common_json_output_status "1"
+ fi
+ else
+ let fault_code=$E_DOWNLOAD_FAILURE+9000
+ common_json_output_fault "" "$fault_code"
+ fi
+ else
+ common_json_output_fault "" "$(($E_INVALID_ARGUMENTS+9000))"
+ fi
+ rm -rf $DOWNLOAD_DIR 2> /dev/null
+ return
+ fi
+ if [ "$action" = "factory_reset" ]; then
+ if [ "`which jffs2_mark_erase`" != "" ]; then
+ jffs2_mark_erase "rootfs_data"
+ else
+ /sbin/jffs2mark -y
+ fi
+ sync
+ reboot
+ fi
+
+ if [ "$action" = "reboot" ]; then
+ sync
+ reboot
+ fi
+
+ if [ "$action" = "apply_notification" -o "$action" = "apply_value" ]; then
+ if [ ! -f "$set_fault_tmp_file" ]; then
+ local rev=""
+ while read line; do
+ [ -z "$line" ] && continue
+ local param=${line%%<delim>*}
+ local setcmd=${line#*<delim>}
+ setcmd=${setcmd%<delim>*}
+ eval "$setcmd"
+ local fault="$?"
+ if [ "$fault" != "0" ]; then
+ rev=1
+ common_json_output_fault "$param" "$((fault+9000))"
+ fi
+ done < $set_command_tmp_file
+ if [ -n "$rev" ]; then
+ local cfg cfg_reverts=`$UCI_CHANGES | cut -d'.' -f1 | sort -u`
+ for cfg in $cfg_reverts; do
+ $UCI_REVERT $cfg
+ done
+ else
+ if [ "$action" = "apply_value" ]; then
+ while read line; do
+ [ -z "$line" ] && continue
+ local param=${line%%<delim>*}
+ local gtmp=`grep "\"$param\"" $NOTIF_PARAM_VALUES`
+ if [ -n "$gtmp" ]; then
+ local getcmd=${line##*<delim>}
+ local vtmp=`$getcmd`
+ json_init
+ json_load "$gtmp"
+ json_add_string "value" "$vtmp"
+ json_close_object
+ gtmp=`json_dump`
+ sed -i "/$param/s/.*/$gtmp/" $NOTIF_PARAM_VALUES
+ fi
+ done < $set_command_tmp_file
+ common_uci_change_packages_lookup
+ $UCI_SET easycwmp.@acs[0].parameter_key="$__arg1"
+ common_json_output_status "1"
+ fi
+ if [ "$action" = "apply_notification" ]; then
+ common_uci_change_packages_lookup
+ common_json_output_status "0"
+ fi
+ $UCI_COMMIT
+ fi
+ else
+ cat "$set_fault_tmp_file"
+ fi
+ rm -f "$set_fault_tmp_file"
+ rm -f "$set_command_tmp_file"
+ return
+ fi
+ if [ "$action" = "apply_object" ]; then
+ $UCI_SET easycwmp.@acs[0].parameter_key="$__arg1"
+ $UCI_COMMIT
+ return
+ fi
+ if [ "$action" = "apply_service" ]; then
+ common_restart_services
+ if [ -f "$apply_service_tmp_file" ]; then
+ chmod +x "$apply_service_tmp_file"
+ /bin/sh "$apply_service_tmp_file"
+ rm -f "$apply_service_tmp_file"
+ fi
+ return
+ fi
+
+ if [ "$action" = "add_object" ]; then
+ (common_entry_add_object "$__arg1")
+ local fault="$?"
+ if [ "$fault" != "0" ]; then
+ common_json_output_fault "" "$((fault+9000))"
+ fi
+ return
+ fi
+
+ if [ "$action" = "delete_object" ]; then
+ (common_entry_delete_object "$__arg1")
+ local fault="$?"
+ if [ "$fault" != "0" ]; then
+ common_json_output_fault "" "$((fault+9000))"
+ fi
+ return
+ fi
+
+ if [ "$action" = "inform_parameter" ]; then
+ (common_entry_inform)
+ return
+ fi
+
+ if [ "$action" = "inform_device_id" ]; then
+ common_get_inform_deviceid
+ return
+ fi
+
+ if [ "$action" = "update_value_change" ]; then
+ (common_entry_update_value_change)
+ return
+ fi
+
+ if [ "$action" = "check_value_change" ]; then
+ local line param oldvalue
+ while read line; do
+ json_init
+ json_load "$line"
+ json_get_var param parameter
+ (common_entry_check_value_change $param $oldvalue)
+ done < $NOTIF_PARAM_VALUES
+ (common_entry_update_value_change)
+ return
+ fi
+
+ if [ "$action" = "json_input" ]; then
+ echo "$EASYCWMP_PROMPT"
+ while read CMD; do
+ [ -z "$CMD" ] && continue
+ json_get_opt "$CMD"
+ handle_action
+ done
+ exit 0
+ fi
+}
+handle_action 2>/dev/null
diff -uNr easycwmp-EasyCwmp-1.8.1/ext/openwrt/scripts/functions/common/device_info easycwmp-EasyCwmp-1.8.1-blank_device/ext/openwrt/scripts/functions/common/device_info
--- easycwmp-EasyCwmp-1.8.1/ext/openwrt/scripts/functions/common/device_info 2019-06-24 19:29:07.000000000 +0930
+++ easycwmp-EasyCwmp-1.8.1-blank_device/ext/openwrt/scripts/functions/common/device_info 2019-09-15 22:50:09.046556997 +0930
@@ -25,11 +25,12 @@
common_execute_method_param "$DMROOT.DeviceInfo.SerialNumber" "0" "$UCI_GET easycwmp.@device[0].serial_number" "" "" "1"
common_execute_method_param "$DMROOT.DeviceInfo.HardwareVersion" "0" "$UCI_GET easycwmp.@device[0].hardware_version" "" "" "1"
common_execute_method_param "$DMROOT.DeviceInfo.SoftwareVersion" "0" "$UCI_GET easycwmp.@device[0].software_version" "" "" "1"
- common_execute_method_param "$DMROOT.DeviceInfo.UpTime" "0" "device_info_get_uptime" "" "xsd:unsignedInt"
+ common_execute_method_param "$DMROOT.DeviceInfo.UpTime" "0" "device_info_get_uptime" "" "xsd:unsignedInt" "1"
common_execute_method_param "$DMROOT.DeviceInfo.DeviceLog" "0" "dmesg | tail -n1"
common_execute_method_obj "$DMROOT.DeviceInfo.MemoryStatus." "0"
common_execute_method_param "$DMROOT.DeviceInfo.MemoryStatus.Total" "0" "device_info_get_total_memory"
common_execute_method_param "$DMROOT.DeviceInfo.MemoryStatus.Free" "0" "device_info_get_free_memory"
+ common_execute_method_param "$DMROOT.DeviceInfo.HostName" "1" "hostname" "device_info_set_hostname" "" "1"
return 0;
;;
esac
@@ -54,6 +55,14 @@
return 0
}
+device_info_set_hostname() {
+ local val="$1"
+ hostname $val
+ echo "127.0.0.1 localhost $val" > /etc/hosts
+ echo "$val" > /etc/hostname
+ return 0
+}
+
device_info_get_uptime() {
awk -F '.' '{ print $1 }' /proc/uptime
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment