[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: init.d script best practice

From: Bob Proulx
Subject: Re: init.d script best practice
Date: Sat, 10 Feb 2007 10:09:00 -0700
User-agent: Mutt/1.5.9i

deckrider wrote:
> Is there a best practice example for using autoconf/automake to
> install system init scripts?  For instance, HP-UX looks for these in
> /sbin/init.d and /sbin/rc*.d and many others look to /etc/init.d and
> /etc/rc*.d.

I would recommend not using automake for this.  The format of the boot
time rc scripts are quite different from system to system.  Even on
one system across major versions changes happen and the boot time
scripts would need to track those changes.  Therefore it would be
difficult to write something portably in the spirit of automake.

However I do use 'make install' frequently to install into the
/usr/local tree for my own development purposes.  [I do this as a
non-root user being part of the 'staff' group.  This is very Debian
but I propagate that design to HP-UX and other places.]  Doing so is
convenient for development and if that is what you are intending then
this is quite reasonable.  But I would never pass this on to others to
install in that same way.  For others I would make a proper
installation package.

For your own development purposes you could extend automake and set up
install-exec-hook (or install-data-hook) to install your script to
/sbin/init.d/ at installation time.  Off the top of my head and
completely untested something like this:

EXTRA_DIST = bootscript

        cp $(srcdir)/bootscript /sbin/init.d/
        cd /sbin/rc3.d && $(LN_S) ../init.d/bootscript S900bootscript
        cd /sbin/rc4.d && $(LN_S) ../init.d/bootscript S900bootscript
        cd /sbin/rc5.d && $(LN_S) ../init.d/bootscript S900bootscript

        rm -f /sbin/rc3.d/S900bootscript
        rm -f /sbin/rc4.d/S900bootscript
        rm -f /sbin/rc5.d/S900bootscript
        rm -f /sbin/init.d/bootscript

That would of course be an HP-UX specific configuration.  I would feel
uncomfortable putting that in the  Therefore the way I
would make use of it would be to have a GNUmakefile that included the
full Makefile and also Makefile.maint (maintainer's makefile) and put
these rules in the Makefile.maint file.  Using GNU make it will use
GNUmakefile first which will include both of the others and everything
will work as expected.  A convenience is that in Makefile.maint you
can guarentee that you always have GNU make and therefor use extended
syntax.  As a developer I would be using GNU make and so this would
work fine.  I don't normally distribute the Makefile.maint file and
simply keep it for my own purposes such as the above but others do.
See the automake distribution and a few others for real life examples
of GNUmakefile and Makefile.maint files.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]