summaryrefslogtreecommitdiff
path: root/multitech/recipes/ocg-scripts/ocg-scripts-1.0/ocg-set-apn
diff options
context:
space:
mode:
Diffstat (limited to 'multitech/recipes/ocg-scripts/ocg-scripts-1.0/ocg-set-apn')
-rwxr-xr-xmultitech/recipes/ocg-scripts/ocg-scripts-1.0/ocg-set-apn20
1 files changed, 20 insertions, 0 deletions
diff --git a/multitech/recipes/ocg-scripts/ocg-scripts-1.0/ocg-set-apn b/multitech/recipes/ocg-scripts/ocg-scripts-1.0/ocg-set-apn
new file mode 100755
index 0000000..5c3985f
--- /dev/null
+++ b/multitech/recipes/ocg-scripts/ocg-scripts-1.0/ocg-set-apn
@@ -0,0 +1,20 @@
+#!/bin/bash
+
+if [[ $# != 1 ]]; then
+ echo "Usage: $(basename $0) APN"
+ exit 1
+fi
+
+apn=$1
+chat_file=/etc/ppp/peers/gsm_chat
+
+sed -r -i "s/^OK\s+'AT\+CGDCONT=1,\"IP\",\"[^\"]*\"'$/OK 'AT\+CGDCONT=1,\"IP\",\"${apn}\"'/" $chat_file
+
+if [[ $? != 0 ]]; then
+ echo "Failed to change APN"
+ exit 1
+else
+ echo "Set APN to \"${apn}\" in $chat_file"
+fi
+
+exit 0