Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 23 Jan 2004 06:50:21 -0800 (PST)
From:      Oliver Eikemeier <eikemeier@fillmore-labs.com>
To:        freebsd-bugs@FreeBSD.org
Subject:   Re: conf/56736: [PATCH] rcNG: enable packages to participate in rcorder(8)
Message-ID:  <200401231450.i0NEoLto007433@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR conf/56736; it has been noted by GNATS.

From: Oliver Eikemeier <eikemeier@fillmore-labs.com>
To: freebsd-gnats-submit@FreeBSD.org
Cc:  
Subject: Re: conf/56736: [PATCH] rcNG: enable packages to participate in rcorder(8)
Date: Fri, 23 Jan 2004 15:48:33 +0100

 An updated patch, which does essentially the following:
 
 - create a dummy dependency /etc/rc.d/PORTS
 
 - executes /etc/rc startup as normal until /etc/rc.d/PORTS, then
   reevalutes rcorder(8), including scripts from ${local_startup}
 
 - include ${local_startup} in /etc/rc.shutdown
 
 - does not start nor stop scripts containing '^# KEYWORD:' from
   /etc/rc.d/localpkg, as they are already handled by /etc/rc and
   /etc/rc.shutdown
 
 The only remaining problem is that '*.sh' scripts are sourced
 from /etc/rc.subr, instead of executed in a subshell. Therefore
 ports should install their start/stop scripts as ${PREFIX}/etc/rc.d/${PKGBASE}
 and add a small stub ${PREFIX}/etc/rc.d/${PKGBASE}.sh:
 
 #!/bin/sh
 #
 # $FreeBSD$
 #
 
 # KEYWORD: FreeBSD nostart
 
 if [ -r ${0%%.sh} ]; then
 	. ${0%%.sh}
 fi
 
 Patch for rc, rc.shutdown, rc.d/localpkg and rc.d/PORTS:
 
 --- src/etc/rc.orig	Fri May  2 07:27:33 2003
 +++ src/etc/rc	Fri Jan 23 15:35:40 2004
 @@ -53,7 +53,7 @@
  . /etc/rc.subr
  
  # Note: the system configuration files are loaded as part of
 -# the RCNG system (rc.d/rccond).  Do not load them here as it may
 +# the RCNG system (rc.d/rcconf.sh).  Do not load them here as it may
  # interfere with diskless booting.
  #
  if [ "$1" = autoboot ]; then
 @@ -69,6 +69,35 @@
  files=`rcorder -k ${os} -s nostart /etc/rc.d/* 2>/dev/null`
  
  for _rc_elem in ${files}; do
 +	if [ ${_rc_elem} = "/etc/rc.d/PORTS" ]; then
 +		break
 +	fi
 +	run_rc_script ${_rc_elem} ${_boot}
 +done
 +
 +# system configuration is loaded, reevalute rcorder
 +case ${local_startup} in
 +[Nn][Oo] | '')
 +	;;
 +*)
 +	_rc_startup="/etc/rc.d/*"
 +	for d in ${local_startup}; do
 +		if [ -d $d ]; then
 +			_rc_startup="${_rc_startup} ${d}/*"
 +		fi
 +	done
 +	files=`rcorder -k ${os} -s nostart ${_rc_startup} 2>/dev/null`
 +esac
 +
 +_rc_done=true
 +for _rc_elem in ${files}; do
 +	if ${_rc_done}; then
 +		if [ ${_rc_elem} = "/etc/rc.d/PORTS" ]; then
 +			_rc_done=false
 +		else
 +			continue
 +		fi
 +	fi
  	run_rc_script ${_rc_elem} ${_boot}
  done
  
 --- src/etc/rc.shutdown.orig	Tue Jul  8 04:52:14 2003
 +++ src/etc/rc.shutdown	Fri Jan 23 15:39:01 2004
 @@ -82,7 +82,19 @@
  # XXX - rcorder(8) with multiple -k switches works as a logical OR,
  #       so, we can't do this: rcorder -k shutdown -k FreeBSD.
  #
 -files=`eval grep -l \'^# KEYWORD:.*FreeBSD\' \`rcorder -k shutdown /etc/rc.d/* 2>/dev/null\``
 +_rc_startup="/etc/rc.d/*"
 +case ${local_startup} in
 +[Nn][Oo] | '')
 +        ;;
 +*)
 +	for d in ${local_startup}; do
 +		if [ -d $d ]; then
 +			_rc_startup="${_rc_startup} ${d}/*"
 +		fi
 +	done
 +	;;
 +esac
 +files=`eval grep -l \'^# KEYWORD:.*FreeBSD\' \`rcorder -k shutdown ${_rc_startup} 2>/dev/null\``
  
  for _rc_elem in `reverse_list $files`; do
  	debug "run_rc_script $_rc_elem stop"
 --- src/etc/rc.d/localpkg.orig	Wed Aug  6 02:35:13 2003
 +++ src/etc/rc.d/localpkg	Fri Jan 23 13:08:48 2004
 @@ -30,7 +30,9 @@
  		for dir in ${local_startup}; do
  			if [ -d "${dir}" ]; then
  				for script in ${dir}/*.sh; do
 -					slist="${slist}${script_name_sep}${script}"
 +					if ! grep -sq '^# KEYWORD:' ${script}; then
 +						slist="${slist}${script_name_sep}${script}"
 +					fi
  				done
  			fi
  		done
 @@ -67,7 +69,9 @@
  		for dir in ${local_startup}; do
  			if [ -d "${dir}" ]; then
  				for script in ${dir}/*.sh; do
 -					slist="${slist}${script_name_sep}${script}"
 +					if ! grep -sq '^# KEYWORD:' ${script}; then
 +						slist="${slist}${script_name_sep}${script}"
 +					fi
  				done
  			fi
  		done
 --- src/etc/rc.d/PORTS.orig	Fri Jan 23 15:11:00 2004
 +++ src/etc/rc.d/PORTS	Fri Jan 23 13:09:50 2004
 @@ -0,0 +1,11 @@
 +#!/bin/sh
 +#
 +# $FreeBSD$
 +#
 +
 +# PROVIDE: PORTS
 +# REQUIRE: diskless mountcritlocal
 +# BEFORE: addswap random
 +# KEYWORD: FreeBSD
 +
 +#	This is a dummy dependency to include ports into rcorder(8)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200401231450.i0NEoLto007433>