Author: dj
Date: 2007-02-17 19:16:25 -0700 (Sat, 17 Feb 2007)
New Revision: 7925

Added:
   trunk/bootscripts/contrib/lsb-v3/INSTALL
   trunk/bootscripts/contrib/lsb-v3/Makefile
Modified:
   trunk/bootscripts/contrib/lsb-v3/README
   trunk/bootscripts/contrib/lsb-v3/init.d/lfs-functions
   trunk/bootscripts/contrib/lsb-v3/init.d/template
Log:
contrib/lsb-v3 - added Makefile, README, INSTALL, and other cleanups

Added: trunk/bootscripts/contrib/lsb-v3/INSTALL
===================================================================
--- trunk/bootscripts/contrib/lsb-v3/INSTALL                            (rev 0)
+++ trunk/bootscripts/contrib/lsb-v3/INSTALL    2007-02-18 02:16:25 UTC (rev 
7925)
@@ -0,0 +1,32 @@
+LSB-V3 Installation:
+
+Inline LFS installation:  make install &&
+                          sed -i.bak 's@/etc/rc.d@/etc@' /etc/inittab
+
+
+After LFS:  for file in /etc/rc.d /etc/sysconfig/rc /etc/sysconfig/modules \
+                /etc/sysconfig/createfiles
+              do
+                mv $file $file.bak
+              done &&
+            make install &&
+            sed -i.bak 's@/etc/rc.d@/etc@' /etc/inittab
+
+
+With existing scripts:  HERE=$PWD
+                        cp -a /etc/rc.d /etc/rc.d.bak &&
+                        mv /etc/rc.d/* /etc &&
+                        cd /etc/rc.d &&
+                        ln -s ../rc*.d . &&
+                        ln -s ../init.d . &&
+                        for file in /etc/rc.d /etc/syconfig/rc \
+                            /etc/sysconfig/modules /etc/sysconfig/createfiles
+                          do
+                            mv $file $file.bak
+                          done &&
+                        cd $HERE &&
+                        unset HERE &&
+                        make install &&
+                        sed -i.bak 's@/etc/rc.d@/etc/@' /etc/inittab
+                        
+That's it!

Added: trunk/bootscripts/contrib/lsb-v3/Makefile
===================================================================
--- trunk/bootscripts/contrib/lsb-v3/Makefile                           (rev 0)
+++ trunk/bootscripts/contrib/lsb-v3/Makefile   2007-02-18 02:16:25 UTC (rev 
7925)
@@ -0,0 +1,129 @@
+ETCDIR=/etc
+EXTDIR=${DESTDIR}${ETCDIR}
+MODE=754
+DIRMODE=755
+CONFMODE=644
+
+all: install
+
+create-dirs:
+       install -d -m ${DIRMODE} ${EXTDIR}/rc0.d
+       install -d -m ${DIRMODE} ${EXTDIR}/rc1.d
+       install -d -m ${DIRMODE} ${EXTDIR}/rc2.d
+       install -d -m ${DIRMODE} ${EXTDIR}/rc3.d
+       install -d -m ${DIRMODE} ${EXTDIR}/rc4.d
+       install -d -m ${DIRMODE} ${EXTDIR}/rc5.d
+       install -d -m ${DIRMODE} ${EXTDIR}/rc6.d
+       install -d -m ${DIRMODE} ${EXTDIR}/rcsysinit.d
+       install -d -m ${DIRMODE} ${EXTDIR}/init.d
+       install -d -m ${DIRMODE} ${EXTDIR}/sysconfig
+       install -d -m ${DIRMODE} ${DESTDIR}/lib/lsb
+
+create-service-dir:
+       install -d -m ${DIRMODE} ${EXTDIR}/sysconfig/network-devices/services
+
+create-boottemp-dir:
+       install -d -m ${DIRMODE} ${EXTDIR}/init.d/boottemp
+
+install: create-dirs create-service-dir create-boottemp-dir
+       install -m ${MODE} init.d/checkfs           ${EXTDIR}/init.d/
+       install -m ${MODE} init.d/cleanfs           ${EXTDIR}/init.d/
+       install -m ${CONFMODE} init.d/lfs-functions ${EXTDIR}/init.d/
+       install -m ${MODE} init.d/halt              ${EXTDIR}/init.d/
+       install -m ${MODE} init.d/console           ${EXTDIR}/init.d/
+       install -m ${MODE} init.d/localnet          ${EXTDIR}/init.d/
+       install -m ${MODE} init.d/modules           ${EXTDIR}/init.d/
+       install -m ${MODE} init.d/mountfs           ${EXTDIR}/init.d/
+       install -m ${MODE} init.d/mountkernfs       ${EXTDIR}/init.d/
+       install -m ${MODE} init.d/network           ${EXTDIR}/init.d/
+       install -m ${MODE} init.d/rc                ${EXTDIR}/init.d/
+       install -m ${MODE} init.d/reboot            ${EXTDIR}/init.d/
+       install -m ${MODE} init.d/sendsignals       ${EXTDIR}/init.d/
+       install -m ${MODE} init.d/setclock          ${EXTDIR}/init.d/
+       install -m ${MODE} init.d/sysklogd          ${EXTDIR}/init.d/
+       install -m ${MODE} init.d/swap              ${EXTDIR}/init.d/
+       install -m ${MODE} init.d/sysctl            ${EXTDIR}/init.d/
+       install -m ${MODE} init.d/template          ${EXTDIR}/init.d/
+       install -m ${MODE} init.d/udev              ${EXTDIR}/init.d/
+       install -m ${MODE} init.d/udev_retry        ${EXTDIR}/init.d/
+       install -m ${CONFMODE} lsb/init-functions   ${DESTDIR}/lib/lsb/
+       ln -sf ../init.d/network     ${EXTDIR}/rc0.d/K80network
+       ln -sf ../init.d/sysklogd    ${EXTDIR}/rc0.d/K90sysklogd
+       ln -sf ../init.d/sendsignals ${EXTDIR}/rc0.d/S60sendsignals
+       ln -sf ../init.d/mountfs     ${EXTDIR}/rc0.d/S70mountfs
+       ln -sf ../init.d/swap        ${EXTDIR}/rc0.d/S80swap
+       ln -sf ../init.d/localnet    ${EXTDIR}/rc0.d/S90localnet
+       ln -sf ../init.d/halt        ${EXTDIR}/rc0.d/S99halt
+       ln -sf ../init.d/network     ${EXTDIR}/rc1.d/K80network
+       ln -sf ../init.d/sysklogd    ${EXTDIR}/rc1.d/K90sysklogd
+       ln -sf ../init.d/network     ${EXTDIR}/rc2.d/K80network
+       ln -sf ../init.d/sysklogd    ${EXTDIR}/rc2.d/K90sysklogd
+       ln -sf ../init.d/sysklogd    ${EXTDIR}/rc3.d/S10sysklogd
+       ln -sf ../init.d/network     ${EXTDIR}/rc3.d/S20network
+       ln -sf ../init.d/sysklogd    ${EXTDIR}/rc4.d/S10sysklogd
+       ln -sf ../init.d/network     ${EXTDIR}/rc4.d/S20network
+       ln -sf ../init.d/sysklogd    ${EXTDIR}/rc5.d/S10sysklogd
+       ln -sf ../init.d/network     ${EXTDIR}/rc5.d/S20network
+       ln -sf ../init.d/network     ${EXTDIR}/rc6.d/K80network
+       ln -sf ../init.d/sysklogd    ${EXTDIR}/rc6.d/K90sysklogd
+       ln -sf ../init.d/sendsignals ${EXTDIR}/rc6.d/S60sendsignals
+       ln -sf ../init.d/mountfs     ${EXTDIR}/rc6.d/S70mountfs
+       ln -sf ../init.d/swap        ${EXTDIR}/rc6.d/S80swap
+       ln -sf ../init.d/localnet    ${EXTDIR}/rc6.d/S90localnet
+       ln -sf ../init.d/reboot      ${EXTDIR}/rc6.d/S99reboot
+       ln -sf ../init.d/mountkernfs ${EXTDIR}/rcsysinit.d/S00mountkernfs
+       ln -sf ../init.d/sysctl      ${EXTDIR}/rcsysinit.d/S05sysctl
+       ln -sf ../init.d/modules     ${EXTDIR}/rcsysinit.d/S10modules
+       ln -sf ../init.d/udev        ${EXTDIR}/rcsysinit.d/S15udev
+       ln -sf ../init.d/swap        ${EXTDIR}/rcsysinit.d/S20swap
+       ln -sf ../init.d/setclock    ${EXTDIR}/rcsysinit.d/S25setclock
+       ln -sf ../init.d/checkfs     ${EXTDIR}/rcsysinit.d/S30checkfs
+       ln -sf ../init.d/mountfs     ${EXTDIR}/rcsysinit.d/S40mountfs
+       ln -sf ../init.d/udev_retry  ${EXTDIR}/rcsysinit.d/S45udev_retry
+       ln -sf ../init.d/cleanfs     ${EXTDIR}/rcsysinit.d/S50cleanfs
+       ln -sf ../init.d/console     ${EXTDIR}/rcsysinit.d/S70console
+       ln -sf ../init.d/localnet    ${EXTDIR}/rcsysinit.d/S80localnet
+       if [ ! -f ${EXTDIR}/sysconfig/createfiles ]; then install -m 
${CONFMODE} sysconfig/createfiles ${EXTDIR}/sysconfig/; fi
+       if [ ! -f ${EXTDIR}/sysconfig/modules     ]; then install -m 
${CONFMODE} sysconfig/modules     ${EXTDIR}/sysconfig/; fi
+       if [ ! -f ${EXTDIR}/sysconfig/rc          ]; then install -m 
${CONFMODE} sysconfig/rc          ${EXTDIR}/sysconfig/; fi
+       if [ ! -f ${EXTDIR}/sysconfig/rc.site     ]; then install -m 
${CONFMODE} sysconfig/rc.site     ${EXTDIR}/sysconfig/; fi
+       install                   -m ${MODE} sysconfig/network-devices/ifup   
${EXTDIR}/sysconfig/network-devices/
+       install                   -m ${MODE} sysconfig/network-devices/ifdown 
${EXTDIR}/sysconfig/network-devices/
+       install                   -m ${MODE} 
sysconfig/network-devices/services/ipv4-static       
${EXTDIR}/sysconfig/network-devices/services/
+       install                   -m ${MODE} 
sysconfig/network-devices/services/ipv4-static-route 
${EXTDIR}/sysconfig/network-devices/services/
+
+minimal: create-dirs create-service-dir
+       install -m ${MODE} init.d/checkfs           ${EXTDIR}/init.d/
+       install -m ${MODE} init.d/cleanfs           ${EXTDIR}/init.d/
+       install -m ${CONFMODE} init.d/lfs-functions ${EXTDIR}/init.d/
+       install -m ${MODE} init.d/halt              ${EXTDIR}/init.d/
+       install -m ${MODE} init.d/localnet          ${EXTDIR}/init.d/
+       install -m ${MODE} init.d/mountfs           ${EXTDIR}/init.d/
+       install -m ${MODE} init.d/mountkernfs       ${EXTDIR}/init.d/
+       install -m ${MODE} init.d/rc                ${EXTDIR}/init.d/
+       install -m ${MODE} init.d/reboot            ${EXTDIR}/init.d/
+       install -m ${MODE} init.d/sendsignals       ${EXTDIR}/init.d/
+       install -m ${MODE} init.d/setclock          ${EXTDIR}/init.d/
+       install -m ${MODE} init.d/swap              ${EXTDIR}/init.d/
+       install -m ${MODE} init.d/udev              ${EXTDIR}/init.d/
+       install -m ${CONFMODE} lsb/init-functions   ${DESTDIR}/lib/lsb/
+       ln -sf ../init.d/sendsignals ${EXTDIR}/rc0.d/S60sendsignals
+       ln -sf ../init.d/mountfs     ${EXTDIR}/rc0.d/S70mountfs
+       ln -sf ../init.d/swap        ${EXTDIR}/rc0.d/S80swap
+       ln -sf ../init.d/halt        ${EXTDIR}/rc0.d/S99halt
+       ln -sf ../init.d/sendsignals ${EXTDIR}/rc6.d/S60sendsignals
+       ln -sf ../init.d/mountfs     ${EXTDIR}/rc6.d/S70mountfs
+       ln -sf ../init.d/swap        ${EXTDIR}/rc6.d/S80swap
+       ln -sf ../init.d/reboot      ${EXTDIR}/rc6.d/S99reboot
+       ln -sf ../init.d/mountkernfs ${EXTDIR}/rcsysinit.d/S00mountkernfs
+       ln -sf ../init.d/udev        ${EXTDIR}/rcsysinit.d/S10udev
+       ln -sf ../init.d/swap        ${EXTDIR}/rcsysinit.d/S20swap
+       ln -sf ../init.d/setclock    ${EXTDIR}/rcsysinit.d/S25setclock
+       ln -sf ../init.d/checkfs     ${EXTDIR}/rcsysinit.d/S30checkfs
+       ln -sf ../init.d/mountfs     ${EXTDIR}/rcsysinit.d/S40mountfs
+       ln -sf ../init.d/cleanfs     ${EXTDIR}/rcsysinit.d/S50cleanfs
+       if [ ! -f ${EXTDIR}/sysconfig/rc          ]; then install -m 
${CONFMODE} sysconfig/rc          ${EXTDIR}/sysconfig/; fi
+
+.PHONY: all create-dirs create-service-dir \
+       install minimal 
+

Modified: trunk/bootscripts/contrib/lsb-v3/README
===================================================================
--- trunk/bootscripts/contrib/lsb-v3/README     2007-02-18 00:40:32 UTC (rev 
7924)
+++ trunk/bootscripts/contrib/lsb-v3/README     2007-02-18 02:16:25 UTC (rev 
7925)
@@ -1,4 +1,101 @@
-LSB-V3
+LSB-V3 README
 
-Scripts based on content of lfs-bootscripts-20070203.
+The scripts contianed in this directory are a complete rewrite of the
+boot scripts from LFS-6.1 (updated for LFS-SVN about 2007-02-16).  As is
+usually the case with a rewrite, there have been many changes:
 
+LSB Version 3.1 Compliant Scripts - Immediately noticable are the LSB headers
+in the rc.d scripts themselves.  Each script contains a usable header to
+allow for automating both the installation of, and determining proper
+execution order for the startup scripts.  These values can also be used
+directly in parallel boot setups.  Additionally, messages are displayed in
+one single write to the screen, after exit status is determined, so that
+they can be used in parallel setups.  I am not sure if this was the only
+barrier to auto language translation in the previous bootscripts.  Further,
+the messages are created from parts and only written to the screen in a
+single command, so maybe no help at all WRT translated boot messages.
+
+LSB 3.1 Omissions - Unfortunately, this package is not completely LSB
+compliant as it lacks install-initd and remove-initd programs.  The current
+popular flavor of these programs is written in Python, which, as you should
+know, is not installed until BLFS.  I gave up on a bash version of these
+scripts when I lost scope about three bash arrays deep (hint: you only want
+to read from and write to disk one time at program start and end repectively).
+But do feel free to write a perl or bash implementation if you have the
+ability and patience to do so.  You might see a contrib directory appear in
+BLFS-Bootscripts someday in the future if there is any demand for the already
+writen Python version of these programs.
+
+Distribution Independent - this original goal for the LFS scripts has been
+stretched even further by providing both a global rc config file that
+contains (generally) static values, and a new rc.site config file to allow
+customization of messages as diplayed to the end user during the boot
+process.  The format of messages printed to the screen is adjustable
+here.  As well, the other options that were available in the previous
+versions of the lfs-bootscripts, and additional options as discussed below,
+are configurable by the /etc/sysconfig/rc.site file.
+
+Single Environment - The rc script has been rewritten completely to allow a
+single source of the boot configuration per runlevel change.  This config
+is inherited from rc's environment as opposed to being sourced everytime a
+script is run.  This results in a negledgable decrease in boot time, but
+it is just better in principle, assuming I didn't break anything.  For those
+familiar with the previous versions, the 'stty sane' bit comes to mind, but
+I haven't witnessed any dispaly amomolies, nor do I remember how to reproduce
+the situation that caused us to move that into the functions file before.
+
+Boot Logging - The previous incarnation of the boot log didn't begin
+recording events until the root filesystem was mounted read/write.  This has
+been corrected by providing a tempfs mount immediately after init hands
+control to the rc script.  The bootlog is generated on the tempfs and then
+passed to the log file before login.  Additionally, shutdown events are no
+longer recorded in the bootlog.  They were pretty much useless and it really
+wasn't what I'd call a *boot* log.  Boot logging is on by default and is
+configurable in the /etc/sysconfig/rc.site file.
+
+Interactive Boot - This feature has been included by default, and is a
+little more polished than my previous attempt.  It does introduce a two
+second delay in the boot process (so that you have time to press a button
+to select interactive mode).  This time value, and the option prompt itself,
+is configurable in the /etc/sysconfig/rc.site file.
+
+RC_BASE - The base directory for the bootscripts is now /etc, not
+/etc/rc.d.  This is mostly to conform with mainstream distros, but other
+boot methods do expect that /etc/init.d is the location of bootscripts.
+Some distros provide a rc.d direcorty with symlinks to the rc*.d and init.d
+directories, I have not done that.  /etc is the location now, get your
+flying fingers accustomed to it!  Of course, this is still configurable in
+/etc/sysconfig/rc.site, and if the change is too great, I'll put it back.
+
+LSB Functions - The previous lfs-bootscripts sourced a functions file
+located at /etc/rc.d/init.d/functions.  This file has been renamed
+lfs-functions to segregate it from the old.  Both old and new bootscripts
+can be used simultaneously in a SYS-V setup (with proper symlinks in place).
+LSB defined functions are used where possible, but the lfs-functions file
+provides, easy to use wraper functions that
+start/stop/reload/force-reload/restart programs, evaluate the numerical
+LSB return values, and print status messages to the screen.  Both LFS
+functions and LSB functions are documented directly in the scritps located
+at /etc/init.d/lfs-functions and /lib/lsb/init-functions respectively.
+
+Pretier - Yeah, I just couldn't handle all the grey text...  By default,
+successful boot messages are prefixed with a single green astrik character,
+warning messages with two yellow astirks, and failures are prefixed with
+three red astriks.  This just provides a second 'quick glance' status when
+watching the boot messages fly by.  Again, the prefixes are configurable (or
+completely removable) in the /etc/sysconfig/rc.site file.
+
+Complete Rewrite - Yep.  That doesn't mean that code wasn't reused when
+possible, so Nathan, Alexander, Jim, Matthew, Bryan, Gerard, Mathias, and
+countless other contributors (whose names I've forgotten and will promptly
+be reminded of (please)) are owed credit for these as well.  That said,
+at very least, this is a complete reorganisation that I've tested to the
+best of my ability, but there probably are some hidden bugs that will come
+to lite when used more frequently.  Please give me a shout *when* you find
+them.
+
+Thanks.
+
+-- DJ Lucas
+dj AT linuxfromscratch DOT org
+

Modified: trunk/bootscripts/contrib/lsb-v3/init.d/lfs-functions
===================================================================
--- trunk/bootscripts/contrib/lsb-v3/init.d/lfs-functions       2007-02-18 
00:40:32 UTC (rev 7924)
+++ trunk/bootscripts/contrib/lsb-v3/init.d/lfs-functions       2007-02-18 
02:16:25 UTC (rev 7925)
@@ -6,7 +6,7 @@
 # to execute, and if set, a config file that may be needed for the program    #
 # to run successfully.  The calling script will exit with a return value of 5 #
 # if the binary does not exist, and a value of 6 if the needed config file is #
-# unavailible as per LSB requirements.  This function accepts zero, one, or   #
+# unavailable as per LSB requirements.  This function accepts zero, one, or   #
 # two string arguments.  If arguments are passed, the first must be a bin     #
 # file.  If a second argument is passed, it is interpreted as the config      #
 # file.  Optionally, zero arguments can be passed if BIN_FILE, and optinally  #
@@ -39,6 +39,24 @@
     fi
 }
 
+################################ loadproc() ###################################
+# loadproc is just a wraper to start_daemon for simple scripts, which will    #
+# require no arguments if $BIN_FILE is set.                                   #
+###############################################################################
+loadproc()
+{
+    start_daemon "${BIN_FILE}" "[EMAIL PROTECTED]"
+}
+
+################################ endproc() ####################################
+# endproc, like loadproc, is just a wraper to killproc for simplicity and is  #
+# dependent on $BIN_FILE being set.                                           #
+###############################################################################
+endproc()
+{
+    killproc "${BIN_FILE}" "[EMAIL PROTECTED]"
+}
+
 ############################### statusproc() ##################################
 # statusproc checks the status of a particular binary and displays the        #
 # appropriate message (running or not running) and exits on the return value  #
@@ -126,7 +144,7 @@
             return "${error_value}"
           ;;
           5)
-            log_failure_msg "Starting ${MESSAGE} Error: Not availible!"
+            log_failure_msg "Starting ${MESSAGE} Error: Not available!"
             return "${error_value}"
           ;;
           *)
@@ -147,7 +165,7 @@
             return "${error_value}"
             ;;
           5)
-            log_failure_msg "Stopping ${MESSAGE} Error: Not availible!"
+            log_failure_msg "Stopping ${MESSAGE} Error: Not available!"
             return "${error_value}"
             ;;
           7)

Modified: trunk/bootscripts/contrib/lsb-v3/init.d/template
===================================================================
--- trunk/bootscripts/contrib/lsb-v3/init.d/template    2007-02-18 00:40:32 UTC 
(rev 7924)
+++ trunk/bootscripts/contrib/lsb-v3/init.d/template    2007-02-18 02:16:25 UTC 
(rev 7925)
@@ -14,29 +14,39 @@
 #                      startup scripts.
 # X-LFS-Default-Start: S50
 # X-LFS-Default-Stop:  K25 (this can be an S value if run after K scripts)
-# X-LFS-Provided-By:   BOOK or Project (just an informative text field)
+# X-LFS-Provided-By:   LFS (BOOK or Project - just an informative text field)
 ### END INIT INFO
 
+# Source the LSB init-functions, ours are pulled in from there.
 . /lib/lsb/init-functions
 
 # These are optional, but required for chk_stat.  They will be used in 
 # the rest of the functions if defined, else you must provide a program
-# name to control, and a message ('Starting Proper Program name...' 
-# or 'Stopping Name...') to evauate_retval.  See the documntaion.
-MESSAGE="Some Proper Service"
-BIN_FILE="/some/path/to/binary"
-CONFIGFILE="/some/config/file (or nothing)"
+# name to control, and a message ('Starting Template Service...' 
+# or 'Stoping Template Service...') to evauate_retval.  See the 
+# documentaion in the lfs-fucntions file for more information.
+MESSAGE="Template Service"
+BIN_FILE="/some/path/to/template"
+CONFIGFILE="/etc/sysconfig/template.conf"
 
+# check that $BIN_FILE exists and is executable, and $CONFIGFILE exists.
 chk_stat
 
+# LSB Defined functions require that at least $BIN_FILE be passed to them,
+# where as lfs-functions will use the $BIN_FILE environment variable.
+# loadproc() and endproc() are just wrappers that pass everything on to 
+# the LSB defined functions.
+
 case "${1}" in
     start)
-        start_daemon
+        #start_daemon "${BIN_FILE}" -arg1 -arg2 #... or:
+        loadproc -arg1 -arg2 -arg3 #...
         evaluate_retval start
         ;;
 
     stop)
-        killproc
+        #killproc -TERM "${BIN_FILE}" or:
+        endproc
         evaluate_retval stop
         ;;
 
@@ -54,13 +64,28 @@
         statusproc
         ;;
 
-#    reload)
-#        reloadproc
-#        ;;
-#    try-restart)
-#        ;;
+# reload and try-restart are optional per LSB requirements
+    reload)
+        reloadproc
+        evaluate_retval reload
+        ;;
+
+    try-restart)
+       # Since this is optional there is no lfs-function for this one...
+        # might be at a later time if used enough, but I doubt it usefullness.
+        pidofproc "${BIN_FILE}" > /dev/null
+        if [ "${?}" -ne "0" ]; then
+            MESSAGE="${MESSAGE}: Not Running"
+        else
+            $0 stop
+            $0 start
+            exit 0
+        fi
+        evaluate_retval try-restart
+        ;;
+
     *)
-        echo "Usage: ${0} {start|stop|force-reload|restart|status}"
+        echo "Usage: ${0} {start|stop|{force-}reload|{try-}restart|status}"
         exit 1
         ;;
 esac

-- 
http://linuxfromscratch.org/mailman/listinfo/lfs-book
FAQ: http://www.linuxfromscratch.org/lfs/faq.html
Unsubscribe: See the above information page

Reply via email to