sysvinit patch

Auke Kok sofar at lunar-linux.org
Tue Jun 8 21:38:41 GMT 2004


additionally, we should provide the following lines by default in 
inittab: (as our init handles them)

# what to do on power events:
#pf::powerwait:/etc/init.d/powerfail start
#pn::powerfailnow:/etc/init.d/powerfail now
#po::powerokwait:/etc/init.d/powerfail stop

sofar


Auke Kok wrote:
> 
> here's a patch I'd like to merge with the sysvinit module that 
> accomplishes:
> 
> - tracking and updating of inittab and init.d/rc|rcS|halt|reboot|signals 
> scripts by using proper updating and BUILD instead of POST_INSTALL
> 
> - removed x/g/k-dm from inittab since preferred way to start these is by 
> init.d scripts
> 
> - slightly stripped /etc/init.d/scS, all those paths really are not 
> needed as init itself gives the proper path (see man init).
> 
> if there are no objections I'll merge it later
> 
> sofar
> 
> 
> ------------------------------------------------------------------------
> 
> Index: BUILD
> ===================================================================
> RCS file: /var/cvs/lunar/moonbase/utils/sysvinit/BUILD,v
> retrieving revision 1.3
> diff -u -u -a -u -r1.3 BUILD
> --- BUILD	22 Apr 2003 21:03:44 -0000	1.3
> +++ BUILD	8 Jun 2004 21:26:58 -0000
> @@ -3,6 +3,28 @@
>    make  -C src          &&
>    prepare_install       &&
>    make  -C src install  &&
> -  install -m0755 $SCRIPT_DIRECTORY/service /sbin/service
> +  install -m0755 $SCRIPT_DIRECTORY/service /sbin/service &&
> +  mkdir -p /etc/rc0.d /etc/rc1.d /etc/rc2.d /etc/rc3.d /etc/rc4.d /etc/rc5.d /etc/rc6.d /etc/rcS.d /etc/init.d /var/run /var/log ||
> +	# error out here in case of failure
> +	exit 1
> +	
> +	# the rest should be safe now:
> +	if [ ! -e /etc/inittab ] ; then
> +	  install -m0600 $SCRIPT_DIRECTORY/inittab /etc/
> +	fi
> +	
> +	for SCRIPT in halt rc rcS reboot signals ; do
> +	  if [ ! -e /etc/init.d/$SCRIPT ] ; then
> +		  install -m0700 $SCRIPT_DIRECTORY/init.d/$SCRIPT /etc/init.d/
> +		fi
> +	done
> +	
> +	ln -sf ../init.d/signals /etc/rc0.d/S80signals
> +	ln -sf ../init.d/halt    /etc/rc0.d/S90halt
> +	ln -sf ../init.d/signals /etc/rc6.d/S80signals
> +	ln -sf ../init.d/reboot  /etc/rc6.d/S90reboot
> +
> +	touch     /var/run/utmp /var/log/wtmp /var/log/btmp /var/log/lastlog
> +	chmod 644 /var/run/utmp /var/log/wtmp /var/log/btmp /var/log/lastlog
>  
>  ) > $C_FIFO 2>&1
> Index: inittab
> ===================================================================
> RCS file: /var/cvs/lunar/moonbase/utils/sysvinit/inittab,v
> retrieving revision 1.2
> diff -u -u -a -u -r1.2 inittab
> --- inittab	16 Feb 2003 18:31:09 -0000	1.2
> +++ inittab	8 Jun 2004 21:26:58 -0000
> @@ -11,6 +11,7 @@
>  # 5: same as 4, it is usually used for GUI login (xdm, gdm, kdm)
>  # 6: reboot the computer
>  
> +# what to do at normal runlevels:
>  l0:0:wait:/etc/init.d/rc 0
>  l1:1:wait:/etc/init.d/rc 1
>  l2:2:wait:/etc/init.d/rc 2
> @@ -19,8 +20,10 @@
>  l5:5:wait:/etc/init.d/rc 5
>  l6:6:wait:/etc/init.d/rc 6
>  
> +# what to to with the three-finger salute
>  ca:12345:ctrlaltdel:/sbin/shutdown -t1 -a -r now
>  
> +# which terminals should have consoles
>  c1:12345:respawn:/sbin/agetty 38400 tty1
>  c2:2345:respawn:/sbin/agetty 38400 tty2
>  c3:2345:respawn:/sbin/agetty 38400 tty3
> @@ -28,8 +31,5 @@
>  c5:234:respawn:/sbin/agetty 38400 tty5
>  c6:234:respawn:/sbin/agetty 38400 tty6
>  
> -# xfs:5:once:/usr/X11R6/bin/xfs
> -gdm:5:once:/usr/bin/gdm
> -kdm:5:once:/usr/bin/kdm
> -xdm:5:once:/usr/X11R6/bin/xdm
> +# this generates the login prompt
>  issu::once:/sbin/make-issue
> Index: init.d/rcS
> ===================================================================
> RCS file: /var/cvs/lunar/moonbase/utils/sysvinit/init.d/rcS,v
> retrieving revision 1.1.1.1
> diff -u -u -a -u -r1.1.1.1 rcS
> --- init.d/rcS	21 Aug 2002 00:55:22 -0000	1.1.1.1
> +++ init.d/rcS	8 Jun 2004 21:26:58 -0000
> @@ -1,15 +1,10 @@
>  #!/bin/sh
>  
> -PATH1="/sbin:/usr/sbin:/usr/local/sbin"
> -PATH2="/bin:/usr/bin:/usr/local/bin"
> -PATH3="/usr/games:/usr/local/games"
> -PATH4="/usr/bin/X11:/."
> - PATH="$PATH1:$PATH2:$PATH3:$PATH4"
> +umask 022
> +trap ":" INT QUIT TSTP
>  
> -export  PATH
> -umask   022
> -trap    ":" INT QUIT TSTP
> -
> -for  SCRIPT  in  /etc/rcS.d/S*;  do
> -  [  -x  $SCRIPT  ]  &&  $SCRIPT  start
> +for SCRIPT in /etc/rcS.d/S* ; do
> +  if [ -x $SCRIPT ] ; then
> +	  $SCRIPT start
> +	fi
>  done
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Lunar-dev mailing list
> Lunar-dev at lunar-linux.org
> http://lunar-linux.org/mailman/listinfo/lunar-dev




More information about the Lunar-dev mailing list