diff options
author | Judd Vinet <judd@archlinux.org> | 2005-09-15 20:05:07 +0000 |
---|---|---|
committer | Judd Vinet <judd@archlinux.org> | 2005-09-15 20:05:07 +0000 |
commit | e772aeae76f2ad704a834dc17df02dbc137a6573 (patch) | |
tree | 954dcf245b4eedb69badab02e5b22459364c5cb2 | |
parent | 0be8f5b2d33fc6160e2a62d33fc1f828218fa90a (diff) | |
download | initscripts-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-x | netcfg | 9 | ||||
-rwxr-xr-x | network | 4 | ||||
-rw-r--r-- | rc.conf | 12 | ||||
-rwxr-xr-x | rc.local | 5 | ||||
-rwxr-xr-x | rc.multi | 7 | ||||
-rwxr-xr-x | rc.shutdown | 2 | ||||
-rwxr-xr-x | rc.single | 4 |
7 files changed, 25 insertions, 18 deletions
@@ -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 @@ -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: @@ -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) @@ -1,7 +1,6 @@ -#!/bin/sh +#!/bin/bash # # /etc/rc.local: Local multi-user startup script. # -# End of file -# vim: set ts=2 noet: + @@ -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 # @@ -1,6 +1,6 @@ -#!/bin/sh +#!/bin/bash # -# /etc/rc.single +# /etc/rc.single: Single-user startup script. # . /etc/rc.conf |