[arch-projects] [PATCH 1/7] whitespace cleanup

Dave Reisner d at falconindy.com
Sat Mar 26 16:31:57 EDT 2011


* adhere to a consistant vim modeline
* use top-right/bottom-left braces for functions

Signed-off-by: Dave Reisner <d at falconindy.com>
---
 functions   |  207 ++++++++++++++--------------
 network     |  445 +++++++++++++++++++++++++++++------------------------------
 rc.multi    |   12 +-
 rc.shutdown |   12 +-
 rc.single   |   14 +-
 rc.sysinit  |   40 +++---
 6 files changed, 359 insertions(+), 371 deletions(-)

diff --git a/functions b/functions
index 909b756..090f099 100644
--- a/functions
+++ b/functions
@@ -6,20 +6,20 @@
 
 STAT_COL=80
 if [[ ! -t 1 ]]; then
-    USECOLOR=""
+	USECOLOR=""
 elif [[ -t 0 ]]; then
-    # stty will fail when stdin isn't a terminal
-    STAT_COL="$(/bin/stty size)"
-    # stty gives "rows cols"; strip the rows number, we just want columns
-    STAT_COL="${STAT_COL##* }"
+	# stty will fail when stdin isn't a terminal
+	STAT_COL="$(/bin/stty size)"
+	# stty gives "rows cols"; strip the rows number, we just want columns
+	STAT_COL="${STAT_COL##* }"
 elif /bin/tput cols &>/dev/null; then
-    # is /usr/share/terminfo already mounted, and TERM recognized?
-    STAT_COL=$(/bin/tput cols)
+	# is /usr/share/terminfo already mounted, and TERM recognized?
+	STAT_COL=$(/bin/tput cols)
 fi
 if ((STAT_COL==0)); then
-    # if output was 0 (serial console), set default width to 80
-    STAT_COL=80
-    USECOLOR=""
+	# if output was 0 (serial console), set default width to 80
+	STAT_COL=80
+	USECOLOR=""
 fi
 
 # we use 13 characters for our own stuff
@@ -28,11 +28,11 @@ STAT_COL=$(($STAT_COL - 13))
 # disable colors on broken terminals
 TERM_COLORS="$(/bin/tput colors 2>/dev/null)"
 if (($? != 3)); then
-    case $TERM_COLORS in
-	*[!0-9]*) USECOLOR="";;
-	[0-7])    USECOLOR="";;
-	'')       USECOLOR="";;
-    esac
+	case $TERM_COLORS in
+		*[!0-9]*) USECOLOR="";;
+		[0-7])    USECOLOR="";;
+		'')       USECOLOR="";;
+	esac
 fi
 unset TERM_COLORS
 
