[leaf-commits] src/bering-uclibc4/source/etc/init.d bootmisc.sh, NONE, 1.1 checkroot.sh, NONE, 1.1 cron, NONE, 1.1 hostname.sh, NONE, 1.1 hwclock, NONE, 1.1 ifupdown, NONE, 1.1 inetd, NONE, 1.1 mountall.sh, NONE, 1.1 networking, NONE, 1.1 procps.sh, NONE, 1.1 rc, NONE, 1.1 rcS, NONE, 1.1 rmnologin, NONE, 1.1 sysklogd, NONE, 1.1 umountfs, NONE, 1.1 urandom, NONE, 1.1 watchdog, NONE, 1.1

KP Kirchd?rfer <[email protected]>
Newsgroups gmane.linux.leaf.cvs
Message-ID <[email protected]>
Update of /cvsroot/leaf/src/bering-uclibc4/source/etc/init.d
In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv3047

Added Files:
	bootmisc.sh checkroot.sh cron hostname.sh hwclock ifupdown 
	inetd mountall.sh networking procps.sh rc rcS rmnologin 
	sysklogd umountfs urandom watchdog 
Log Message:
fix path


--- NEW FILE: sysklogd ---
#! /bin/sh
# /etc/init.d/sysklogd: start the system log daemon.
RCDLINKS="0,K90 2,S00"

PATH=/bin:/usr/bin:/sbin:/usr/sbin

pidfile=/var/run/syslogd.pid
binpath=/sbin/syslogd

test -x $binpath || exit 0

# Options for start/restart the daemons
#   For remote UDP logging use SYSLOGD="-r"
#
SYSLOGD="-m 240"

case "$1" in
  start)
    echo -n "Starting system log daemon: syslogd"
    start-stop-daemon --start --quiet --exec $binpath -- $SYSLOGD
    echo "."
    ;;
  stop)
    echo -n "Stopping system log daemon: syslogd"
    start-stop-daemon --stop --quiet --exec $binpath --pidfile $pidfile
    echo "."
    ;;
  reload|force-reload)
    start-stop-daemon --stop --quiet --signal 1 --exec $binpath --pidfile $pidfile
    ;;
  restart)
    echo -n "Stopping system log daemon: syslogd"
    start-stop-daemon --stop --quiet --exec $binpath --pidfile $pidfile
    echo "."
    sleep 1
    echo -n "Starting system log daemon: syslogd"
    start-stop-daemon --start --quiet --exec $binpath -- $SYSLOGD
    echo "."
    ;;
  *)
    echo "Usage: /etc/init.d/sysklogd {start|stop|reload|restart|force-reload}"
    exit 1
esac

exit 0

--- NEW FILE: umountfs ---
#! /bin/sh
#
# umountfs	unmount all file systems.
#
RCDLINKS="0,S40"

PATH=/sbin:/bin:/usr/sbin:/usr/bin

echo -n "Unmounting file systems... "
umount -a -r
echo "done."

--- NEW FILE: procps.sh ---
#! /bin/sh
# /etc/init.d/procps: Set kernel variables from /etc/sysctl.conf
#
RCDLINKS="S,S30"

[ -x /sbin/sysctl ] || exit 0

if [ ! -r /etc/sysctl.conf ]
then
   exit 0
fi

echo "Setting kernel variables ..."
eval "/sbin/sysctl -p"
echo "done."

--- NEW FILE: networking ---
#!/bin/sh
#
# start/stop networking daemons.
RCDLINKS="2,S05 0,K95"

if ! [ -x /sbin/ifup ]; then
    exit 0
fi

case "$1" in
    start)
        echo -n "Configuring network interfaces: "
        ifup -a
	echo "done."
	;;
    stop)
        echo -n "Deconfiguring network interfaces: "
        ifdown -a
	echo "done."
        ;;
    reload)
	;;
    force-reload)
	$0 restart
	;;
    restart)
        echo -n "Reconfiguring network interfaces: "
        ifdown -a
        ifup -a
	echo "done."
	;;
    *)
	echo "Usage: /etc/init.d/networking {start|stop|reload|restart}"
	exit 1
	;;
