summaryrefslogtreecommitdiff
path: root/multitech/recipes/ocg-scripts/ocg-scripts-1.0/ocg-set-apn
blob: 867c24e20b61e72ec30b12b899272054295b17dd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/bin/bash

if [[ $# != "1" ]]; then
	echo "Usage: $(basename $0) APN"
	exit 1
fi

apn=$1

sed -r -i "s/^OK\s+'AT\+CGDCONT=1,\"IP\",\"[^\"]*\"'$/OK 'AT\+CGDCONT=1,\"IP\",\"${apn}\"'/" /etc/ppp/peers/gsm_chat

if [[ $? != "0" ]]; then
	echo "Failed to change APN"
	exit 1
else
	echo "Set APN to \"${apn}\""
fi

exit 0