[CONTACT]

[ABOUT]

[POLICY]

Log gph Files gph Refs gph

Found at: gopher.r-36.net:70/scm/conn/commit/072ff182b614a4a41d1642ad8024ae7cb145d2f9.gph

Adding a configuration scheme. - conn - A script repository to manage connections in Linux.

Log

Files

Refs

LICENSE

---

commit 072ff182b614a4a41d1642ad8024ae7cb145d2f9

parent 48e1c78b9c68f7fd5d8bd78e33f600f774cd1c29

Author: Christoph Lohmann <20h@r-36.net>

Date:   Tue, 15 Mar 2011 10:11:11 +0100
Adding a configuration scheme.
Diffstat:
  Makefile                            |       4 +++-
  etc/conn/common.sh                  |      25 +++----------------------
  etc/conn/config.sh                  |      94 +++++++++++++++++++++++++++++++
3 files changed, 100 insertions(+), 23 deletions(-)
---

diff --git a/Makefile b/Makefile

@@ -28,7 +28,7 @@ pm:
 etc:
         @echo installing etc files into ${DESTDIR}/etc/conn
         @mkdir -p ${DESTDIR}/etc/conn
-        @cp -R etc/conn ${DESTDIR}/etc/conn
+        @cp -R etc/conn/* ${DESTDIR}/etc/conn
 bin:
         @echo installing conn script to ${DESTDIR}${PREFIX}/bin
@@ -40,6 +40,8 @@ install: bin etc pm
         @echo For installing the connection examples run:
         @echo '                make examples'
         @echo
+        @echo Please change ${DESTDIR}/etc/conn/config.sh to your needs.
+        @echo
 uninstall:
         @echo removing conn script from ${DESTDIR}${PREFIX}/bin

diff --git a/etc/conn/common.sh b/etc/conn/common.sh

@@ -1,22 +1,13 @@
 #!/bin/sh
-LOGGING=1
-DEBUG=0
-
-# 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"
+. /etc/conn/config.sh
 t[ $DEBUG -eq 1 ] && set -x
 ## Common dirs
-RUNDIR="/var/run/conn"
-ETCDIR="/etc/conn"
 WIFIDIR="${ETCDIR}/wifi"
 WWANDIR="${ETCDIR}/wwan"
 ETHDIR="${ETCDIR}/eth"
-STATEDIR="/var/state/conn"
 mkpaths() {
         for i in $RUNDIR $STATEDIR;
@@ -105,11 +96,7 @@ getdefaultstate() {
 ## WPA handling
 WPAPID="${RUNDIR}/wpa_supplicant.pid"
-WPACONF="/etc/wpa_supplicant.conf"
-WPACMD="/usr/sbin/wpa_supplicant -B -D wext -c ${WPACONF}"
 WPACLIPID="${RUNDIR}/wpa_cli.pid"
-WPACLICMD="/usr/sbin/wpa_cli"
-WPACLIREQ="/usr/sbin/wpa_cli"
 startwpa() {
         $WPACMD -i $1
@@ -136,10 +123,6 @@ getssid() {
 }
 ## DHCP handling
-DHCPCMD="/sbin/dhcpcd -L"
-DHCPRELEASECMD="/sbin/dhcpcd -k"
-DHCPKILLCMD="/sbin/dhcpcd -x"
-
 startdhcp() {
         $DHCPRELEASECMD $1 2>&1 >/dev/null
         $DHCPCMD $1 2>&1 >/dev/null
@@ -163,11 +146,9 @@ runconnection() {
 ## Interface handling
 PINGPID="${RUNDIR}/pingd.pid"
-# Should be available everywhere.
-PINGHOST="8.8.8.8"
-PINGCMD="/bin/ping -q"
+
 startpingd() {
-        $PINGCMD $PINGHOST 2>&1 >/dev/null &
+        ping -q $PINGHOST 2>&1 >/dev/null &
         echo $! > $PINGPID.$1
 }

diff --git a/etc/conn/config.sh b/etc/conn/config.sh

@@ -0,0 +1,94 @@
+#!/bin/sh
+
+#
+# 0 = do not log to syslog
+# 1 = use syslog
+#
+LOGGING=1
+
+#
+# 0 = do not print debug messages on stdout
+# 1 = do print debug messages on stdout
+#
+DEBUG=0
+
+#
+# Which connection should be used, when this is not a wakup and no other
+# connection has been started before. If this is unset, all invocations of
+# conn -s will need to specify a connection.
+#
+DEFAULTCONNECTION="wifi"
+
+#
+# Which profile in this connection should be used. If this is unset, the
+# default profile of the connection will be used. (See the corresponding
+# connection for this setting.)
+#
+DEFAULTPROFILE="wlan0"
+
+#
+# This will set in which directory the pid files are stored.
+#
+RUNDIR="/var/run/conn"
+
+#
+# This should be the directory, where conn is storing its connections.
+#
+# CAUTION! This path is hardcoded in common.sh!
+#
+ETCDIR="/etc/conn"
+
+#
+# In this directory the states (which connections are running and conn-
+# ection specific states) are stored.
+#
+STATEDIR="/var/state/conn"
+
+#
+# Set this variable to the location of the wpa_supplicant.conf, which
+# should be used in the "wifi" connection.
+#
+WPACONF="/etc/wpa_supplicant.conf"
+
+#
+# This is the command, which will be run when invoking wpa_supplicant.
+# The dynamic values are appended to this string. Just the WPACONF needs
+# to be used at the right place.
+#
+WPACMD="wpa_supplicant -B -D wext -c ${WPACONF}"
+
+#
+# The command for starting the action script. In the wpa_supplicant
+# world this is wpa_cli.
+#
+WPACLICMD="wpa_cli"
+
+#
+# This is the command for retrieving information about access points.
+#
+WPACLIREQ="wpa_cli"
+
+#
+# If DHCP is used somewhere, this command will be used.
+#
+DHCPCMD="dhcpcd -L"
+
+#
+# If a lease needs to be released, this one is run.
+#
+DHCPRELEASECMD="dhcpcd -k"
+
+#
+# For killing DHCP on a device, this one is run.
+#
+DHCPKILLCMD="dhcpcd -x"
+
+#
+# A connection like wwan has proven in empirical studies, that it is
+# worth to run a constant ping for keeping it alive.
+#
+# The host we are pinging, by default is set to 8.8.8.8, which is om-
+# niscient Google.
+#
+PINGHOST="8.8.8.8"
+
.


AD: