conf/56736: [PATCH] rcNG: enable packages to participate in rcorder(8)

Oliver Eikemeier eikemeier at fillmore-labs.com
Fri Sep 12 08:40:18 PDT 2003


>Number:         56736
>Category:       conf
>Synopsis:       [PATCH] rcNG: enable packages to participate in rcorder(8)
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Fri Sep 12 08:40:13 PDT 2003
>Closed-Date:
>Last-Modified:
>Originator:     Oliver Eikemeier
>Release:        FreeBSD 5.1-CURRENT i386
>Organization:
Fillmore Labs - http://www.fillmore-labs.com
>Environment:
System: FreeBSD nuuk.fillmore-labs.com 5.1-CURRENT

>Description:

- as ports adopt the rcNG system, they should be able to
  participate in rcorder(8), i.e. to provide alternative
  services (named from the bind9 port, mail from exim or
  an alternative inetd).

The following patch does the following:

- any file in ${local_startup} that contains
  '^# KEYWORDS?:'
  is started/stopped by /etc/rc
- scripts that do not contain this line are
  handled as usual

The only caveat is that run_rc_script from rc.subr(8)
sources files ending with .sh into the current shell,
not into a sub shell, which may abort the boot process
if a start script exits. Maybe the suffix should be
changed in /etc/rc.subr to .src, .fast or something
other unusual.

The patch addresses some other issues:

- rcorder(8) is looking for '# KEYWORD:' or '# KEYWORDS:',
  so adapt rc.shutdown to that.
- rc(8) wasn't loading rc.conf, so rc_fast_and_loose
  was ignored.

>How-To-Repeat:
>Fix:

--- localpkg.patch begins here ---
diff -u src/etc/rc.orig src/etc/rc
--- src/etc/rc.orig	Sun May 18 19:31:40 2003
+++ src/etc/rc	Fri Sep 12 16:02:39 2003
@@ -66,7 +66,14 @@
 fi
 
 os=`eval ${CMD_OSTYPE}`
-files=`rcorder -k ${os} -s nostart /etc/rc.d/* 2>/dev/null`
+load_rc_config "rc"
+_startup="/etc/rc.d/*"
+for dir in ${local_startup}; do
+	if [ -d "${dir}" ]; then
+		startup="${_startup} ${dir}/*"
+	fi
+done
+files=`rcorder -k ${os} -s nostart ${_startup} 2>/dev/null`
 
 for _rc_elem in ${files}; do
 	run_rc_script ${_rc_elem} ${_boot}
diff -u src/etc/rc.d/localpkg.orig src/etc/rc.d/localpkg
--- src/etc/rc.d/localpkg.orig	Wed Aug  6 02:35:13 2003
+++ src/etc/rc.d/localpkg	Fri Sep 12 16:20:17 2003
@@ -29,7 +29,7 @@
 		fi
 		for dir in ${local_startup}; do
 			if [ -d "${dir}" ]; then
-				for script in ${dir}/*.sh; do
+				for script in `grep -EL '^# KEYWORDS?:' ${dir}/*.sh 2>/dev/null`; do
 					slist="${slist}${script_name_sep}${script}"
 				done
 			fi
@@ -66,7 +66,7 @@
 		fi
 		for dir in ${local_startup}; do
 			if [ -d "${dir}" ]; then
-				for script in ${dir}/*.sh; do
+				for script in `grep -EL '^# KEYWORDS?:' ${dir}/*.sh 2>/dev/null`; do
 					slist="${slist}${script_name_sep}${script}"
 				done
 			fi
diff -u src/etc/rc.shutdown.orig src/etc/rc.shutdown
--- src/etc/rc.shutdown.orig	Mon Jul 14 13:01:29 2003
+++ src/etc/rc.shutdown	Fri Sep 12 16:06:18 2003
@@ -82,7 +82,7 @@
 # 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\``
+files=`eval grep -El \'^# KEYWORDS?:.*FreeBSD\' \`rcorder -k shutdown /etc/rc.d/* 2>/dev/null\``
 
 for _rc_elem in `reverse_list $files`; do
 	debug "run_rc_script $_rc_elem stop"
--- localpkg.patch ends here ---


>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list