diff options
author | Bill Nottingham <notting@redhat.com> | 2002-12-14 19:51:10 +0000 |
---|---|---|
committer | Bill Nottingham <notting@redhat.com> | 2002-12-14 19:51:10 +0000 |
commit | 213eb0cb95ba02f69a0d2c17f49b19ebc3ab8bb2 (patch) | |
tree | 1ca8e184c3b390bae4363431b24f721408f63866 | |
parent | e0b40c1daab68e751fb0d6a29198fa8f6bb88e12 (diff) | |
download | initscripts-213eb0cb95ba02f69a0d2c17f49b19ebc3ab8bb2.tar initscripts-213eb0cb95ba02f69a0d2c17f49b19ebc3ab8bb2.tar.gz initscripts-213eb0cb95ba02f69a0d2c17f49b19ebc3ab8bb2.tar.bz2 initscripts-213eb0cb95ba02f69a0d2c17f49b19ebc3ab8bb2.tar.xz initscripts-213eb0cb95ba02f69a0d2c17f49b19ebc3ab8bb2.zip |
merge LSB support backr6-47-2
-rw-r--r-- | ChangeLog | 15 | ||||
-rw-r--r-- | initscripts.spec | 5 | ||||
-rwxr-xr-x | rc.d/init.d/functions | 43 | ||||
-rwxr-xr-x | rc.d/init.d/netfs | 3 | ||||
-rwxr-xr-x | rc.d/init.d/network | 94 |
5 files changed, 135 insertions, 25 deletions
@@ -1,3 +1,18 @@ +2002-12-14 Bill Nottingham <notting@redhat.com> 6.47.2-1 + + * ChangeLog, initscripts.spec: 6.47.2-1 + + * rc.d/init.d/functions: be quiet if $LSB is set + + * rc.d/init.d/functions: + add --force to daemon() (needed for LSB) + + * rc.d/init.d/netfs, rc.d/init.d/network: + provide various LSB init facilities + + * rc.d/init.d/functions: + add warning message target. For LSB stuff + 2002-08-22 Bill Nottingham <notting@redhat.com> * ChangeLog, initscripts.spec: 6.47.1-1 diff --git a/initscripts.spec b/initscripts.spec index 9ae07252..65ac6eb7 100644 --- a/initscripts.spec +++ b/initscripts.spec @@ -1,6 +1,6 @@ Summary: The inittab file and the /etc/init.d scripts. Name: initscripts -Version: 6.47.1 +Version: 6.47.2 License: GPL Group: System Environment/Base Release: 1 @@ -240,6 +240,9 @@ rm -rf $RPM_BUILD_ROOT %dir /etc/locale/*/LC_MESSAGES %changelog +* Sat Dec 14 2002 Bill Nottingham <notting@redhat.com> +- LSB support + * Thu Aug 22 2002 Bill Nottingham <notting@redhat.com> - fix usb startup (#71355) diff --git a/rc.d/init.d/functions b/rc.d/init.d/functions index c888e022..e3c0419e 100755 --- a/rc.d/init.d/functions +++ b/rc.d/init.d/functions @@ -85,7 +85,7 @@ checkpid() { # A function to start a program. daemon() { # Test syntax. - local gotbase= + local gotbase= force= local base= user= nice= bg= pid nicelevel=0 while [ "$1" != "${1##[-+]}" ]; do @@ -110,6 +110,10 @@ daemon() { user=${1#--user=} shift ;; + --force) + force="force" + shift + ;; [-+][0-9]*) nice="nice -n $1" shift @@ -125,14 +129,14 @@ daemon() { # See if it's already running. Look *only* at the pid file. pid=`pidfileofproc $base` - [ -n "${pid:-}" ] && return + [ -n "${pid:-}" -a -z "${force:-}" ] && return # make sure it doesn't core dump anywhere; while this could mask # problems with the daemon, it also closes some security problems ulimit -S -c 0 >/dev/null 2>&1 # Echo daemon - [ "${BOOTUP:-}" = "verbose" ] && echo -n " $base" + [ "${BOOTUP:-}" = "verbose" -a -z "$LSB" ] && echo -n " $base" # And start it up. if [ -z "$user" ]; then @@ -172,7 +176,7 @@ killproc() { # Kill it. if [ -n "${pid:-}" ] ; then - [ "$BOOTUP" = "verbose" ] && echo -n "$base " + [ "$BOOTUP" = "verbose" -a -z "$LSB" ] && echo -n "$base " if [ "$notset" -eq "1" ] ; then if checkpid $pid 2>&1; then # TERM first, then KILL if not dead @@ -330,6 +334,17 @@ echo_passed() { return 1 } +echo_warning() { + [ "$BOOTUP" = "color" ] && $MOVE_TO_COL + echo -n "[" + [ "$BOOTUP" = "color" ] && $SETCOLOR_WARNING + echo -n $"WARNING" + [ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL + echo -n "]" + echo -ne "\r" + return 1 +} + # Log that something succeeded success() { if [ -z "${IN_INITLOG:-}" ]; then @@ -340,7 +355,7 @@ success() { echo "$INITLOG_ARGS -n $0 -s \"$1\" -e 1" >&21 trap - SIGPIPE fi - [ "$BOOTUP" != "verbose" ] && echo_success + [ "$BOOTUP" != "verbose" -a -z "$LSB" ] && echo_success return 0 } @@ -354,7 +369,7 @@ failure() { echo "$INITLOG_ARGS -n $0 -s \"$1\" -e 2" >&21 trap - SIGPIPE fi - [ "$BOOTUP" != "verbose" ] && echo_failure + [ "$BOOTUP" != "verbose" -a -z "$LSB" ] && echo_failure return $rc } @@ -368,7 +383,21 @@ passed() { echo "$INITLOG_ARGS -n $0 -s \"$1\" -e 1" >&21 trap - SIGPIPE fi - [ "$BOOTUP" != "verbose" ] && echo_passed + [ "$BOOTUP" != "verbose" -a -z "$LSB" ] && echo_passed + return $rc +} + +# Log a warning +warning() { + rc=$? + if [ -z "${IN_INITLOG:-}" ]; then + initlog $INITLOG_ARGS -n $0 -s "$1" -e 1 + else + trap "" SIGPIPE + echo "$INITLOG_ARGS -n $0 -s \"$1\" -e 1" >&21 + trap - SIGPIPE + fi + [ "$BOOTUP" != "verbose" -a -z "$LSB" ] && echo_warning return $rc } diff --git a/rc.d/init.d/netfs b/rc.d/init.d/netfs index 53c49089..2f327a14 100755 --- a/rc.d/init.d/netfs +++ b/rc.d/init.d/netfs @@ -8,6 +8,9 @@ # chkconfig: 345 25 75 # description: Mounts and unmounts all Network File System (NFS), \ # SMB (Lan Manager/Windows), and NCP (NetWare) mount points. +### BEGIN INIT INFO +# Provides: $local_fs $remote_fs +### END INIT INFO # Source networking configuration. if [ ! -f /etc/sysconfig/network ]; then diff --git a/rc.d/init.d/network b/rc.d/init.d/network index a185b934..53f8fb41 100755 --- a/rc.d/init.d/network +++ b/rc.d/init.d/network @@ -6,6 +6,9 @@ # description: Activates/Deactivates all network interfaces configured to \ # start at boot time. # probe: true +### BEGIN INIT INFO +# Provides: $network +### END INIT INFO # Source function library. . /etc/init.d/functions @@ -24,8 +27,7 @@ fi # Check that networking is up. [ "${NETWORKING}" = "no" ] && exit 0 -# if the ip configuration utility isn't around we can't function. -[ -x /sbin/ip ] || exit 1 +[ -x /sbin/ifconfig ] || exit 0 # Even if IPX is configured, without the utilities we can't do much [ ! -x /sbin/ipx_internal_net -o ! -x /sbin/ipx_configure ] && IPX= @@ -63,8 +65,7 @@ case "$1" in action $"Setting network parameters: " sysctl -e -p /etc/sysctl.conf - # bring up loopback interface - action $"Bringing up loopback interface: " ./ifup ifcfg-lo + action $"Bringing up interface lo: " ./ifup ifcfg-lo case "$IPX" in yes|true) @@ -76,11 +77,9 @@ case "$1" in ;; esac - oldhotplug=`sysctl kernel.hotplug 2>/dev/null | \ - awk '{ print $3 }' 2>/dev/null` + oldhotplug=`sysctl kernel.hotplug 2>/dev/null| awk '{ print $3 }' 2>/dev/null` sysctl -w kernel.hotplug="/bin/true" > /dev/null 2>&1 - # bring up all other interfaces configured to come up at boot time for i in $interfaces; do if [ "${i##eth}" != "$i" ] && ! is_available $i ; then continue @@ -108,7 +107,7 @@ case "$1" in action $"Bringing up interface $i: " ./ifup $i boot done - # Bring up CIPE VPN interfaces + # add cipe here. cipeinterfaces=`ls ifcfg* | LANG=C egrep -v '(ifcfg-lo|:|rpmsave|rpmorig|rpmnew)' | \ LANG=C egrep -v '(~|\.bak)$' | \ LANG=C egrep 'ifcfg-cipcb[0-9]+$' | \ @@ -173,9 +172,8 @@ case "$1" in fi fi - # shut down all interfaces (other than loopback) for i in $interfaces ; do - if ! check_device_down $i; then + if LC_ALL= LANG= ifconfig $i 2>/dev/null | grep -q " UP " >/dev/null 2>&1 ; then action $"Shutting down interface $i: " ./ifdown $i boot fi done @@ -186,9 +184,7 @@ case "$1" in fi ;; esac - - action $"Shutting down loopback interface: " ./ifdown ifcfg-lo - + ./ifdown ifcfg-lo if [ -d /proc/sys/net/ipv4 ]; then if [ -f /proc/sys/net/ipv4/ip_forward ]; then if [ `cat /proc/sys/net/ipv4/ip_forward` != 0 ]; then @@ -215,16 +211,80 @@ case "$1" in echo $"Configured devices:" echo lo $interfaces - echo $"Currently active devices:" - echo `/sbin/ip -o link show | awk -F ": " '{ print $2 }'` + if [ -x /sbin/linuxconf ] ; then + eval `/sbin/linuxconf --hint netdev` + echo $"Devices that are down:" + echo $DEV_UP + echo $"Devices with modified configuration:" + echo $DEV_RECONF + else + echo $"Currently active devices:" + echo `/sbin/ifconfig | grep ^[a-z] | awk '{print $1}'` + fi ;; - restart|reload) + restart) cd $CWD $0 stop $0 start ;; + reload) + if [ -x /sbin/linuxconf ] ; then + eval `/sbin/linuxconf --hint netdev` + for device in $DEV_UP ; do + action $"Bringing up device $device: " ./ifup $device + done + for device in $DEV_DOWN ; do + action $"Shutting down device $device: " ./ifdown $device + done + for device in $DEV_RECONF ; do + action $"Shutting down device $device: " ./ifdown $device + action $"Bringing up device $device: " ./ifup $device + done + for device in $DEV_RECONF_ALIASES ; do + action $"Bringing up alias $device: " /etc/sysconfig/network-scripts/ifup-aliases $device + done + for device in $DEV_RECONF_ROUTES ; do + action $"Bringing up route $device: " /etc/sysconfig/network-scripts/ifup-routes $device + done + case $IPX in yes|true) + case $IPXINTERNALNET in + reconf) + action $"Deleting internal IPX network: " /sbin/ipx_internal_net del + action $"Adding internal IPX network $IPXINTERNALNETNUM $IPXINTERNALNODENUM: " /sbin/ipx_internal_net add $IPXINTERNALNETNUM \ + $IPXINTERNALNODENUM + ;; + add) + action $"Adding internal IPX network $IPXINTERNALNETNUM $IPXINTERNALNODENUM: " /sbin/ipx_internal_net add $IPXINTERNALNETNUM \ + $IPXINTERNALNODENUM + ;; + del) + action $"Deleting internal IPX network: " /sbin/ipx_internal_net del + ;; + esac + ;; + esac + else + cd $CWD + $0 restart + fi + ;; + probe) + if [ -x /sbin/linuxconf ] ; then + eval `/sbin/linuxconf --hint netdev` + [ -n "$DEV_UP$DEV_DOWN$DEV_RECONF$DEV_RECONF_ALIASES" -o \ + -n "$DEV_RECONF_ROUTES$IPXINTERNALNET" ] && \ + echo reload + exit 0 + else + # if linuxconf isn't around to figure stuff out for us, + # we punt. Probably better than completely reloading + # networking if user isn't sure which to do. If user + # is sure, they would run restart or reload, not probe. + exit 0 + fi + ;; *) - echo $"Usage: $0 {start|stop|restart|reload|status}" + echo $"Usage: $0 {start|stop|restart|reload|status|probe}" exit 1 esac |