diff options
author | Andrii Pientsov <andrii.pientsov@globallogic.com> | 2020-05-23 10:09:15 +0300 |
---|---|---|
committer | Andrii Pientsov <andrii.pientsov@globallogic.com> | 2020-05-23 10:09:15 +0300 |
commit | e0d7185cbf41d7921acdb90bcac898f5e9786848 (patch) | |
tree | 74c8398c840eded3436fab64bed9ea4b5f5f27b7 /recipes-core/mlinux-scripts/mlinux-scripts-1.2/mlinux-set-apn | |
parent | 4547de32517aac4a6cc63b5ae65664017cd88a76 (diff) | |
download | meta-mlinux-atmel-e0d7185cbf41d7921acdb90bcac898f5e9786848.tar.gz meta-mlinux-atmel-e0d7185cbf41d7921acdb90bcac898f5e9786848.tar.bz2 meta-mlinux-atmel-e0d7185cbf41d7921acdb90bcac898f5e9786848.zip |
Remove duplicate mlinux-scripts. Leave only mtbsp-at91 specific scripts.
Diffstat (limited to 'recipes-core/mlinux-scripts/mlinux-scripts-1.2/mlinux-set-apn')
-rwxr-xr-x | recipes-core/mlinux-scripts/mlinux-scripts-1.2/mlinux-set-apn | 117 |
1 files changed, 0 insertions, 117 deletions
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 deleted file mode 100755 index ebe8096..0000000 --- a/recipes-core/mlinux-scripts/mlinux-scripts-1.2/mlinux-set-apn +++ /dev/null @@ -1,117 +0,0 @@ -#!/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 |