@@ -146,13 +146,13 @@ status() {
 #          1 - not found
 # Copied from makepkg
 in_array() {
-    [[ $2 ]] || return 1
-    local needle=$1; shift
-    local item
-    for item in "$@"; do
-	[[ ${item#@} = $needle ]] && return 0
-    done
-    return 1 # Not Found
+	[[ $2 ]] || return 1
+	local needle=$1; shift
+	local item
+	for item in "$@"; do
+		[[ ${item#@} = $needle ]] && return 0
+	done
+	return 1 # Not Found
 }
 
 # daemons:
@@ -171,17 +171,17 @@ ck_daemon() {
 }
 
 have_daemon() {
-    [[ -x /etc/rc.d/$1 ]]
+	[[ -x /etc/rc.d/$1 ]]
 }
 
 start_daemon() {
-    have_daemon "$1" && /etc/rc.d/"$1" start
+	have_daemon "$1" && /etc/rc.d/"$1" start
 }
 
 ck_depends() {
-    for daemon in "$@"; do
-	ck_daemon "$daemon" && start_daemon "$daemon"
-    done
+	for daemon in "$@"; do
+		ck_daemon "$daemon" && start_daemon "$daemon"
+	done
 }
 
 start_daemon_bkgd() {
@@ -195,64 +195,64 @@ stop_daemon() {
 
 # Status functions
 status_started() {
-  deltext
-  echo -ne "$C_OTHER[${C_STRT}STARTED$C_OTHER]$C_CLEAR "
+	deltext
+	echo -ne "$C_OTHER[${C_STRT}STARTED$C_OTHER]$C_CLEAR "
 }
 
 status_stopped() {
-  deltext
-  echo -ne "$C_OTHER[${C_STRT}STOPPED$C_OTHER]$C_CLEAR "
+	deltext
+	echo -ne "$C_OTHER[${C_STRT}STOPPED$C_OTHER]$C_CLEAR "
 }
 
 ck_status() {
-  if ! ck_daemon "$1"; then
-    status_started
-  else
-    status_stopped
-  fi
+	if ! ck_daemon "$1"; then
+		status_started
+	else
+		status_stopped
+	fi
 }
 
 kill_everything() {
-    # $1 = where we are being called from.
-    # This is used to determine which hooks to run.
-    # Find daemons NOT in the DAEMONS array. Shut these down first
-    for daemon in /var/run/daemons/*; do
-        [[ -f $daemon ]] || continue
-        daemon=${daemon##*/}
-	in_array "$daemon" "${DAEMONS[@]}" || stop_daemon "$daemon"
-    done
-
-    # Shutdown daemons in reverse order
-    for ((i=${#DAEMONS[@]}-1; i>=0; i--)); do
-	[[ ${DAEMONS[$i]:0:1} = '!' ]] && continue
-	ck_daemon ${DAEMONS[$i]#@} || stop_daemon ${DAEMONS[$i]#@}
-    done
+	# $1 = where we are being called from.
+	# This is used to determine which hooks to run.
+	# Find daemons NOT in the DAEMONS array. Shut these down first
+	for daemon in /var/run/daemons/*; do
+		[[ -f $daemon ]] || continue
+		daemon=${daemon##*/}
+		in_array "$daemon" "${DAEMONS[@]}" || stop_daemon "$daemon"
+	done
+
+	# Shutdown daemons in reverse order
+	for ((i=${#DAEMONS[@]}-1; i>=0; i--)); do
+		[[ ${DAEMONS[$i]:0:1} = '!' ]] && continue
+		ck_daemon ${DAEMONS[$i]#@} || stop_daemon ${DAEMONS[$i]#@}
+	done
 
 	# Terminate all processes
-    stat_busy "Sending SIGTERM To Processes"
-    run_hook "$1_prekillall"
-    /sbin/killall5 -15 &> /dev/null
-    /bin/sleep 5
-    stat_done
-
-    stat_busy "Sending SIGKILL To Processes"
-    /sbin/killall5 -9 &> /dev/null
-    /bin/sleep 1
-    stat_done
-
-    run_hook "$1_postkillall"
+	stat_busy "Sending SIGTERM To Processes"
+	run_hook "$1_prekillall"
+	/sbin/killall5 -15 &> /dev/null
+	/bin/sleep 5
+	stat_done
+
+	stat_busy "Sending SIGKILL To Processes"
+	/sbin/killall5 -9 &> /dev/null
+	/bin/sleep 1
+	stat_done
+
+	run_hook "$1_postkillall"
 }
 
 activate_vgs() {
-    [[ $USELVM =~ yes|YES && -x /sbin/lvm && -d /sys/block ]] || return
-    # Kernel 2.6.x, LVM2 groups
-    /sbin/modprobe -q dm-mod 2>/dev/null
-    stat_busy "Activating LVM2 groups"
-    if /sbin/vgchange --sysinit -a y >/dev/null; then
-	stat_done
-    else
-	stat_fail
-     fi
+	[[ $USELVM =~ yes|YES && -x /sbin/lvm && -d /sys/block ]] || return
+	# Kernel 2.6.x, LVM2 groups
+	/sbin/modprobe -q dm-mod 2>/dev/null
+	stat_busy "Activating LVM2 groups"
+	if /sbin/vgchange --sysinit -a y >/dev/null; then
+		stat_done
+	else
+		stat_fail
+	fi
 }
 
 # Arch cryptsetup packages traditionally contained the binaries
@@ -262,23 +262,23 @@ activate_vgs() {
 # Newer packages will only have /sbin/cryptsetup and no static binary
 # This ensures maximal compatibility with the old and new layout
 for CS in /sbin/cryptsetup /usr/sbin/cryptsetup \
-    /sbin/cryptsetup.static ''; do
-    [[ -x $CS ]] && break
+	/sbin/cryptsetup.static ''; do
+	[[ -x $CS ]] && break
 done
 
 read_crypttab() {
-    # $1 = function to call with the split out line from the crypttab
-    local line nspo failed=0
-    while read line; do
-        [[ $line && ${line:0:1} != '#' ]] || continue
-        eval nspo=("${line%#*}")
-        if $1 "${nspo[0]}" "${nspo[1]}" "${nspo[2]}" "${nspo[*]:3}"; then
-          crypto_unlocked=1
-        else
-          failed=1
-        fi
-    done < /etc/crypttab
-    return $failed
+	# $1 = function to call with the split out line from the crypttab
+	local line nspo failed=0
+	while read line; do
+		[[ $line && ${line:0:1} != '#' ]] || continue
+		eval nspo=("${line%#*}")
+		if $1 "${nspo[0]}" "${nspo[1]}" "${nspo[2]}" "${nspo[*]:3}"; then
+			crypto_unlocked=1
+		else
+			failed=1
+		fi
+	done < /etc/crypttab
+	return $failed
 }
 
 ###############################
@@ -338,31 +338,30 @@ fi
 
 # Function for setting console font if required
 set_consolefont() {
-    [[ $CONSOLEFONT ]] || return 0
-    stat_busy "Loading Console Font: $CONSOLEFONT"
-    #CONSOLEMAP in UTF-8 shouldn't be used
-    [[ $CONSOLEMAP && ${LOCALE,,} =~ utf ]] && CONSOLEMAP=""
-    for i in /dev/tty[0-9]*; do
-	/usr/bin/setfont ${CONSOLEMAP:+-m ${CONSOLEMAP}} \
-	    $CONSOLEFONT -C ${i} >/dev/null 2>&1
-    done
-    if (($? != 0)); then
-	stat_fail
-    elif [[ $CONSOLEMAP ]]; then
-	cat <<"EOF" >>/etc/profile.d/locale.sh
+	[[ $CONSOLEFONT ]] || return 0
+	stat_busy "Loading Console Font: $CONSOLEFONT"
+	#CONSOLEMAP in UTF-8 shouldn't be used
+	[[ $CONSOLEMAP && ${LOCALE,,} =~ utf ]] && CONSOLEMAP=""
+	for i in /dev/tty[0-9]*; do
+		/usr/bin/setfont ${CONSOLEMAP:+-m ${CONSOLEMAP}} \
+		$CONSOLEFONT -C ${i} >/dev/null 2>&1
+	done
+	if (($? != 0)); then
+		stat_fail
+	elif [[ $CONSOLEMAP ]]; then
+		cat <<"EOF" >>/etc/profile.d/locale.sh
 if [ "$CONSOLE" = "" -a "$TERM" = "linux" -a -t 1 ]; then printf "\033(K"; fi
-
 EOF
-	stat_done
-    else
-	stat_done
-    fi
+		stat_done
+	else
+		stat_done
+	fi
 }
 
 # Source additional functions at the end to allow overrides
 for f in /etc/rc.d/functions.d/*; do
-  [[ -e $f ]] && . "$f"
+	[[ -e $f ]] && . "$f"
 done
 
 # End of file
-# vim: set ft=sh sw=2 ts=2 et:
+# vim: set ts=2 sw=2 noet:
diff --git a/network b/network
index 4cd45d7..2065dfc 100755
--- a/network
+++ b/network
@@ -4,261 +4,250 @@
 . /etc/rc.d/functions
 
 for s in wireless bonding bridges dhcpcd; do
-    [[ -f /etc/conf.d/$s ]] && . "/etc/conf.d/$s"
+	[[ -f /etc/conf.d/$s ]] && . "/etc/conf.d/$s"
 done
 
-ifup()
-{
-    if [[ ! $1 ]]; then
-        echo "usage: $0 ifup <interface_name>"
-        return 1
-    fi
-    eval ifcfg="\$${1}"
-
-    # Get the name of the interface from the first token in the string
-    if [[ $ifcfg = dhcp ]]; then
-        ifname=$1
-    else
-        ifname=${ifcfg%% *}
-    fi
-
-    /sbin/ifconfig $ifname up
-
-    wi_up $1 || return 1
-
-    if [[ $ifcfg = dhcp ]]; then
-        # remove the .pid file if it exists
-        /bin/rm -f /var/run/dhcpcd-${1}.pid >/dev/null 2>&1
-        /bin/rm -f /var/run/dhcpcd-${1}.cache >/dev/null 2>&1
-        /sbin/dhcpcd $DHCPCD_ARGS ${1}
-    else
-        /sbin/ifconfig $ifcfg
-    fi
+ifup() {
+	if [[ ! $1 ]]; then
+		echo "usage: $0 ifup <interface_name>"
+		return 1
+	fi
+	eval ifcfg="\$${1}"
+
+	# Get the name of the interface from the first token in the string
+	if [[ $ifcfg = dhcp ]]; then
+		ifname=$1
+	else
+		ifname=${ifcfg%% *}
+	fi
+
+	/sbin/ifconfig $ifname up
+
+	wi_up $1 || return 1
+
+	if [[ $ifcfg = dhcp ]]; then
+		# remove the .pid file if it exists
+		/bin/rm -f /var/run/dhcpcd-${1}.pid >/dev/null 2>&1
+		/bin/rm -f /var/run/dhcpcd-${1}.cache >/dev/null 2>&1
+		/sbin/dhcpcd $DHCPCD_ARGS ${1}
+	else
+		/sbin/ifconfig $ifcfg
+	fi
 }
 
-wi_up()
-{
-    eval iwcfg="\$wlan_${1}"
-    [[ ! $iwcfg ]] && return 0
+wi_up() {
+	eval iwcfg="\$wlan_${1}"
+	[[ ! $iwcfg ]] && return 0
 
-    /usr/sbin/iwconfig $iwcfg
-    [[ $WIRELESS_TIMEOUT ]] || WIRELESS_TIMEOUT=2
-    sleep $WIRELESS_TIMEOUT
+	/usr/sbin/iwconfig $iwcfg
+	[[ $WIRELESS_TIMEOUT ]] || WIRELESS_TIMEOUT=2
+	sleep $WIRELESS_TIMEOUT
 
-    bssid=$(iwgetid $1 -ra)
-    if [[ $bssid = 00:00:00:00:00:00 ]]; then
-        printhl "Could not associate $1 - try increasing WIRELESS_TIMEOUT and check network is WEP or has no security"
-        return 1
-    fi
-    return 0
+	bssid=$(iwgetid $1 -ra)
+	if [[ $bssid = 00:00:00:00:00:00 ]]; then
+		printhl "Could not associate $1 - try increasing WIRELESS_TIMEOUT and check network is WEP or has no security"
+		return 1
+	fi
+	return 0
 }
 
-ifdown()
-{
-    if [[ ! $1 ]]; then
-        echo "usage: $0 ifdown <interface_name>"
-        return 1
-    fi
-    eval ifcfg="\$${1}"
-    if [[ $ifcfg = dhcp && -f /var/run/dhcpcd-${1}.pid ]]; then
-        /sbin/dhcpcd -k ${1} >/dev/null 2>&1
-    fi
-    # Always bring the interface itself down
-    /sbin/ifconfig ${1} down >/dev/null 2>&1
+ifdown() {
+	if [[ ! $1 ]]; then
+		echo "usage: $0 ifdown <interface_name>"
+		return 1
+	fi
+	eval ifcfg="\$${1}"
+	if [[ $ifcfg = dhcp && -f /var/run/dhcpcd-${1}.pid ]]; then
+		/sbin/dhcpcd -k ${1} >/dev/null 2>&1 
+	fi
+	# Always bring the interface itself down
+	/sbin/ifconfig ${1} down >/dev/null 2>&1
 }
 
-iflist()
-{
-    for ifline in ${INTERFACES[@]}; do
-        if [[ $ifline = ${ifline#!} ]]; then
-            printf " $ifline:\t"
-        else
-            printf "$ifline:\t"
-        fi
-        eval real_ifline=\$${ifline#!}
-        echo $real_ifline
-    done
+iflist() {
+	for ifline in ${INTERFACES[@]}; do
+		if [[ $ifline = ${ifline#!} ]]; then
+			printf " $ifline:\t"
+		else
+			printf "$ifline:\t"
+		fi
+		eval real_ifline=\$${ifline#!}
+		echo $real_ifline
+	done
 }
 
-rtup()
-{
-    if [[ ! $1 ]]; then
-        echo "usage: $0 rtup <route_name>"
-        return 1
-    fi
-    eval routecfg="\$${1}"
-    if [[ $routecfg =~ :: ]]; then
-        /sbin/route -A inet6 add $routecfg
-    else
-        /sbin/route add $routecfg
-    fi
+rtup() {
+	if [[ ! $1 ]]; then
+		echo "usage: $0 rtup <route_name>"
+		return 1
+	fi
+	eval routecfg="\$${1}"
+	if [[ $routecfg =~ :: ]]; then
+		/sbin/route -A inet6 add $routecfg
+	else
+		/sbin/route add $routecfg
+	fi
 }
 
-rtdown()
-{
-    if [[ ! $1 ]]; then
-        echo "usage: $0 rtdown <route_name>"
-        return 1
-    fi
-    eval routecfg="\$${1}"
-    if [[ $routecfg =~ :: ]]; then
-        /sbin/route -A inet6 del $routecfg
-    else
-        /sbin/route del $routecfg
-    fi
+rtdown() {
+	if [[ ! $1 ]]; then
+		echo "usage: $0 rtdown <route_name>"
+		return 1
+	fi
+	eval routecfg="\$${1}"
+	if [[ $routecfg =~ :: ]]; then
+		/sbin/route -A inet6 del $routecfg
+	else
+		/sbin/route del $routecfg
+	fi
 }
 
-rtlist()
-{
-    for rtline in ${ROUTES[@]}; do
-        if [[ $rtline = ${rtline#!} ]]; then
-            printf " $rtline:\t"
-        else
-            printf "$rtline:\t"
-        fi
-        eval real_rtline=\$${rtline#!}
-        echo $real_rtline
-    done
+rtlist() {
+	for rtline in ${ROUTES[@]}; do
+		if [[ $rtline = ${rtline#!} ]]; then
+			printf " $rtline:\t"
+		else
+			printf "$rtline:\t"
+		fi
+		eval real_rtline=\$${rtline#!}
+		echo $real_rtline
+	done
 }
 
-bond_up()
-{
-    for ifline in ${BOND_INTERFACES[@]}; do
-        if [[ $ifline = ${ifline#!} ]]; then
-            eval bondcfg="\$bond_${ifline}"
-            if [[ ${bondcfg} ]]; then
-                /sbin/ifenslave $ifline $bondcfg || error=1
-            fi
-        fi
-    done
+bond_up() {
+	for ifline in ${BOND_INTERFACES[@]}; do
+		if [[ $ifline = ${ifline#!} ]]; then
+			eval bondcfg="\$bond_${ifline}"
+			if [[ ${bondcfg} ]]; then
+				/sbin/ifenslave $ifline $bondcfg || error=1
+			fi
+		fi
+	done
 }
 
-bond_down()
-{
-    for ifline in ${BOND_INTERFACES[@]}; do
-        if [[ $ifline = ${ifline#!} ]]; then
-            eval bondcfg="\$bond_${ifline}"
-            /sbin/ifenslave -d $ifline $bondcfg || error=1
-        fi
-    done
+bond_down() {
+	for ifline in ${BOND_INTERFACES[@]}; do
+		if [[ $ifline = ${ifline#!} ]]; then
+			eval bondcfg="\$bond_${ifline}"
+			/sbin/ifenslave -d $ifline $bondcfg || error=1
+		fi
+	done
 }
 
-bridge_up()
-{
-    for br in ${BRIDGE_INTERFACES[@]}; do
-        if [[ $br = ${br#!} ]]; then
-            # if the bridge already exists, remove it
-            if [[ $(/sbin/ifconfig $br 2>/dev/null) ]]; then
-                /sbin/ifconfig $br down
-                /usr/sbin/brctl delbr $br
-            fi
-            /usr/sbin/brctl addbr $br
-            eval brifs="\$bridge_${br}"
-            for brif in $brifs; do
-                if [[ $brif = ${brif#!} ]]; then
-                    for ifline in ${BOND_INTERFACES[@]}; do
-                        if [[ $brif = $ifline && $ifline = ${ifline#!} ]]; then
-                            ifup $ifline
-                            eval bondcfg="\$bond_${ifline}"
-                            /sbin/ifenslave $ifline $bondcfg || error=1
-                            unset bond_${ifline}
-                        fi
-                    done
-
-                    /usr/sbin/brctl addif $br $brif || error=1
-                fi
-            done
-        fi
-    done
+bridge_up() {
+	for br in ${BRIDGE_INTERFACES[@]}; do
+		if [[ $br = ${br#!} ]]; then
+			# if the bridge already exists, remove it
+			if [[ $(/sbin/ifconfig $br 2>/dev/null) ]]; then
+				/sbin/ifconfig $br down
+				/usr/sbin/brctl delbr $br
+			fi
+			/usr/sbin/brctl addbr $br
+			eval brifs="\$bridge_${br}"
+			for brif in $brifs; do
+				if [[ $brif = ${brif#!} ]]; then
+					for ifline in ${BOND_INTERFACES[@]}; do
+						if [[ $brif = $ifline && $ifline = ${ifline#!} ]]; then
+							ifup $ifline
+							eval bondcfg="\$bond_${ifline}"
+							/sbin/ifenslave $ifline $bondcfg || error=1
+							unset bond_${ifline}
+						fi
+					done
+
+					/usr/sbin/brctl addif $br $brif || error=1
+				fi
+			done
+		fi
+	done
 }
 
-bridge_down()
-{
-    for br in ${BRIDGE_INTERFACES[@]}; do
-        if [[ $br = ${br#!} ]]; then
-            /usr/sbin/brctl delbr $br
-        fi
-    done
+bridge_down() {
+	for br in ${BRIDGE_INTERFACES[@]}; do
+		if [[ $br = ${br#!} ]]; then
+			/usr/sbin/brctl delbr $br
+		fi
+	done
 }
 
 
 case "$1" in
-    start)
-        if ! ck_daemon network; then
-            echo "Network is already running.  Try 'network restart'"
-            exit
-        fi
-
-        stat_busy "Starting Network"
-        error=0
-        # bring up bridge interfaces
-        bridge_up
-        # bring up ethernet interfaces
-        for ifline in ${INTERFACES[@]}; do
-            if [[ $ifline = ${ifline#!} ]]; then
-                ifup $ifline || error=1
-            fi
-        done
-        # bring up bond interfaces
-        bond_up
-        # bring up routes
-        for rtline in "${ROUTES[@]}"; do
-            if [ "$rtline" = "${rtline#!}" ]; then
-                rtup $rtline || error=1
-            fi
-        done
-        if ((error == 0)); then
-            add_daemon network
-            stat_done
-        else
-            stat_fail
-        fi
-        ;;
-    stop)
-        #if ck_daemon network; then
-        #	echo "Network is not running.  Try 'network start'"
-        #	exit
-        #fi
-
-        if [[ $NETWORK_PERSIST =~ yes|YES && $RUNLEVEL == [06] ]]; then
-            status "Skipping Network Shutdown" true
-            exit 0
-        fi
-
-        stat_busy "Stopping Network"
-        rm_daemon network
-        error=0
-        for rtline in "${ROUTES[@]}"; do
-            if [[ $rtline = ${rtline#!} ]]; then
-                rtdown $rtline || error=1
-            fi
-        done
-        # bring down bond interfaces
-        bond_down
-        for ifline in ${INTERFACES[@]}; do
-            if [[ $ifline = ${ifline#!} ]]; then
-                ifdown $ifline || error=1
-            fi
-        done
-        # bring down bridge interfaces
-        bridge_down
-        if ((error == 0)); then
-            stat_done
-        else
-            stat_fail
-        fi
-        ;;
-    restart)
-        $0 stop
-        /bin/sleep 2
-        $0 start
-        ;;
-    ifup|ifdown|iflist|rtup|rtdown|rtlist)
-        $1 $2
-        ;;
-    *)
-        echo "usage: $0 {start|stop|restart}"
-        echo "       $0 {ifup|ifdown|iflist|rtup|rtdown|rtlist}";;
+	start)
+		if ! ck_daemon network; then
+			echo "Network is already running.  Try 'network restart'"
+			exit
+		fi
+
+		stat_busy "Starting Network"
+		error=0
+		# bring up bridge interfaces
+		bridge_up
+		# bring up ethernet interfaces
+		for ifline in ${INTERFACES[@]}; do
+			if [[ $ifline = ${ifline#!} ]]; then
+				ifup $ifline || error=1
+			fi
+		done
+		# bring up bond interfaces
+		bond_up
+		# bring up routes
+		for rtline in "${ROUTES[@]}"; do
+			if [ "$rtline" = "${rtline#!}" ]; then
+				rtup $rtline || error=1
+			fi
+		done
+		if ((error == 0)); then
+			add_daemon network
+			stat_done
+		else
+			stat_fail
+		fi
+		;;
+	stop)
+		#if ck_daemon network; then
+		#	echo "Network is not running.  Try 'network start'"
+		#	exit
+		#fi
+
+		if [[ $NETWORK_PERSIST =~ yes|YES && $RUNLEVEL == [06] ]]; then
+			status "Skipping Network Shutdown" true
+			exit 0
+		fi
+
+		stat_busy "Stopping Network"
+		rm_daemon network
+		error=0
+		for rtline in "${ROUTES[@]}"; do
+			if [[ $rtline = ${rtline#!} ]]; then
+				rtdown $rtline || error=1
+			fi
+		done
+		# bring down bond interfaces
+		bond_down
+		for ifline in ${INTERFACES[@]}; do
+			if [[ $ifline = ${ifline#!} ]]; then
+				ifdown $ifline || error=1
+			fi
+		done
+		# bring down bridge interfaces
+		bridge_down
+		if ((error == 0)); then
+			stat_done
+		else
+			stat_fail
+		fi
+		;;
+	restart)
+		$0 stop
+		/bin/sleep 2
+		$0 start
+		;;
+	ifup|ifdown|iflist|rtup|rtdown|rtlist)
+		$1 $2
+		;;
+	*)
+		echo "usage: $0 {start|stop|restart}"
+		echo "       $0 {ifup|ifdown|iflist|rtup|rtdown|rtlist}";;
 esac
 
-# vim: set ts=4 sw=4 noet:
+# vim: set ts=2 sw=2 noet:
diff --git a/rc.multi b/rc.multi
index 660f649..693223d 100755
--- a/rc.multi
+++ b/rc.multi
@@ -13,11 +13,11 @@ run_hook multi_start
 
 # Start daemons
 for daemon in "${DAEMONS[@]}"; do
-    case ${daemon:0:1} in
-        '!') continue;;     # Skip this daemon.
-        '@') start_daemon_bkgd "${daemon#@}";;
-        *)   start_daemon "$daemon";;
-    esac
+	case ${daemon:0:1} in
+		'!') continue;;     # Skip this daemon.
+		'@') start_daemon_bkgd "${daemon#@}";;
+		*)   start_daemon "$daemon";;
+	esac
 done
 
 if [[ -x /etc/rc.local ]]; then
@@ -26,4 +26,4 @@ fi
 
 run_hook multi_end
 
-# vim: set ts=2 noet:
+# vim: set ts=2 sw=2 noet:
diff --git a/rc.shutdown b/rc.shutdown
index 0acca49..499459f 100755
--- a/rc.shutdown
+++ b/rc.shutdown
@@ -43,9 +43,9 @@ fi
 
 HWCLOCK_PARAMS="--systohc"
 case $HARDWARECLOCK in
-    UTC) HWCLOCK_PARAMS="$HWCLOCK_PARAMS --utc";;
-    localtime) HWCLOCK_PARAMS="$HWCLOCK_PARAMS --localtime";;
-    *) HWCLOCK_PARAMS="";;
+	UTC) HWCLOCK_PARAMS="$HWCLOCK_PARAMS --utc";;
+	localtime) HWCLOCK_PARAMS="$HWCLOCK_PARAMS --localtime";;
+	*) HWCLOCK_PARAMS="";;
 esac
 [[ $HWCLOCK_PARAMS ]] && /sbin/hwclock $HWCLOCK_PARAMS
 stat_done
@@ -87,9 +87,9 @@ if [[ -f /etc/crypttab && -n $CS ]] && /bin/grep -q ^[^#] /etc/crypttab; then
 fi
 
 if [[ $USELVM =~ yes|YES && -x /sbin/lvm && -d /sys/block ]]; then
-    stat_busy "Deactivating LVM2 groups"
-    /sbin/vgchange --sysinit -a n >/dev/null 2>&1
-    stat_done
+	stat_busy "Deactivating LVM2 groups"
+	/sbin/vgchange --sysinit -a n >/dev/null 2>&1
+	stat_done
 fi
 
 stat_busy "Remounting Root Filesystem Read-only"
diff --git a/rc.single b/rc.single
index 4d22cf1..2420873 100755
--- a/rc.single
+++ b/rc.single
@@ -9,7 +9,7 @@
 run_hook single_start
 
 if [[ $PREVLEVEL != N ]]; then
-        kill_everything single
+	kill_everything single
 	stat_busy "Starting UDev Daemon"
 	/sbin/udevd --daemon
 	stat_done
@@ -18,11 +18,11 @@ if [[ $PREVLEVEL != N ]]; then
 
 	# Trigger udev uevents
 	if /bin/pidof -o %PPID /sbin/udevd >/dev/null; then
-	  stat_busy "Triggering UDev uevents"
-	  /sbin/udevadm control --property=STARTUP=1
-	  /sbin/udevadm trigger --action=add --type=devices
-	  /sbin/udevadm trigger --action=add --type=subsystems
-	  stat_done
+		stat_busy "Triggering UDev uevents"
+		/sbin/udevadm control --property=STARTUP=1
+		/sbin/udevadm trigger --action=add --type=devices
+		/sbin/udevadm trigger --action=add --type=subsystems
+		stat_done
 	fi
 
 	# Wait for udev uevents
@@ -55,4 +55,4 @@ if [[ $RUNLEVEL = 1 ]]; then
 fi
 
 # End of file
-# vim: set ts=2 noet:
+# vim: set ts=2 sw=2 noet:
diff --git a/rc.sysinit b/rc.sysinit
index 9797611..cd74db4 100755
--- a/rc.sysinit
+++ b/rc.sysinit
@@ -21,11 +21,11 @@ export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
 /bin/mountpoint -q /sys  || /bin/mount -n -t sysfs sysfs /sys -o nosuid,noexec,nodev
 
 if ! /bin/mountpoint -q /dev; then
-  if grep -q devtmpfs /proc/filesystems 2>/dev/null; then
-    /bin/mount -n -t devtmpfs udev /dev -o mode=0755,size=10M,nosuid
-  else
-    /bin/mount -n -t tmpfs udev /dev -o mode=0755,size=10M,nosuid
-  fi
+	if grep -q devtmpfs /proc/filesystems 2>/dev/null; then
+		/bin/mount -n -t devtmpfs udev /dev -o mode=0755,size=10M,nosuid
+	else
+		/bin/mount -n -t tmpfs udev /dev -o mode=0755,size=10M,nosuid
+	fi
 fi
 
 # start up our mini logger until syslog takes over
@@ -41,9 +41,9 @@ fi
 
 HWCLOCK_PARAMS="--hctosys"
 case $HARDWARECLOCK in
-    UTC) HWCLOCK_PARAMS+=" --utc";;
-    localtime) HWCLOCK_PARAMS+=" --localtime";;
-    *) HWCLOCK_PARAMS="";;
+	UTC) HWCLOCK_PARAMS+=" --utc";;
+	localtime) HWCLOCK_PARAMS+=" --localtime";;
+	*) HWCLOCK_PARAMS="";;
 esac
 
 if [[ $HWCLOCK_PARAMS ]]; then
@@ -52,11 +52,11 @@ if [[ $HWCLOCK_PARAMS ]]; then
 	# If devtmpfs is used, the required RTC device already exists now
 	# Otherwise, create whatever device is available
 	if ! [[ -c /dev/rtc || -c /dev/rtc0 ]]; then
-            for dev in /sys/class/rtc/rtc0/dev /sys/class/misc/rtc/dev; do
-                [[ -e $dev ]] || continue
-		IFS=: read -r major minor < "$dev"
-		/bin/mknod /dev/rtc c $major $minor
-	    done
+		for dev in /sys/class/rtc/rtc0/dev /sys/class/misc/rtc/dev; do
+			[[ -e $dev ]] || continue
+			IFS=: read -r major minor < "$dev"
+			/bin/mknod /dev/rtc c $major $minor
+		done
 	fi
 
 	# Do a clock set here for a few reasons:
@@ -82,11 +82,11 @@ run_hook sysinit_udevlaunched
 
 # Trigger udev uevents
 if /bin/pidof -o %PPID /sbin/udevd >/dev/null; then
-  stat_busy "Triggering UDev uevents"
-  /sbin/udevadm control --property=STARTUP=1
-  /sbin/udevadm trigger --action=add --type=devices
-  /sbin/udevadm trigger --action=add --type=subsystems
-  stat_done
+	stat_busy "Triggering UDev uevents"
+	/sbin/udevadm control --property=STARTUP=1
+	/sbin/udevadm trigger --action=add --type=devices
+	/sbin/udevadm trigger --action=add --type=subsystems
+	stat_done
 fi
 
 # Load modules from the MODULES array defined in rc.conf
@@ -319,8 +319,8 @@ if [[ $HWCLOCK_PARAMS ]]; then
 	# take ~1 second because of the clock granularity, and we might as well
 	# stay busy.
 	(
-	/sbin/hwclock --adjust
-	/sbin/hwclock $HWCLOCK_PARAMS
+		/sbin/hwclock --adjust
+		/sbin/hwclock $HWCLOCK_PARAMS
 	) &
 	clock_pid=$!
 fi
-- 
1.7.4.1



More information about the arch-projects mailing list