aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoman Kyrylych <roman@archlinux.org>2009-08-10 20:02:11 +0300
committerRoman Kyrylych <roman@archlinux.org>2009-08-10 20:02:11 +0300
commite929caffa000b4f45b72a12053da6f45c3344d23 (patch)
treebe82181a2bb8460dda3ce62433f04c1def710141
parenta24ad686cd629bee0dcf5cc6e5c1f4da65ca1159 (diff)
parentaa58a7d0202815af27d520889c8e4689f016efd2 (diff)
downloadinitscripts-e929caffa000b4f45b72a12053da6f45c3344d23.tar.xz
Merge branch 'master' of ssh://archlinux.org/srv/projects/git/initscripts
-rw-r--r--functions41
-rwxr-xr-xnetwork25
-rw-r--r--rc.conf2
-rwxr-xr-xrc.shutdown2
-rwxr-xr-xrc.single2
5 files changed, 59 insertions, 13 deletions
diff --git a/functions b/functions
index 96903b9..0f333d4 100644
--- a/functions
+++ b/functions
@@ -4,9 +4,28 @@
# width:
-# disable color on output to non-tty
STAT_COL=80
-USECOLOR=""
+if [ -t 1 ]; then
+ # stty will fail when stdin isn't a terminal (but we're in this block, so stdout is)
+ if [ -t 0 ]; then
+ STAT_COL="$(/bin/stty size)"
+ # stty gives "rows cols"; strip the rows number, we just want columns
+ STAT_COL="${STAT_COL##* }"
+ else
+ # tput will fail at boot time if /usr/share/terminfo isn't yet mounted
+ # or TERM is otherwise unrecognized
+ STAT_COL="$(/bin/tput cols 2>/dev/null)"
+ fi
+ if [ "0$STAT_COL" -eq 0 ]; then
+ # if output was 0 (serial console), set default width to 80
+ USECOLOR=""
+ STAT_COL=80
+ fi
+else
+ USECOLOR=""
+ STAT_COL=80
+fi
+
if [ -t 1 ]; then
STAT_COL=$(/bin/stty size)
# strip the rows number, we just want columns
@@ -140,13 +159,17 @@ status() {
# 1 - not found
# Copied from makepkg
in_array() {
- local needle=$1; shift
- [ -z "$1" ] && return 1 # Not Found
- local item
- for item in "$@"; do
- [ "$item" = "$needle" ] && return 0 # Found
- done
- return 1 # Not Found
+ local needle=$1; shift
+ [ -z "$1" ] && return 1 # Not Found
+ local item
+ for item in "$@"; do
+ local c="${item:0:1}"
+ if [ "$c" == "!" -o "$c" == "@" ]; then
+ item="${item:1}"
+ fi
+ [ "$item" = "$needle" ] && return 0 # Found
+ done
+ return 1 # Not Found
}
# daemons:
diff --git a/network b/network
index 6e68877..0381e5d 100755
--- a/network
+++ b/network
@@ -128,7 +128,19 @@ bond_up()
for ifline in ${BOND_INTERFACES[@]}; do
if [ "$ifline" = "${ifline#!}" ]; then
eval bondcfg="\$bond_${ifline}"
- /sbin/ifenslave $ifline $bondcfg || error=1
+ if [ -n "${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
}
@@ -146,6 +158,15 @@ bridge_up()
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
@@ -209,6 +230,8 @@ case "$1" in
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
diff --git a/rc.conf b/rc.conf
index 1c2d428..7177902 100644
--- a/rc.conf
+++ b/rc.conf
@@ -15,7 +15,7 @@
# CONSOLEMAP: found in /usr/share/kbd/consoletrans
# USECOLOR: use ANSI color sequences in startup messages
#
-LOCALE="en_US.utf8"
+LOCALE="en_US.UTF-8"
HARDWARECLOCK="localtime"
USEDIRECTISA="no"
TIMEZONE="Canada/Pacific"
diff --git a/rc.shutdown b/rc.shutdown
index ef13dec..39f762e 100755
--- a/rc.shutdown
+++ b/rc.shutdown
@@ -26,7 +26,7 @@ if [ "$PREVLEVEL" = "3" -o "$PREVLEVEL" = "5" ]; then
# Find daemons NOT in the DAEMONS array. Shut these down first
if [ -d /var/run/daemons ]; then
for daemon in $(/bin/ls -1t /var/run/daemons); do
- if ! in_array $daemon ${DAEMONS}; then
+ if ! in_array $daemon ${DAEMONS[@]}; then
stop_daemon $daemon
fi
done
diff --git a/rc.single b/rc.single
index af2ae16..fd74487 100755
--- a/rc.single
+++ b/rc.single
@@ -10,7 +10,7 @@ if [ "$PREVLEVEL" = "3" -o "$PREVLEVEL" = "5" ]; then
# Find daemons NOT in the DAEMONS array. Shut these down first
if [ -d /var/run/daemons ]; then
for daemon in $(/bin/ls -1t /var/run/daemons); do
- if ! in_array $daemon ${DAEMONS}; then
+ if ! in_array $daemon ${DAEMONS[@]}; then
stop_daemon $daemon
fi
done