esac

exit 0

--- NEW FILE: ifupdown ---
#!/bin/sh -e
RCDLINKS="2,S04"

case "$1" in
	start|restart)
		if [ -e /var/run/ifstate ]; then
			echo -n "Cleaning: /var/run/ifstate"
			echo -n >/var/run/ifstate
			echo "."
		fi
		;;
	stop|reload|force-reload)
		;;
esac

--- NEW FILE: rmnologin ---
#! /bin/sh
#
# rmnologin	This script removes the /etc/nologin file as the last
#		step in the boot process.
#
RCDLINKS="2,S99"

. /etc/default/rcS

if [ "$DELAYLOGIN" = yes ] && [ -f /etc/nologin ]
then
	rm -f /etc/nologin
fi

--- NEW FILE: cron ---
#!/bin/sh
# Start/stop the cron daemon.

RCDLINKS="0,K11 2,S89"

test -f /usr/sbin/cron || exit 0

case "$1" in
start)	
	echo -n "Starting periodic command scheduler: cron"
        start-stop-daemon --start --quiet --exec /usr/sbin/cron
        echo "." 
	;;
stop)	
	echo -n "Stopping periodic command scheduler: cron"
        start-stop-daemon --stop --quiet --exec /usr/sbin/cron
        echo "."
        ;;
restart)
	echo -n "Re-starting periodic command scheduler: cron"
        start-stop-daemon --stop --quiet --exec /usr/sbin/cron
        start-stop-daemon --start --quiet --exec /usr/sbin/cron
        echo "."
        ;;
reload|force-reload) 
	echo -n "Re-loading configuration files for periodic command scheduler: cron"
	# cron reloads automatically
        echo "."
        ;;
*)	
	echo "Usage: /etc/init.d/cron start|stop"; exit 1 
        ;;
esac

exit 0

--- NEW FILE: rc ---
#! /bin/sh
#
# rc		This file is responsible for starting/stopping
#		services when the runlevel changes.
#
# Author:	Miquel van Smoorenburg <[email protected]>
#		Bruce Perens <[email protected]>
#
#		Made sh compatible by Philip Hands via proxy of Dave Cinege
#		  (In other words I couldn't figure it out on my own)
#

# Un-comment the following for debugging.
# debug=echo

#
# Start script or program.
#
startup() {
  case "$1" in
	*.sh)
		$debug sh "$@"
		;;
	*)
		$debug "$@"
		;;
  esac
}

  # Ignore CTRL-C only in this shell, so we can interrupt subprocesses.
  trap ":" 2 3 20

  # Set onlcr to avoid staircase effect.
  stty onlcr 0>&1

  # Get first argument. Set runlevel to this argument.
  [ "$1" != "" ] && runlevel=$1

  # Is there an rc directory for this runlevel?
  if [ -d /etc/rc$runlevel.d ]
  then
	# First, run the KILL scripts.
	for i in /etc/rc$runlevel.d/K[0-9][0-9]*
	do
		# Check if the script is there.
		[ ! -f $i ] && continue

		# Stop the service.
		startup $i stop
	done
	# Now run the START scripts for this runlevel.
	for i in /etc/rc$runlevel.d/S*
	do
		[ ! -f $i ] && continue
		case "$runlevel" in
			0|6)
				startup $i stop
				;;
			*)
				startup $i start
				;;
		esac
	done
  fi
# eof /etc/init.d/rc

--- NEW FILE: mountall.sh ---
#
# mountall.sh	Mount all filesystems.
#
RCDLINKS="S,S35"

#
# Mount local file systems in /etc/fstab.
#
echo "Mounting local file systems..."
mount -a

--- NEW FILE: rcS ---
#! /bin/sh
#
# rcS		Call all S??* scripts in /etc/rcS.d in
#		numerical/alphabetical order.
#

PATH=/sbin:/bin:/usr/sbin:/usr/bin
umask 022
export PATH

. /etc/default/rcS

#
#	Create wtmp file.
#
! test -f /var/log/wtmp  && touch /var/log/wtmp

