summaryrefslogtreecommitdiff
path: root/recipes-core/mlinux-scripts
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-core/mlinux-scripts')
-rwxr-xr-xrecipes-core/mlinux-scripts/mlinux-scripts-1.1/mlinux-set-apn119
-rw-r--r--recipes-core/mlinux-scripts/mlinux-scripts-1.2/mlinux-cell-radio-ready (renamed from recipes-core/mlinux-scripts/mlinux-scripts-1.1/mlinux-cell-radio-ready)0
-rwxr-xr-xrecipes-core/mlinux-scripts/mlinux-scripts-1.2/mlinux-cell-router (renamed from recipes-core/mlinux-scripts/mlinux-scripts-1.1/mlinux-cell-router)0
-rwxr-xr-xrecipes-core/mlinux-scripts/mlinux-scripts-1.2/mlinux-dhcpd (renamed from recipes-core/mlinux-scripts/mlinux-scripts-1.1/mlinux-dhcpd)0
-rwxr-xr-xrecipes-core/mlinux-scripts/mlinux-scripts-1.2/mlinux-firmware-upgrade (renamed from recipes-core/mlinux-scripts/mlinux-scripts-1.1/mlinux-firmware-upgrade)0
-rwxr-xr-xrecipes-core/mlinux-scripts/mlinux-scripts-1.2/mlinux-set-apn117
-rwxr-xr-xrecipes-core/mlinux-scripts/mlinux-scripts-1.2/mlinux-switch-apn (renamed from recipes-core/mlinux-scripts/mlinux-scripts-1.1/mlinux-switch-apn)0
-rwxr-xr-xrecipes-core/mlinux-scripts/mlinux-scripts-1.2/mlinux-switch-cell-fw (renamed from recipes-core/mlinux-scripts/mlinux-scripts-1.1/mlinux-switch-cell-fw)0
-rwxr-xr-xrecipes-core/mlinux-scripts/mlinux-scripts-1.2/mlinux-wifi-ap (renamed from recipes-core/mlinux-scripts/mlinux-scripts-1.1/mlinux-wifi-ap)0
-rw-r--r--recipes-core/mlinux-scripts/mlinux-scripts_1.2.bb (renamed from recipes-core/mlinux-scripts/mlinux-scripts_1.1.bb)2
10 files changed, 118 insertions, 120 deletions
diff --git a/recipes-core/mlinux-scripts/mlinux-scripts-1.1/mlinux-set-apn b/recipes-core/mlinux-scripts/mlinux-scripts-1.1/mlinux-set-apn
deleted file mode 100755
index 317a3d7..0000000
--- a/recipes-core/mlinux-scripts/mlinux-scripts-1.1/mlinux-set-apn
+++ /dev/null
@@ -1,119 +0,0 @@
-#!/bin/bash
-
-# Copyright (C) 2014,2017 Multi-Tech Systems
-
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-gsm_chat_file=/etc/ppp/peers/gsm_chat
-lvw2_chat_file=/etc/ppp/peers/lvw2_chat
-leu1_chat_file=/etc/ppp/peers/leu1_chat
-lna3_chat_file=/etc/ppp/peers/lna3_chat_non_vz
-lna3_chat_link=/etc/ppp/peers/lna3_chat
-lna3_readme=/etc/ppp/peers/README.lna3
-lap3_chat_file=/etc/ppp/peers/lap3_chat
-lsp3_chat_file=/etc/ppp/peers/lsp3_chat
-
-function usage {
- echo "Usage: $(basename $0) [--] APN"
- echo "Or $(basename $0) -c to clear the APN line"
- echo "-- is requied if the APN begins with -"
- exit 1
-}
-
-
-((clear=0))
-if (($# < 1)); then
- usage
-fi
-if [[ $1 == "--" ]] ; then
- apn=$2
-elif [[ $1 == "-c" ]] ; then
- clear=1
-elif [[ $1 =~ ^- ]] ; then
- usage
-else
- apn=$1
-fi
-
-radioproduct=$(/usr/sbin/mts-io-sysfs show product-id) # LNA3?
-
-if (($? != 0)) ; then
- echo "Radio is not ready or not found and cannot determine the type"
- exit 1
-fi
-
-# Disable the LNA3 chat script
-if ! [[ -L $lna3_chat_link ]] || [[ $(basename $(readlink -f $lna3_chat_link)) != README.lna3 ]] ; then
- ln -sf "${lna3_readme}" "${lna3_chat_link}"
- echo Disabling LNA3 chat script.
-fi
-
-if ((clear != 1)) ; then
- if sed -r -i "s/^(#comment by mlinux-set-apn )*OK\s+'AT\+CGDCONT=([0-9]*),\"([^\"]*)\",\"[^\"]*\"'$/OK 'AT\+CGDCONT=\2,\"\3\",\"${apn}\"'/" $gsm_chat_file ; then
- echo "Set APN to \"${apn}\" in $gsm_chat_file"
- else
- echo "Failed to set APN in $gsm_chat_file"
- fi
- echo "Not allowed to set APN for $lsp3_chat_file"
- echo "Not allowed to set APN for $lvw2_chat_file"
- # We cannot set the APN for a Verizon modem
- # sed -r -i "s/^(#comment by mlinux-set-apn )*OK\s+'AT\+CGDCONT=3,\"IPV4V6\",\"[^\"]*\"'$/OK 'AT\+CGDCONT=3,\"IPV4V6\",\"${apn}\"'/" $lvw2_chat_file
- if sed -r -i "s/^(#comment by mlinux-set-apn )*OK\s+'AT\+CGDCONT=([0-9]*),\"([^\"]*)\",\"[^\"]*\"'$/OK 'AT\+CGDCONT=\2,\"\3\",\"${apn}\"'/" $leu1_chat_file ; then
- echo "Set APN to \"${apn}\" in $leu1_chat_file"
- else
- echo "Failed to set APN in $leu1_chat_file"
- fi
- if sed -r -i "s/^(#comment by mlinux-set-apn )*OK\s+'AT\+CGDCONT=([0-9]*),\"([^\"]*)\",\"[^\"]*\"'$/OK 'AT\+CGDCONT=\2,\"\3\",\"${apn}\"'/" $lna3_chat_file ; then
- echo "Set APN to \"${apn}\" in $lna3_chat_file"
- else
- echo "Failed to set APN in $lna3_chat_file"
- fi
- if sed -r -i "s/^(#comment by mlinux-set-apn )*OK\s+'AT\+CGDCONT=([0-9]*),\"([^\"]*)\",\"[^\"]*\"'$/OK 'AT\+CGDCONT=\2,\"\3\",\"${apn}\"'/" $lap3_chat_file ; then
- echo "Set APN to \"${apn}\" in $lap3_chat_file"
- else
- echo "Failed to set APN in $lap3_chat_file"
- fi
-else
- if sed -r -i "s/^(OK\s+'AT\+CGDCONT=[0-9]*,\"[^\"]*\",\"[^\"]*\"'$)/#comment by mlinux-set-apn \1/" $gsm_chat_file ; then
- echo "Commented out APN in $gsm_chat_file"
- else
- echo "Failed to comment out APN in $gsm_chat_file"
- fi
- # Not setting APN in lvw2 is OK, since Verizon should not have an APN in a chat file.
- if sed -r -i "s/^(OK\s+'AT\+CGDCONT=[0-9]*,\"[^\"]*\",\"[^\"]*\"'$)/#comment by mlinux-set-apn \1/" $lvw2_chat_file ; then
- echo "Commented out APN in $lvw2_chat_file"
- fi
- if sed -r -i "s/^(OK\s+'AT\+CGDCONT=[0-9]*,\"[^\"]*\",\"[^\"]*\"'$)/#comment by mlinux-set-apn \1/" $leu1_chat_file ; then
- echo "Commented out APN in $leu1_chat_file"
- else
- echo "Failed to comment out APN in $leu1_chat_file"
- fi
- if sed -r -i "s/^(OK\s+'AT\+CGDCONT=[0-9]*,\"[^\"]*\",\"[^\"]*\"'$)/#comment by mlinux-set-apn \1/" $lna3_chat_file ; then
- echo "Commented out APN in $lna3_chat_file"
- else
- echo "Failed to comment out APN in $lna3_chat_file"
- fi
- if sed -r -i "s/^(OK\s+'AT\+CGDCONT=[0-9]*,\"[^\"]*\",\"[^\"]*\"'$)/#comment by mlinux-set-apn \1/" $lap3_chat_file ; then
- echo "Commented out APN in $lap3_chat_file"
- else
- echo "Failed to comment out APN in $lap3_chat_file"
- fi
-fi
-
-exit 0
diff --git a/recipes-core/mlinux-scripts/mlinux-scripts-1.1/mlinux-cell-radio-ready b/recipes-core/mlinux-scripts/mlinux-scripts-1.2/mlinux-cell-radio-ready
index 42c5cdc..42c5cdc 100644
--- a/recipes-core/mlinux-scripts/mlinux-scripts-1.1/mlinux-cell-radio-ready
+++ b/recipes-core/mlinux-scripts/mlinux-scripts-1.2/mlinux-cell-radio-ready
diff --git a/recipes-core/mlinux-scripts/mlinux-scripts-1.1/mlinux-cell-router b/recipes-core/mlinux-scripts/mlinux-scripts-1.2/mlinux-cell-router
index 1607c32..1607c32 100755
--- a/recipes-core/mlinux-scripts/mlinux-scripts-1.1/mlinux-cell-router
+++ b/recipes-core/mlinux-scripts/mlinux-scripts-1.2/mlinux-cell-router
diff --git a/recipes-core/mlinux-scripts/mlinux-scripts-1.1/mlinux-dhcpd b/recipes-core/mlinux-scripts/mlinux-scripts-1.2/mlinux-dhcpd
index 976b138..976b138 100755
--- a/recipes-core/mlinux-scripts/mlinux-scripts-1.1/mlinux-dhcpd
+++ b/recipes-core/mlinux-scripts/mlinux-scripts-1.2/mlinux-dhcpd
diff --git a/recipes-core/mlinux-scripts/mlinux-scripts-1.1/mlinux-firmware-upgrade b/recipes-core/mlinux-scripts/mlinux-scripts-1.2/mlinux-firmware-upgrade
index a377309..a377309 100755
--- a/recipes-core/mlinux-scripts/mlinux-scripts-1.1/mlinux-firmware-upgrade
+++ b/recipes-core/mlinux-scripts/mlinux-scripts-1.2/mlinux-firmware-upgrade
diff --git a/recipes-core/mlinux-scripts/mlinux-scripts-1.2/mlinux-set-apn b/recipes-core/mlinux-scripts/mlinux-scripts-1.2/mlinux-set-apn
new file mode 100755
index 0000000..ebe8096
--- /dev/null
+++ b/recipes-core/mlinux-scripts/mlinux-scripts-1.2/mlinux-set-apn
@@ -0,0 +1,117 @@
+#!/bin/bash
+
+# Copyright (C) 2014,2017,2019 Multi-Tech Systems
+
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+noapn_modems=(lvw2 lsp3 cdma)
+
+# Comment out AT+CGDCONT= statement
+remove_apn_sedcmd="s/^(OK[[:space:]]+'|#MT[[:space:]]+)(AT\+CGDCONT=[0-9]+[^\']*)'*/#comment by mlinux-set-apn \2/"
+
+
+
+function usage {
+ echo "Usage: $(basename $0) [--] APN"
+ echo "Or $(basename $0) -c to clear the APN line"
+ echo "-- is requied if the APN begins with -"
+ exit 1
+}
+
+
+((clear=0))
+if (($# < 1)); then
+ usage
+fi
+if [[ $1 == "--" ]] ; then
+ apn=$2
+elif [[ $1 == "-c" ]] ; then
+ clear=1
+elif [[ $1 =~ ^- ]] ; then
+ usage
+else
+ apn=$1
+fi
+
+
+set_apn_sedcmd="s/^(#comment by mlinux-set-apn )*(OK[[:space:]]+'|#MT[[:space:]]+)*AT\+CGDCONT=([0-9]+),\"([^\"]*)\",\"[^\"]*\".*/#MT AT\+CGDCONT=\3,\"\4\",\"${apn}\"/"
+
+
+
+getmodem()
+{
+ radioproduct=$(/usr/sbin/mts-io-sysfs show product-id) # LNA3?
+ if (($? != 0)) ; then
+ echo "Radio is not ready or not found and cannot determine the type"
+ exit 1
+ fi
+ if [[ $radioproduct =~ [^-]*-([^-]*)- ]] ; then
+ echo "${BASH_REMATCH[1]}"
+ fi
+}
+function findItem
+{
+ local s check="$1"
+ shift
+ for s ; do [[ "$s" == "$check" ]] && return 0; done
+ return 1
+}
+
+
+cd /var/config/ppp/peers
+if ((clear != 1)) ; then
+ for f in $noapn ; do
+ echo "Not allowed to set APN for $f"
+ done
+
+ for f in *_chat *_chat_non_vz ; do
+ if [[ -L $f ]] ; then
+ continue
+ fi
+ [[ $f =~ ([^_]*) ]]
+ m=${BASH_REMATCH[1]}
+ if findItem "$m" "${noapn_modems[@]}" ; then
+ continue
+ fi
+
+ if sed -r -i "${set_apn_sedcmd}" ${f}; then
+ echo "Set APN to \"${apn}\" in ${f}"
+ if ! grep -q /usr/libexec/ppp/chat_wrapper ${m} ; then
+ sed -i "s?connect '/usr/sbin/chat?connect '/usr/libexec/ppp/chat_wrapper /usr/sbin/chat?" ${m}
+ fi
+ else
+ echo "Failed to set APN in $f_chat"
+ fi
+ done
+else
+ for f in *_chat *_chat_non_vz ; do
+ if sed -i -r "${remove_apn_sedcmd}" $f ; then
+ echo "Commented out APN in $f"
+ else
+ if [[ $f =~ ([^_]*) ]] ; then
+ m=${BASH_REMATCH[1]}
+ if ! findItem "$m" "${noapn_modems[@]}" ; then
+ echo "Failed to remove APN setting in $f"
+ fi
+ fi
+ fi
+ done
+fi
+
+exit 0
diff --git a/recipes-core/mlinux-scripts/mlinux-scripts-1.1/mlinux-switch-apn b/recipes-core/mlinux-scripts/mlinux-scripts-1.2/mlinux-switch-apn
index 535ab17..535ab17 100755
--- a/recipes-core/mlinux-scripts/mlinux-scripts-1.1/mlinux-switch-apn
+++ b/recipes-core/mlinux-scripts/mlinux-scripts-1.2/mlinux-switch-apn
diff --git a/recipes-core/mlinux-scripts/mlinux-scripts-1.1/mlinux-switch-cell-fw b/recipes-core/mlinux-scripts/mlinux-scripts-1.2/mlinux-switch-cell-fw
index 9edacac..9edacac 100755
--- a/recipes-core/mlinux-scripts/mlinux-scripts-1.1/mlinux-switch-cell-fw
+++ b/recipes-core/mlinux-scripts/mlinux-scripts-1.2/mlinux-switch-cell-fw
diff --git a/recipes-core/mlinux-scripts/mlinux-scripts-1.1/mlinux-wifi-ap b/recipes-core/mlinux-scripts/mlinux-scripts-1.2/mlinux-wifi-ap
index ddbec95..ddbec95 100755
--- a/recipes-core/mlinux-scripts/mlinux-scripts-1.1/mlinux-wifi-ap
+++ b/recipes-core/mlinux-scripts/mlinux-scripts-1.2/mlinux-wifi-ap
diff --git a/recipes-core/mlinux-scripts/mlinux-scripts_1.1.bb b/recipes-core/mlinux-scripts/mlinux-scripts_1.2.bb
index 0dfd740..05c1b84 100644
--- a/recipes-core/mlinux-scripts/mlinux-scripts_1.1.bb
+++ b/recipes-core/mlinux-scripts/mlinux-scripts_1.2.bb
@@ -2,6 +2,6 @@ DESCRIPTION = "Scripts to easily get started with common mLinux use cases"
require mlinux-scripts.inc
-PR = "r5"
+PR = "r1"
S = "${WORKDIR}/mlinux-scripts-${PV}"