aboutsummaryrefslogtreecommitdiffstats
path: root/package/network/utils/layerscape/restool/patches/0007-scripts-use-Bourne-shell-s-pattern-matching.patch
diff options
context:
space:
mode:
authorYangbo Lu <yangbo.lu@nxp.com>2017-10-18 10:37:58 +0800
committerJohn Crispin <john@phrozen.org>2017-11-10 23:00:47 +0100
commit23c1504059e187a279296bc827878c8dc314cc05 (patch)
treef1c71d63bc0ee8802de9931d189c35148dbb6567 /package/network/utils/layerscape/restool/patches/0007-scripts-use-Bourne-shell-s-pattern-matching.patch
parent1e0276a39af1094cff925148cc8340fc1893056d (diff)
downloadupstream-23c1504059e187a279296bc827878c8dc314cc05.tar.gz
upstream-23c1504059e187a279296bc827878c8dc314cc05.tar.bz2
upstream-23c1504059e187a279296bc827878c8dc314cc05.zip
layerscape: add restool package
restool is a user space application providing the ability to dynamically create and manage Layerscape DPAA2 containers and objects from Linux. Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
Diffstat (limited to 'package/network/utils/layerscape/restool/patches/0007-scripts-use-Bourne-shell-s-pattern-matching.patch')
-rw-r--r--package/network/utils/layerscape/restool/patches/0007-scripts-use-Bourne-shell-s-pattern-matching.patch126
1 files changed, 126 insertions, 0 deletions
diff --git a/package/network/utils/layerscape/restool/patches/0007-scripts-use-Bourne-shell-s-pattern-matching.patch b/package/network/utils/layerscape/restool/patches/0007-scripts-use-Bourne-shell-s-pattern-matching.patch
new file mode 100644
index 0000000000..ed9d76d454
--- /dev/null
+++ b/package/network/utils/layerscape/restool/patches/0007-scripts-use-Bourne-shell-s-pattern-matching.patch
@@ -0,0 +1,126 @@
+From e1036011baf9204d5fe6dd74e5a65f95b9681ebd Mon Sep 17 00:00:00 2001
+From: Ioana Ciornei <ioana.ciornei@nxp.com>
+Date: Tue, 24 Oct 2017 16:29:56 +0000
+Subject: [PATCH 07/12] scripts: use Bourne shell's pattern matching
+
+Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
+---
+ scripts/ls-main | 71 ++++++++++++++++++++++++++++-----------------------------
+ 1 file changed, 35 insertions(+), 36 deletions(-)
+
+diff --git a/scripts/ls-main b/scripts/ls-main
+index b0c742e..a8b9573 100755
+--- a/scripts/ls-main
++++ b/scripts/ls-main
+@@ -72,8 +72,6 @@
+ #
+ ##
+
+-shopt -s extglob
+-
+ # Intercept the Ctrl+C command but do not interrupt execution
+ trap ' ' INT
+
+@@ -370,15 +368,16 @@ process_addmux() {
+ -c=* | --container=*)
+ container="${i#*=}"
+ ;;
+- *(dprc.+([0-9])/)dpmac.+([0-9]))
+- endpoint="${i#*=}"
+- ;;
+- *(dprc.+([0-9])/)dpni.+([0-9]))
+- endpoint="${i#*=}"
+- ;;
+ *)
+- usage_addmux
+- exit 1
++ arg_dpmac="$(echo $i | grep -x -E "(dprc.[0-9]+/)*dpmac.[0-9]+" || true )"
++ arg_dpni="$(echo $i | grep -x -E "(dprc.+[0-9]+/)*dpni.[0-9]+" || true )"
++ if [ "$i" = "$arg_dpmac" ] ||
++ [ "$i" = "$arg_dpni" ]; then
++ endpoint="$i"
++ else
++ usage_addmux
++ exit 1
++ fi
+ ;;
+ esac
+ done
+@@ -560,14 +559,17 @@ process_addsw() {
+ -c=* | --container=*)
+ container="${i#*=}"
+ ;;
+- @(dpni|dpmac).+([0-9]))
+- endpoint="${endpoint}"$'\n'"${i}"
+- ifcnt=$((ifcnt + 1))
+- ;;
+ *)
+- echo "Error: $i argument is invalid"
+- usage_addsw
+- exit 1
++ arg_dpmac="$(echo $i | grep -x -E "dpmac.[0-9]+" || true )"
++ arg_dpni="$(echo $i | grep -x -E "dpni.[0-9]+" || true )"
++ if [ "$i" = "$arg_dpmac" ] ||
++ [ "$i" = "$arg_dpni" ]; then
++ endpoint="$i"
++ else
++ echo "Error: $i argument is invalid"
++ usage_addsw
++ exit 1
++ fi
+ ;;
+ esac
+ done
+@@ -704,7 +706,8 @@ process_addni() {
+ ;;
+ --mac-addr=*)
+ mac_addr="${i#*=}"
+- if [[ ! "$mac_addr" =~ ^([a-fA-F0-9]{2}:){5}[a-fA-F0-9]{2}$ ]]; then
++ mac_addr_valid="$(echo $mac_addr | grep -x -E "^([a-fA-F0-9]{2}:){5}[a-fA-F0-9]{2}$" || true )"
++ if [ "$mac_addr" != "$mac_addr_valid" ]; then
+ echo "Invalid MAC address: $mac_addr"
+ exit 1
+ fi
+@@ -776,25 +779,21 @@ process_addni() {
+ -o=* | --options=*)
+ options="${i#*=}"
+ ;;
+- *(dprc.+([0-9])/)dpmac.+([0-9]))
+- no_link=0
+- endpoint="${i#*=}"
+- ;;
+- *(dprc.+([0-9])/)dpni.+([0-9]))
+- no_link=0
+- endpoint="${i#*=}"
+- ;;
+- *(dprc.+([0-9])/)dpdmux.+([0-9]).+([0-9]))
+- no_link=0
+- endpoint="${i#*=}"
+- ;;
+- *(dprc.+([0-9])/)dpsw.+([0-9]).+([0-9]))
+- no_link=0
+- endpoint="${i#*=}"
+- ;;
+ *)
+- usage_addni
+- exit 1
++ arg_dpmac="$(echo $i | grep -x -E "(dprc.[0-9]+/)*dpmac.[0-9]+" || true )"
++ arg_dpni="$(echo $i | grep -x -E "(dprc.+[0-9]+/)*dpni.[0-9]+" || true )"
++ arg_dpdmux="$(echo $i | grep -x -E "(dprc.[0-9]+/)*dpdmux.[0-9]+.[0-9]+" || true )"
++ arg_dpsw="$(echo $i | grep -x -E "(dprc.[0-9]+/)*dpsw.[0-9]+.[0-9]+" || true )"
++ if [ "$i" = "$arg_dpmac" ] ||
++ [ "$i" = "$arg_dpni" ] ||
++ [ "$i" = "$arg_dpdmux" ] ||
++ [ "$i" = "$arg_dpsw" ]; then
++ no_link=0
++ endpoint="$i"
++ else
++ usage_addni
++ exit 1
++ fi
+ ;;
+ esac
+ done
+--
+2.14.1
+