#
#	Trap CTRL-C &c only in this shell so we can interrupt subprocesses.
#
trap ":" 2 3 20

#
#	Dynamic creation of rc?.d symlinks. [LRP]
#
[ "$DYNARCD" != no ] && update-rc.d -a -f -w >/dev/null 2>&1

#
#	Call all parts in order.
#
for i in /etc/rcS.d/S??*
do
	# Ignore dangling symlinks for now.
	[ ! -f "$i" ] && continue

	case "$i" in
		*.sh)
			# Source shell script for speed.
			(
				trap - 2 3 20
				. $i start
			)
			;;
		*)
			# No sh extension, so fork subprocess.
			$i start
			;;
	esac
done

--- NEW FILE: hwclock ---
#!/bin/sh
# hwclock.sh	Set and adjust the CMOS clock, according to the UTC
#		setting in /etc/default/rcS.
#
# Changes for LRP - Matthew Grant
#
RCDLINKS="S,S50 0,K25"

. /etc/default/rcS
[ "$GMT" = "-u" ] && GMT="--utc"

case "$1" in
	start)
		hwclock --hctosys $GMT
		#echo "Local time: `date`"
		;;
	stop|restart|reload)
		hwclock --systohc $GMT
		echo "CMOS clock updated to `date`."
		;;
	show)
		hwclock --show $GMT
		;;
	*)
		echo "Usage: hwclock {start|stop|reload|show}" >&2
		echo "       start sets kernel clock from CMOS clock" >&2
		echo "       stop and reload set CMOS clock from kernel clock" >&2
		exit 1
		;;
esac

--- NEW FILE: hostname.sh ---
RCDLINKS="S,S02"

#
# Set hostname.
#
hostname -F /etc/hostname


--- NEW FILE: urandom ---
#! /bin/sh
#
# urandom	This script saves the random seed between reboots.
#		It is called from the boot, halt and reboot scripts.
#
RCDLINKS="S,S55 0,S30"


[ -c /dev/urandom ] || exit 0

SAVEDFILE=/var/lib/random-seed
POOLSIZE=512
[ -f /proc/sys/kernel/random/poolsize ] && POOLSIZE="$(cat /proc/sys/kernel/random/poolsize)"

case "$1" in
	start|"")
		echo -n "Initializing random number generator... "
		# Load and then save POOLSIZE bytes,
		# which is the size of the entropy pool
		if [ -f "$SAVEDFILE" ]
		then
		    cat "$SAVEDFILE" >/dev/urandom
		fi
		rm -f $SAVEDFILE
		umask 077
		dd if=/dev/urandom of=$SAVEDFILE bs=$POOLSIZE count=1 >/dev/null 2>&1 \
		|| echo "urandom start: failed."
		umask 022
		echo "done."
		;;
	stop)
		# Carry a random seed from shut-down to start-up;
		# see documentation in linux/drivers/char/random.c
		echo -n "Saving random seed... "
		umask 077
		dd if=/dev/urandom of=$SAVEDFILE bs=$POOLSIZE count=1 >/dev/null 2>&1 \
		|| echo "urandom stop: failed."	
		echo "done."
		;;
	*)
		echo "Usage: urandom {start|stop}" >&2
		exit 1
		;;
esac

--- NEW FILE: bootmisc.sh ---
#
# bootmisc.sh	Miscellaneous things to be done during bootup.
#
RCDLINKS="S,S55"

. /etc/default/rcS 
#
# Put a nologin file in /etc to prevent people from logging in before
# system startup is complete.
#
if [ "$DELAYLOGIN" = yes ]
then
  echo "System bootup in progress - please wait" >/etc/nologin
fi

#
# Create /var/run/utmp so that we can login.
#
: > /var/run/utmp

#
# Set pseudo-terminal access permissions.
#
#chmod 666 /dev/tty[p-za-e][0-9a-f]
#chown root:tty /dev/tty[p-za-e][0-9a-f]

#
# Save kernel messages in /var/log/dmesg
#
dmesg -s 524288 > /var/log/dmesg
#chgrp wheel /var/log/dmesg

