Subject: Re: implementing the rc.subr package on Linux
To: Jeremy C. Reed <reed@reedmedia.net>
From: Louis Guillaume <lguillaume@berklee.edu>
List: tech-pkg
Date: 10/18/2005 22:14:05
This is a cryptographically signed message in MIME format.

--------------ms030701030103060508020906
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Jeremy C. Reed wrote:
> On Mon, 17 Oct 2005, Louis Guillaume wrote:
> 
>> I've installed the rc.subr and rcorder packages on Linux (RedHat). 
>> They work fine, but aren't part of the general system startup 
>> proceudures.
>>
>> What is the best, or recommended way to implement these so that 
>> pkgsrc-built services will start up at boot time?
>>
>> Same question goes for other systems, such as AIX, Macintosh etc.
> 
> 
> You may want to look at pkgsrc-wip's wip/mk/rcd.mk. It was any idea that 
> I never tested myself nor implemented.

I'll have to take a look.

> One thing that could be done is to have all the pkgsrc provided rc.d 
> scripts not hard-code: . /etc/rc.subr but instead use
> . @PKG_SYSCONFDIR@/rc.subr
> 
> There was discussion about this a couple years ago.
> 

That makes sense (and should probably be done, IMO)

> Also, I packaged up my own wip/rc.subr because the pkgsrc version didn't 
> meet my needs. I need to go back and see if it can be removed or not.
> 

Is this in wip currently?

> I use PKG_SYSCONFBASE=/etc and so I don't have this problem myself once 
> I have rc.subr installed.
> 

Ok. I have PKG_SYSCONFBASE=/etc and rc.subr/rcorder installed and they 
work great, but I need them to startup at boot time.

> I do use rc.subr and rcorder on various Linux systems for a couple years 
> now.
> 


What I need is a way for automatic startup and shutdown procedures 
during init.x.

Here's my current workaround: Slackware 10, in /etc/rc.d





--- rc.6.orig   2005-10-18 13:32:52.000000000 -0400
+++ rc.6        2005-10-18 13:35:47.000000000 -0400
@@ -13,6 +13,18 @@
  # Set the path.
  PATH=/sbin:/etc:/bin:/usr/bin

+#######################################################
+# Pkgsrc...
+#
+# Shut Down any pkgsrc-related processes...
+
+/usr/bin/sed -n 's/^\([^=\#][^=\#]*\)=.*/\1/p' /etc/rc.conf | while 
read rcscript ;do
+  [ -x "/etc/rc.d/$rcscript" ] && /etc/rc.d/$rcscript stop
+done
+
+#
+#######################################################
+
  # If there are SystemV init scripts for this runlevel, run them.
  if [ -x /etc/rc.d/rc.sysvinit ]; then
    . /etc/rc.d/rc.sysvinit

--- rc.K.orig   2005-10-18 13:32:52.000000000 -0400
+++ rc.K        2005-10-18 13:35:47.000000000 -0400
@@ -14,6 +14,18 @@
  # Set the path.
  PATH=/sbin:/etc:/bin:/usr/bin

+#######################################################
+# Pkgsrc...
+#
+# Shut Down any pkgsrc-related processes...
+
+/usr/bin/sed -n 's/^\([^=\#][^=\#]*\)=.*/\1/p' /etc/rc.conf | while 
read rcscript ;do
+  [ -x "/etc/rc.d/$rcscript" ] && /etc/rc.d/$rcscript stop
+done
+
+#
+#######################################################
+
  # If there are SystemV init scripts for this runlevel, run them.
  if [ -x /etc/rc.d/rc.sysvinit ]; then
    . /etc/rc.d/rc.sysvinit

--- rc.local.orig       2005-10-18 13:51:16.000000000 -0400
+++ rc.local    2005-10-18 17:08:59.000000000 -0400
@@ -3,3 +3,10 @@
  # /etc/rc.d/rc.local:  Local system initialization script.
  #
  # Put any local setup commands in here:
+
+
+# Start up any pkgsrc rc scripts...
+
+sed -n 's/^\([^=\#][^=\#]*\)=.*/\1/p' /etc/rc.conf | while read 
rcscript ;do
+  [ -x "/etc/rc.d/$rcscript" ] && /etc/rc.d/$rcscript start
+done

--------------ms030701030103060508020906
Content-Type: application/x-pkcs7-signature; name="smime.p7s"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="smime.p7s"
Content-Description: S/MIME Cryptographic Signature

MIAGCSqGSIb3DQEHAqCAMIACAQExCzAJBgUrDgMCGgUAMIAGCSqGSIb3DQEHAQAAoIII/TCC
AtkwggJCoAMCAQICAw5BgDANBgkqhkiG9w0BAQQFADBiMQswCQYDVQQGEwJaQTElMCMGA1UE
ChMcVGhhd3RlIENvbnN1bHRpbmcgKFB0eSkgTHRkLjEsMCoGA1UEAxMjVGhhd3RlIFBlcnNv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