summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuuso Alasuutari2006-06-14 09:43:56 -0100
committerJuuso Alasuutari2006-06-14 09:43:56 -0100
commit34a26f1fc59a441fa3f7cb23980461b667269049 (patch)
tree6b2209e17b8542db73726fd580a24beb25420ee2
parent233b8e51538796d80bd6d723f34fcdade22edc90 (diff)
Bashified init script to make it faster -> test.
-rwxr-xr-xnet/ifplugd/DETAILS2
-rw-r--r--net/ifplugd/HISTORY4
-rwxr-xr-xnet/ifplugd/init.d/ifplugd28
3 files changed, 19 insertions, 15 deletions
diff --git a/net/ifplugd/DETAILS b/net/ifplugd/DETAILS
index 64530792fa..07df55847b 100755
--- a/net/ifplugd/DETAILS
+++ b/net/ifplugd/DETAILS
@@ -7,7 +7,7 @@ SOURCE_DIRECTORY=$BUILD_DIRECTORY/$SPELL-$VERSION
WEB_SITE=http://0pointer.de/lennart/projects/ifplugd/
ENTERED=20031017
UPDATED=20040826
- PATCHLEVEL=2
+ PATCHLEVEL=3
LICENSE[0]=GPL
BUILD_API=2
KEYWORDS="net link connection cable plugged"
diff --git a/net/ifplugd/HISTORY b/net/ifplugd/HISTORY
index bee5ba443f..3936d58c23 100644
--- a/net/ifplugd/HISTORY
+++ b/net/ifplugd/HISTORY
@@ -1,3 +1,7 @@
+2006-06-14 Juuso Alasuutari <iuso@sourcemage.org>
+ * init.d/ifplugd: Bashified init script to make it faster.
+ * DETAILS: Updated PATCHLEVEL.
+
2006-06-13 Juuso Alasuutari <iuso@sourcemage.org>
* PRE_BUILD: Hacked $SOURCE_DIRECTORY/conf/Makefile.in to not
install ifplugd.conf, we'll do that ourselves to prevent it
diff --git a/net/ifplugd/init.d/ifplugd b/net/ifplugd/init.d/ifplugd
index 196165fd00..aae5549120 100755
--- a/net/ifplugd/init.d/ifplugd
+++ b/net/ifplugd/init.d/ifplugd
@@ -4,43 +4,43 @@ RUNLEVEL=3
NEEDS="+network +remote_fs"
PROGRAM=/usr/sbin/ifplugd
-ifplugdconf=/etc/ifplugd/ifplugd.conf
-dropfile=/var/tmp/ifplugd
+CONFFILE=/etc/ifplugd/ifplugd.conf
+DROPFILE=/var/tmp/ifplugd.drop
-! [ -e $ifplugdconf ] && echo "No config file: $ifplugdconf" && exit 1
-. $ifplugdconf
+[[ ! -f $CONFFILE ]] && echo "No config file: $CONFFILE" && exit 1
+. $CONFFILE
. /etc/init.d/smgl_init
required_executable /usr/sbin/ifplugd
-[ $# -gt 1 ] && INTERFACES="${@/$1/}"
-[ "x$INTERFACES" = "xauto" ] && INTERFACES="`cat /proc/net/dev | awk '{ print $1 }' | egrep '^(eth|wlan)' | cut -d: -f1`"
+(($#>1)) && INTERFACES="${@/$1}"
+[[ $INTERFACES == auto ]] && INTERFACES="$(cat /proc/net/dev | awk '{ print $1 }' | egrep '^(eth|wlan)' | cut -d: -f1)"
start()
{
local STATE
for IF in $INTERFACES; do
echo "Starting daemon on interface $IF..."
- A="`eval builtin echo \$\{ARGS_${IF}\}`"
- [ -z "$A" ] && A="$ARGS"
+ A="$(eval builtin echo \$\{ARGS_${IF}\})"
+ [[ -z $A ]] && A="$ARGS"
$PROGRAM -i $IF $A
STATE=$?
- if [[ $STATE == 2 ]]; then
+ if ((STATE==2)); then
echo "Link up."
unset STATE
- elif [[ $STATE == 3 ]]; then
+ elif ((STATE==3)); then
echo "Link down."
- unset STATE
+ STATE=
fi
(exit $STATE)
evaluate_retval
done
- /bin/echo "INTERFACES=\"$INTERFACES\"" > $dropfile
+ /bin/echo "INTERFACES=\"$INTERFACES\"" > $DROPFILE
}
stop()
{
- [ -e $dropfile ] && . $dropfile && rm $dropfile
+ [[ -f $DROPFILE ]] && . $DROPFILE && rm $DROPFILE
for IF in $INTERFACES; do
echo "Stopping daemon on interface $IF..."
$PROGRAM -k -i $IF -W
@@ -50,7 +50,7 @@ stop()
status()
{
- [ -e $dropfile ] && . $dropfile
+ [[ -f $DROPFILE ]] && . $DROPFILE
for IF in $INTERFACES; do
echo "Status on interface $IF:"
$PROGRAM -c -i $IF