aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJudd Vinet <judd@archlinux.org>2005-09-15 20:05:07 (GMT)
committerJudd Vinet <judd@archlinux.org>2005-09-15 20:05:07 (GMT)
commite772aeae76f2ad704a834dc17df02dbc137a6573 (patch)
tree954dcf245b4eedb69badab02e5b22459364c5cb2
parent0be8f5b2d33fc6160e2a62d33fc1f828218fa90a (diff)
downloadinitscripts-e772aeae76f2ad704a834dc17df02dbc137a6573.tar.xz
modified netcfg/network scripts -- you can list multiple entries in NET_PROFILES that use the same INTERFACE. They will be started one at a time, and the first successful one will be kept.
-rwxr-xr-xnetcfg9
-rwxr-xr-xnetwork4
-rw-r--r--rc.conf12
-rwxr-xr-xrc.local5
-rwxr-xr-xrc.multi7
-rwxr-xr-xrc.shutdown2
-rwxr-xr-xrc.single4
7 files changed, 25 insertions, 18 deletions
diff --git a/netcfg b/netcfg
index 70dd342..4de5052 100755
--- a/netcfg
+++ b/netcfg
@@ -19,11 +19,14 @@ usage()
{
version
echo
- echo "usage: netcfg <profile_name>"
+ echo "usage: netcfg [options] <profile_name>"
echo " netcfg --stop <interface>"
echo " netcfg --menu [--timeout <secs>]"
echo " netcfg --stopall"
echo
+ echo "options:"
+ echo " -c Don't reconfigure an interface if it's already up"
+ echo
echo "Network profiles are stored in $PROFILE_DIR"
echo
}
@@ -77,6 +80,8 @@ start_profile()
# Read the profile
. $PROFILE_DIR/$1
+ [ "$CHECK" = "1" -a -f $STATE_DIR/$INTERFACE ] && return
+
# Shut down any profiles tied to this interface
stop_profile $INTERFACE
@@ -208,6 +213,7 @@ fi
# Parse command line
MODE="profile"
+CHECK=0
PROFILE=
IFACE=
TIMEOUT=
@@ -223,6 +229,7 @@ while [ $# -ne 0 ]; do
--timeout) shift
TIMEOUT=$1 ;;
--*) MODE="usage" ;;
+ -c) CHECK=1 ;;
-*) MODE="usage" ;;
*) PROFILE=$1 ;;
esac
diff --git a/network b/network
index d9f5605..23629bf 100755
--- a/network
+++ b/network
@@ -172,7 +172,7 @@ case "$1" in
else
for prof in ${NET_PROFILES[@]}; do
if [ "$prof" = "${prof#!}" ]; then
- /usr/bin/netcfg $prof
+ /usr/bin/netcfg -c $prof
fi
done
fi
@@ -245,3 +245,5 @@ case "$1" in
echo "usage: $0 {start|stop|restart}"
echo " $0 {ifup|ifdown|iflist|rtup|rtdown|rtlist}"
esac
+
+# vim: set ts=2 noet:
diff --git a/rc.conf b/rc.conf
index a66e0ee..3ff63b3 100644
--- a/rc.conf
+++ b/rc.conf
@@ -36,7 +36,7 @@ MODULES=(!usbserial !ide-scsi)
#
# Interfaces to start at boot-up (in this order)
# Declare each interface then list in INTERFACES
-# (prefix an interface in INTERFACES with a ! to disable it)
+# - prefix an entry in INTERFACES with a ! to disable it
#
# Note: to use DHCP, set your interface to be "dhcp" (eth0="dhcp")
#
@@ -47,7 +47,7 @@ INTERFACES=(lo eth0)
#
# Routes to start at boot-up (in this order)
# Declare each route then list in ROUTES
-# (prefix a route in ROUTES with a ! to disable it)
+# - prefix an entry in ROUTES with a ! to disable it
#
gateway="default gw 192.168.0.1"
ROUTES=(!gateway)
@@ -55,8 +55,8 @@ ROUTES=(!gateway)
#
# Enable these network profiles at boot-up. These are only useful
# if you happen to need multiple network configurations (ie, laptop users)
-# (set to 'menu' to present a menu during boot-up)
-# (prefix with a ! to disable)
+# - set to 'menu' to present a menu during boot-up
+# - prefix an entry with a ! to disable it
#
# Network profiles are found in /etc/network-profiles
#
@@ -64,8 +64,8 @@ ROUTES=(!gateway)
#
# Daemons to start at boot-up (in this order)
-# (prefix a daemon with a ! to disable it)
-# (prefix a daemon with a @ to start it up in the background)
+# - prefix a daemon with a ! to disable it
+# - prefix a daemon with a @ to start it up in the background
#
DAEMONS=(syslog-ng hotplug !pcmcia network netfs crond)
diff --git a/rc.local b/rc.local
index f177298..4950cba 100755
--- a/rc.local
+++ b/rc.local
@@ -1,7 +1,6 @@
-#!/bin/sh
+#!/bin/bash
#
# /etc/rc.local: Local multi-user startup script.
#
-# End of file
-# vim: set ts=2 noet:
+
diff --git a/rc.multi b/rc.multi
index 94c2dba..d8a1881 100755
--- a/rc.multi
+++ b/rc.multi
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
#
# /etc/rc.multi
#
@@ -8,8 +8,8 @@
# Start daemons
for daemon in "${DAEMONS[@]}"; do
- if [[ `echo $daemon | grep '^[^\!]' | wc -l` -eq 1 ]]; then
- if [[ `echo $daemon | grep '^[^\@]' | wc -l` -eq 1 ]]; then
+ if [ "$daemon" = "${daemon#!}" ]; then
+ if [ "$daemon" = "${daemon#@}" ]; then
/etc/rc.d/$daemon start
else
stat_bkgd "Starting ${daemon:1}"
@@ -25,5 +25,4 @@ if [ -x /etc/rc.local ]; then
/etc/rc.local
fi
-# End of file
# vim: set ts=2 noet:
diff --git a/rc.shutdown b/rc.shutdown
index 41daa97..fa5365d 100755
--- a/rc.shutdown
+++ b/rc.shutdown
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
#
# /etc/rc.shutdown
#
diff --git a/rc.single b/rc.single
index 3870380..80faa14 100755
--- a/rc.single
+++ b/rc.single
@@ -1,6 +1,6 @@
-#!/bin/sh
+#!/bin/bash
#
-# /etc/rc.single
+# /etc/rc.single: Single-user startup script.
#
. /etc/rc.conf