blob: 86ab37b42604c20daed9533d4f63dfe11a60bb18 [file] [log] [blame]
# Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
# Set the APN to be used when making connections on a cellular
# service.
FLAGS_HELP="Usage:
$(basename $0)
or
$(basename $0) [true | false]
"
FLIMFLAM=org.chromium.flimflam
IMANAGER=$FLIMFLAM.Manager
usage() {
echo $*
echo
echo $FLAGS_HELP
exit 1
}
dbus () {
local obj=$1
local meth=$2
shift 2
dbus-send --system --print-reply --fixed --dest=$FLIMFLAM "$obj" "$meth" "$@"
}
get_manager () {
dbus / $IMANAGER.GetProperties | sed -n "/$1/s/.* //p"
}
display_arpgw () {
local arpgw=$(get_manager ArpGateway)
if [ -n "$arpgw" ] ; then
echo "Current Gateway ARP setting: " $arpgw
exit 0
fi
echo "This Flimflam instance does not support ArpGateway"
exit 0
}
if [ $# -lt 1 ]; then
display_arpgw
fi
set_arpgw=$1
if [ $set_arpgw != false -a $set_arpgw != true ] ; then
usage "Argument must be 'true' or 'false'"
fi
dbus / $IMANAGER.SetProperty string:"ArpGateway" variant:boolean:$set_arpgw