#
# Update /etc/motd.
#
if [ "$EDITMOTD" != no ]
then
	n1=$(cat /proc/sys/kernel/hostname;\
	cat /proc/sys/kernel/osrelease; \
	cat /proc/sys/kernel/version)
	echo "LEAF Bering-uClibc" $n1 >/etc/motd

	echo "LEAF Bering-uClibc $(cat /var/lib/lrpkg/initrd.version) \n \l" >/etc/issue
	echo "LEAF Bering-uClibc $(cat /var/lib/lrpkg/initrd.version) %h" >/etc/issue.net
fi

--- NEW FILE: watchdog ---
#!/bin/sh
#/etc/init.d/watchdog: start watchdog daemon.

RCDLINKS="0,K80 2,S10"

test -x /sbin/watchdog || exit 0

# Set run_watchdog to 1 to start watchdog or 0 to disable it.
run_watchdog=1

case "$1" in
  start)
    if [ $run_watchdog = 1 ]
    then
        echo -n "Starting software watchdog... "
        if start-stop-daemon --start --quiet --exec /sbin/watchdog /dev/watchdog
        then
            echo done.
        else
            echo failed.
        fi
    fi
    ;;

  stop)
    if [ $run_watchdog = 1 ]
    then
        echo -n "Stopping software watchdog..."
	if start-stop-daemon --stop --quiet --oknodo --exec /sbin/watchdog
        then
            echo done.
        else
            echo failed.
        fi
    fi
    ;;

  *)
    echo "Usage: /etc/init.d/watchdog {start|stop}"
    exit 1

esac

exit 0

--- NEW FILE: inetd ---
#!/bin/sh 
#
# start/stop inetd super server.

RCDLINKS="0,K20 2,S20"

if ! [ -x /usr/sbin/inetd ]; then
	exit 0
fi

checkportmap () {
    if grep -v "^ *#" /etc/inetd.conf | grep 'rpc/' >/dev/null; then
        if ! [ -x /usr/bin/rpcinfo ]
        then
            echo
            echo "WARNING: rpcinfo not available - RPC services may be unavailable!"
            echo "         (Commenting out the rpc services in inetd.conf will"
	    echo "         disable this message)"
            echo
        elif ! /usr/bin/rpcinfo -u localhost portmapper >/dev/null 2>/dev/null
        then
            echo
            echo "WARNING: portmapper inactive - RPC services unavailable!"
            echo "         (Commenting out the rpc services in inetd.conf will"
	    echo "         disable this message)"
            echo
        fi
    fi
} 

case "$1" in
    start)
        checkportmap
	echo -n "Starting internet superserver:"
	echo -n " inetd" ; start-stop-daemon --start --quiet --pidfile /var/run/inetd.pid --exec /usr/sbin/inetd
	echo "."
	;;
    stop)
	echo -n "Stopping internet superserver:"
	echo -n " inetd" ; start-stop-daemon --stop --quiet --oknodo --pidfile /var/run/inetd.pid --exec /usr/sbin/inetd
	echo "."
	;;
    reload)
	echo -n "Reloading internet superserver:"
	echo -n " inetd"
	start-stop-daemon --stop --quiet --oknodo --pidfile /var/run/inetd.pid --signal 1
	echo "."
	;;
    force-reload)
	$0 reload
	;;
    restart)
	echo -n "Restarting internet superserver:"
	echo -n " inetd"
	start-stop-daemon --stop --quiet --oknodo --pidfile /var/run/inetd.pid
	checkportmap
	start-stop-daemon --start --quiet --pidfile /var/run/inetd.pid --exec /usr/sbin/inetd
	echo "."
	;;
    *)
	echo "Usage: /etc/init.d/inetd {start|stop|reload|restart}"
	exit 1
	;;
esac

exit 0


--- NEW FILE: checkroot.sh ---
#
# checkroot.sh	Check to root file system.
#
RCDLINKS="S,S10"

. /etc/default/rcS
#
# Set SULOGIN to yes if you want a sulogin to be spawned from
# this script *before anything else* with a timeout, like on SCO.

[ "$SULOGIN" = yes ] && sulogin -t 30 $CONSOLE


------------------------------------------------------------------------------
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.