aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile1
-rw-r--r--initscripts.spec11
-rwxr-xr-xrc.d/init.d/functions34
-rw-r--r--sysconfig/init12
4 files changed, 47 insertions, 11 deletions
diff --git a/Makefile b/Makefile
index e83232b6..11b8c4ae 100644
--- a/Makefile
+++ b/Makefile
@@ -13,6 +13,7 @@ install:
install -m644 inputrc $(ROOT)/etc
install -m755 setsysfont $(ROOT)/sbin
install -m755 lang.sh $(ROOT)/etc/profile.d
+ install -m644 sysconfig/init $(ROOT)/etc/sysconfig/init
cp -af rc.d sysconfig ppp $(ROOT)/etc
mkdir -p $(ROOT)/sbin
mv $(ROOT)/etc/sysconfig/network-scripts/ifup $(ROOT)/sbin
diff --git a/initscripts.spec b/initscripts.spec
index 9bf0939b..ff39e898 100644
--- a/initscripts.spec
+++ b/initscripts.spec
@@ -1,6 +1,6 @@
Summary: inittab and /etc/rc.d scripts
Name: initscripts
-%define version 3.90
+%define version 3.91
Version: %{version}
Copyright: GPL
Group: System Environment/Base
@@ -84,6 +84,14 @@ chkconfig --add random
chkconfig --add nfsfs
chkconfig --add network
+if [ $1 = 0 ]; then
+ if [ "$TERM" = "vt100" ]; then
+ tmpfile=/etc/sysconfig/tmp.$$
+ sed -e '/BOOTUP=color/BOOTUP=serial/' /etc/sysconfig/init > $tmpfile
+ mv -f $tmpfile /etc/sysconfig/init
+ fi
+fi
+
%postun
if [ $1 = 0 ]; then
chkconfig --del random
@@ -98,6 +106,7 @@ rm -rf $RPM_BUILD_ROOT
%defattr(-,root,root)
%dir /etc/sysconfig/network-scripts
%config %verify(not md5 mtime size) /etc/adjtime
+%config(noreplace) /etc/sysconfig/init
/etc/sysconfig/network-scripts/ifdown
%config /sbin/ifdown
%config /etc/sysconfig/network-scripts/ifdown-post
diff --git a/rc.d/init.d/functions b/rc.d/init.d/functions
index 14ba5025..d6a6fdbb 100755
--- a/rc.d/init.d/functions
+++ b/rc.d/init.d/functions
@@ -18,10 +18,15 @@ if [ -f /etc/sysconfig/init ]; then
. /etc/sysconfig/init
else
BOOTUP=color
+ COLOR_SUCCESS=2
+ COLOR_FAILURE=1
+ RES_COL=60
LOGLEVEL=1
fi
-if [ "$BOOTUP" = "color" ]; then
+[ -z "$COLUMNS" ] && COLUMNS=80
+
+if [ "$BOOTUP" != "verbose" ]; then
INITLOG_ARGS="-q"
else
INITLOG_ARGS=
@@ -50,7 +55,7 @@ daemon() {
ulimit -c 0
# Echo daemon
- [ $BOOTUP != "color" ] && echo -n " $base"
+ [ "$BOOTUP" = "verbose" ] && echo -n " $base"
# And start it up.
nice -n $nicelevel initlog $INITLOG_ARGS -c "$*" && success "$base startup" || failure "$base startup"
@@ -81,7 +86,7 @@ killproc() {
# Kill it.
if [ "$pid" != "" ] ; then
- [ $BOOTUP != "color" ] && echo -n "$base "
+ [ $BOOTUP = "verbose" ] && echo -n "$base "
if [ "$notset" = 1 ] ; then
# TERM first, then KILL if not dead
kill -TERM $pid && success "$base shutdown" || failure "$base shutdown"
@@ -172,12 +177,22 @@ status() {
}
echo_success() {
- echo -n "[ OK ]"
+ [ "$BOOTUP" = "color" ] && echo -en "\\033[300C\\033[$[${COLUMNS}-${RES_COL}]D"
+ echo -n "[ "
+ [ "$BOOTUP" = "color" ] && echo -en "\\033[1;3${COLOR_SUCCESS}m"
+ echo -n "OK"
+ [ "$BOOTUP" = "color" ] && echo -en "\\033[0;39m"
+ echo -n " ]"
return 0
}
echo_failure() {
- echo -n "[FAILED]"
+ [ "$BOOTUP" = "color" ] && echo -en "\\033[300C\\033[$[${COLUMNS}-${RES_COL}]D"
+ echo -n "["
+ [ "$BOOTUP" = "color" ] && echo -en "\\033[1;3${COLOR_FAILURE}m"
+ echo -n "FAILED"
+ [ "$BOOTUP" = "color" ] && echo -en "\\033[0;39m"
+ echo -n "]"
return 1
}
@@ -188,7 +203,7 @@ success() {
else
echo "-n $0 -s \"$1\" -e 1" >&21
fi
- [ "$BOOTUP" = "color" ] && echo_success
+ [ "$BOOTUP" != "verbose" ] && echo_success
return 0
}
@@ -200,7 +215,7 @@ failure() {
else
echo "-n $0 -s \"$1\" -e 2" >&21
fi
- [ "$BOOTUP" = "color" ] && echo_failure
+ [ "$BOOTUP" != "verbose" ] && echo_failure
return $rc
}
@@ -212,7 +227,6 @@ action() {
if [ -z "$IN_INITLOG" ]; then
initlog $INITLOG_ARGS -c "$*" && success "$STRING" || failure "$STRING"
rc=$?
-# [ "$BOOTUP" = "color" ] && echo
echo
return $rc
else
@@ -226,7 +240,7 @@ action() {
fi
if [ $rc ]; then
- [ "$BOOTUP" != "color" ] && {
+ [ "$BOOTUP" = "verbose" ] && {
if [ -n "$output" ]; then
echo
echo $output
@@ -239,7 +253,7 @@ action() {
echo $output
failure "$STRING"
fi
- [ "$BOOTUP" = "color" ] && echo
+ [ "$BOOTUP" != "verbose" ] && echo
return $rc
fi
}
diff --git a/sysconfig/init b/sysconfig/init
new file mode 100644
index 00000000..3b49ec82
--- /dev/null
+++ b/sysconfig/init
@@ -0,0 +1,12 @@
+# color => new RH6.0 bootup
+# verbose => old-style bootup
+# anything else => new style bootup without ANSI colors or positioning
+BOOTUP=color
+# color for 'OK' label ; 2=green
+COLOR_SUCCESS=2
+# color for 'FAILED' label ; 1=red
+COLOR_FAILURE=1
+# column to start "[ OK ]" label in
+RES_COL=60
+# default kernel loglevel on boot (syslog will reset this)
+LOGLEVEL=1