Adding default connection and device support. - conn - A script repository to manage connections in Linux. (DIR) Log (DIR) Files (DIR) Refs (DIR) LICENSE --- (DIR) commit 51c968dacc2d994fe91df0c058e62c337f942126 (DIR) parent 880e428a9e9945969dfcb4011d494341d9c31d17 (HTM) Author: Christoph Lohmann <20h@r-36.net> Date: Wed, 23 Feb 2011 10:09:23 +0100 Adding default connection and device support. Diffstat: etc/conn/common.sh | 7 ++++++- etc/conn/run.sh | 14 ++++++++++++-- 2 files changed, 18 insertions(+), 3 deletions(-) --- (DIR) diff --git a/etc/conn/common.sh b/etc/conn/common.sh @@ -1,7 +1,12 @@ #!/bin/sh LOGGING=0 -DEBUG=0 +DEBUG=1 + +# If none is set, a connection always needs to be specified. +DEFAULTCONNECTION="wifi" +# Can be set to nothing, but then the connection will use its default. +DEFAULTPROFILE="wlan0" t[ $DEBUG -eq 1 ] && set -x (DIR) diff --git a/etc/conn/run.sh b/etc/conn/run.sh @@ -2,13 +2,23 @@ . ./common.sh +profile=$3 connection=$2 +t[ "$2" == "" ] && [ "$DEFAULTCONNECTION" != "" ] \ + && connection="$DEFAULTCONNECTION" \ + && profile="$DEFAULTPROFILE" case "$1" in -s|-k|-u) arg=$1 - shift 2 - runconnection $connection $arg $* + if [ $# -lt 3 ]; + then + shift $# + else + shift 3 + fi + + runconnection $connection $arg $profile $* exit $? ;; -l)