From 4915cb19eddecc8a7aace0eac642abf44e07a589 Mon Sep 17 00:00:00 2001 From: Feten Date: Thu, 16 Feb 2017 10:50:37 +0100 Subject: [PATCH] #0000203: Support tar.gz file of luci in the apply download of config --- ext/openwrt/scripts/easycwmp.sh | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/ext/openwrt/scripts/easycwmp.sh b/ext/openwrt/scripts/easycwmp.sh index e242fda..1ff583a 100755 --- a/ext/openwrt/scripts/easycwmp.sh +++ b/ext/openwrt/scripts/easycwmp.sh @@ -296,13 +296,21 @@ handle_action() { tar -zxf $dwfile -C $DOWNLOAD_DIR >/dev/null 2>&1 fault_code="$?" if [ "$fault_code" = "0" ]; then - cp $DOWNLOAD_DIR/config/* /etc/config/ + if [ -d $ $DOWNLOAD_DIR/config/ ] + cp -R $DOWNLOAD_DIR/config/* /etc/config/ + else + cp -R $DOWNLOAD_DIR/* / + fi fi elif [ ${dwfile%.bz2} != $dwfile ]; then tar -jxf $dwfile -C $DOWNLOAD_DIR >/dev/null 2>&1 fault_code="$?" if [ "$fault_code" = "0" ]; then - cp $DOWNLOAD_DIR/config/* /etc/config/ + if [ -d $ $DOWNLOAD_DIR/config/ ] + cp -R $DOWNLOAD_DIR/config/* /etc/config/ + else + cp -R $DOWNLOAD_DIR/* / + fi fi else /sbin/uci import < $dwfile