[SM-Commit] GIT changes to master z-rejected grimoire by Jeremy Blosser (18091c3fbe45a8b5f58526fd69cccc0afa6d553b)

Jeremy Blosser scm at mail.sourcemage.org
Sun Apr 1 13:54:54 EDT 2007


GIT changes to master z-rejected grimoire by Jeremy Blosser <jblosser-smgl at firinn.org>:

 z-utils/daemontools/0.76-errno.patch         |   11 --
 z-utils/daemontools/BUILD                    |   13 --
 z-utils/daemontools/CONFIGURE                |   19 +++
 z-utils/daemontools/DEPENDS                  |    4 
 z-utils/daemontools/DETAILS                  |    6 +
 z-utils/daemontools/FINAL                    |   39 +++----
 z-utils/daemontools/HISTORY                  |   24 ++++
 z-utils/daemontools/INSTALL                  |   26 +++--
 z-utils/daemontools/POST_REMOVE              |    4 
 z-utils/daemontools/POST_RESURRECT           |    1 
 z-utils/daemontools/PRE_BUILD                |    9 +
 z-utils/daemontools/TRIGGERS                 |    1 
 z-utils/daemontools/daemontools-docs.tar.bz2 |binary
 z-utils/daemontools/init.d/svscan            |  134 +++++++++++----------------
 14 files changed, 148 insertions(+), 143 deletions(-)

New commits:
commit 18091c3fbe45a8b5f58526fd69cccc0afa6d553b
Author: Jeremy Blosser <jblosser-smgl at firinn.org>
Commit: Jeremy Blosser <jblosser-smgl at firinn.org>

    daemontools: Major spell update with a bunch of changes I've been using
    locally for at least a year.

diff --git a/z-utils/daemontools/0.76-errno.patch b/z-utils/daemontools/0.76-errno.patch
deleted file mode 100644
index 3af157c..0000000
--- a/z-utils/daemontools/0.76-errno.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- src/error.h	2001-07-12 11:49:49.000000000 -0500
-+++ src/error.h	2003-02-26 02:14:06.000000000 -0600
-@@ -3,7 +3,7 @@
- #ifndef ERROR_H
- #define ERROR_H
- 
--extern int errno;
-+#include <errno.h>
- 
- extern int error_intr;
- extern int error_nomem;
diff --git a/z-utils/daemontools/BUILD b/z-utils/daemontools/BUILD
index 0845c83..5ce2285 100755
--- a/z-utils/daemontools/BUILD
+++ b/z-utils/daemontools/BUILD
@@ -1,13 +1,6 @@
 cd "${SPELL}-${VERSION}"  &&
 
-pwd                     >  src/home     &&
-echo  "gcc ${CFLAGS}"   >  src/conf-cc  &&
-echo  "gcc ${LDFLAGS}"  >  src/conf-ld  &&
+echo  "gcc ${CFLAGS} -include /usr/include/errno.h"  >src/conf-cc  &&
+echo  "gcc ${LDFLAGS}"                               >src/conf-ld  &&
 
-patch  -p0  <  "${SCRIPT_DIRECTORY}/0.76-errno.patch"  &&
-
-cd  src  &&
-
-sed  -i  -e  's@/command/svc@/usr/bin/svc@'  svscanboot.sh  &&
-
-make
+package/compile
diff --git a/z-utils/daemontools/CONFIGURE b/z-utils/daemontools/CONFIGURE
index 9f46958..d642b3f 100755
--- a/z-utils/daemontools/CONFIGURE
+++ b/z-utils/daemontools/CONFIGURE
@@ -1,3 +1,16 @@
-config_query  CHANGE_INITTAB  "Install svscanboot in inittab?"  y
-config_query  USE_SUPERVISE   \
-  "Use supervise wrappers scripts instead of plain svscanboot"  n
+config_query  DAEMONTOOLS_CHANGE_INITTAB    \
+              "Start svscan from inittab?"  \
+              ${CHANGE_INITTAB:-y}          &&
+
+persistent_remove  CHANGE_INITTAB  &&
+
+config_query_list   DAEMONTOOLS_INSTALL_PATHS  \
+                    "Use DJB (/command, /service) or FHS (/sbin, /etc/service) install paths?"\
+                    "djb"                      \
+                    "fhs"                      &&
+
+if  [  "${DAEMONTOOLS_INSTALL_PATHS}"  ==  "djb"  ];  then
+  config_query  DAEMONTOOLS_SYMLINKS                           \
+                "Create /command symlinks in /usr/local/bin?"  \
+                y
+fi
diff --git a/z-utils/daemontools/DEPENDS b/z-utils/daemontools/DEPENDS
deleted file mode 100755
index ba1a107..0000000
--- a/z-utils/daemontools/DEPENDS
+++ /dev/null
@@ -1,4 +0,0 @@
-if [ "$USE_SUPERVISE" == "y" ];
-then
-    depends supervise-scripts
-fi
diff --git a/z-utils/daemontools/DETAILS b/z-utils/daemontools/DETAILS
index 7d94c9e..3798a5f 100755
--- a/z-utils/daemontools/DETAILS
+++ b/z-utils/daemontools/DETAILS
@@ -8,6 +8,8 @@ SOURCE_DIRECTORY=${BUILD_DIRECTORY}/admi
          ENTERED=20040202
          UPDATED=20041030
       LICENSE[0]="http://cr.yp.to/distributors.html"
+      LICENSE[1]="http://cr.yp.to/softwarelaw.html"
+            DOCS="${DOCS} *.html"
            SHORT="A collection of tools for managing UNIX services"
 cat << EOF
 daemontools is a collection of tools for managing UNIX services.
@@ -21,4 +23,8 @@ timestamps each line and, for each log,
 matching specified patterns. It automatically rotates logs to limit the
 amount of disk space used. If the disk fills up, it pauses and tries
 again, without losing any data.
+
+This spell by default builds an "official" package, using DJB's required
+installation paths and behaviors.  Options are provided to install to
+FHS-compliant paths as well.
 EOF
diff --git a/z-utils/daemontools/FINAL b/z-utils/daemontools/FINAL
index cd8e16f..d93ae70 100755
--- a/z-utils/daemontools/FINAL
+++ b/z-utils/daemontools/FINAL
@@ -1,28 +1,19 @@
-if [ $"CHANGE_INITTAB" == "n" ];
-then
-    return 0
-fi
-
-local MySVBOOT=svscanboot # default
-
-if [ "$USE_SUPERVISE" == "y" ];
-then
-    MySVBOOT=svscan-start
-fi
-
-echo  "Installing svscanboot to /etc/inittab..."                     &&
+# The inittab needs to be modified here so that it doesn't get removed on
+# dispel.
 
-if  !  grep  -q  svscan /etc/inittab;  
+if  [  "${DAEMONTOOLS_CHANGE_INITTAB}"  ==  "y"  ]  &&  \
+    !  grep  -q  svscanboot  /etc/inittab
 then
-    cp  -f  /etc/inittab  /etc/inittab.`date -I`                     &&
-    sed  -i  -e  "1,/^tty/{; /^tty/i \
-svscanboot:dumb:/usr/bin/$MySVBOOT
-  }"  /etc/inittab  ||  return  1
-    echo -n "$MySVBOOT has been added to /etc/inittab. "
-    echo    "'kill -1 1' to reload init."
+  if  [  "${DAEMONTOOLS_INSTALL_PATHS}"  ==  "fhs"  ];  then
+    sedit  '1,/^tty/{; /^tty/i    \
+supervise:dumb:/sbin/svscanboot
+  }'  /etc/inittab
+  else
+    sedit  '1,/^tty/{; /^tty/i    \
+supervise:dumb:/command/svscanboot
+  }'  /etc/inittab
+  fi  &&
+  message "svscanboot has been added to /etc/inittab.  'kill -1 1' to reload init."
 else
-    cp  -f  /etc/inittab  /etc/inittab.`date -I`                     &&
-    sed  -i "s/^.*svscan.*$/svscanboot:dumb:\/usr\/bin\/$MySVBOOT/"   \
-	/etc/inittab  ||  return  1
-    echo  "$MySVBOOT is already in /etc/inittab, updated"
+  message "svscanboot is already in /etc/inittab."
 fi
diff --git a/z-utils/daemontools/HISTORY b/z-utils/daemontools/HISTORY
index e2fa9da..f370b52 100644
--- a/z-utils/daemontools/HISTORY
+++ b/z-utils/daemontools/HISTORY
@@ -1,3 +1,18 @@
+2007-04-01 Jeremy Blosser <jblosser-smgl at firinn.org>
+	* 0.76-errno.patch: Deleted in favor of -include /usr/include/errno.h
+	* BUILD: Add -include /usr/include/errno.h, remove patching, switch
+	  from make to package/compile
+	* CONFIGURE: Apply spell namespace to variables, query about install
+	  paths, drop supervise-scripts dependencies/queries.
+	* DEPENDS, TRIGGERS: Deleted; drop unnecessary supervise-scripts.
+	* DETAILS: Add more license info, add to DOCS.
+	* FINAL: Improve inittab handling.
+	* INSTALL: Account for different install paths.
+	* init.d/svscan: General improvements, remove supervise-scripts,
+	  account for different install paths.
+	* POST_REMOVE, POST_RESURRECT: Added.
+	* PRE_BUILD, daemontools-docs.tar.bz2: Added for more docs.
+
 2006-09-21 Juuso Alasuutari <iuso at sourcemage.org>
 	* DETAILS: [automated] Removed BUILD_API=2.
 
@@ -14,9 +29,10 @@
 	* FINAL: svscan-start does not exists. Use svscanboot.
 	* init.d/svscan: Likewise.
 
-2005-02-18 Eric Sandall <sandalle at sourcemage.org>
+2005-02-18 Eric Sandall <eric at sandall.us>
 	* Applied Jeremy's patch  (Bug #8027)
-	* Moved from net/daemontools to z-rejected/z-utils/daemontools  (Bug #8027)
+	* Moved from net/daemontools to z-rejected/z-utils/daemontools  (Bug
+	  #8027)
 	* DEPENDS: Removed circular dependency on supervise-scripts (for now)
 	* BUILD,INSTALL: Cleaned up spacing
 	  Added "&&"s
@@ -26,8 +42,8 @@
 	* HISTORY: Formatted to Guru Handbook
 
 2005-01-18 Jeremy Blosser <jblosser at firinn.org>
-	* Modified spell to be more consistant with other spells in the djb/qmail
-	  suite
+	* Modified spell to be more consistant with other spells in the
+	  djb/qmail suite
 	* FINAL: run svscan from /etc/inittab
 	* BUILD/INSTALL: use internal configure instead of sedit to set install
 	  locations
diff --git a/z-utils/daemontools/INSTALL b/z-utils/daemontools/INSTALL
index 655eea5..c590ac1 100755
--- a/z-utils/daemontools/INSTALL
+++ b/z-utils/daemontools/INSTALL
@@ -1,12 +1,18 @@
-/usr/bin/install  -d  "${INSTALL_ROOT}/service"   &&
+cd  command  &&
 
-cd  ${SOURCE_DIRECTORY}/${SPELL}-${VERSION}/src  &&
+if  [  "${DAEMONTOOLS_INSTALL_PATHS}"  ==  "fhs"  ];  then
+  /usr/bin/install  -d      "/etc/service"                                    &&
+  /usr/bin/install  -m 755  `cat ../package/commands` "${INSTALL_ROOT}/sbin"
+else
+  /usr/bin/install  -d      "/service"                 &&
+  /usr/bin/install  -d      "${INSTALL_ROOT}/command"  &&
+  /usr/bin/install  -m 755  `cat ../package/commands`  \
+                            "${INSTALL_ROOT}/command"  &&
+  if  [  "${DAEMONTOOLS_SYMLINKS}"  ==  "y"  ];  then
+    while read i;  do
+      ln  -sf  /command/$i  /usr/local/bin/$i
+    done  <../package/commands
+  fi
+fi  &&
 
-/usr/bin/install  -d  ${INSTALL_ROOT}/usr/bin         &&
-/usr/bin/install  -m  755  `cat ../package/commands`  \
-                      ${INSTALL_ROOT}/usr/bin         &&
-
-cd  ${SOURCE_DIRECTORY}/${SPELL}-${VERSION}  &&
-
-mv  package/README      ${SOURCE_DIRECTORY}  &&
-mv  src/{CHANGES,TODO}  ${SOURCE_DIRECTORY}
+cd  ..
diff --git a/z-utils/daemontools/POST_REMOVE b/z-utils/daemontools/POST_REMOVE
new file mode 100755
index 0000000..a395b00
--- /dev/null
+++ b/z-utils/daemontools/POST_REMOVE
@@ -0,0 +1,4 @@
+if  grep  -q  svscan  /etc/inittab;  then
+  sedit  "/svscan/d"  /etc/inittab  &&
+  message "svscanboot has been removed from /etc/inittab.  'kill -1 1' to reload init."
+fi
diff --git a/z-utils/daemontools/POST_RESURRECT b/z-utils/daemontools/POST_RESURRECT
new file mode 100755
index 0000000..e3c42e9
--- /dev/null
+++ b/z-utils/daemontools/POST_RESURRECT
@@ -0,0 +1 @@
+.  "${SCRIPT_DIRECTORY}/FINAL"
diff --git a/z-utils/daemontools/PRE_BUILD b/z-utils/daemontools/PRE_BUILD
new file mode 100755
index 0000000..77ab2de
--- /dev/null
+++ b/z-utils/daemontools/PRE_BUILD
@@ -0,0 +1,9 @@
+default_pre_build                             &&
+cd "${SOURCE_DIRECTORY}/${SPELL}-${VERSION}"  &&
+
+if  [  "${DAEMONTOOLS_INSTALL_PATHS}"  ==  "fhs"  ];  then
+  sedit  's@/service@/etc/service@; s@/command@/sbin@'  src/svscanboot.sh
+fi  &&
+
+tar  -xjvf  "${SCRIPT_DIRECTORY}/daemontools-docs.tar.bz2"                &&
+mv  package/README src/CHANGES daemontools/*.html  "${SOURCE_DIRECTORY}"
diff --git a/z-utils/daemontools/TRIGGERS b/z-utils/daemontools/TRIGGERS
deleted file mode 100755
index b413df2..0000000
--- a/z-utils/daemontools/TRIGGERS
+++ /dev/null
@@ -1 +0,0 @@
-on_cast    supervise-scripts    cast_self
diff --git a/z-utils/daemontools/daemontools-docs.tar.bz2 b/z-utils/daemontools/daemontools-docs.tar.bz2
new file mode 100644
index 0000000..f96ece9
Binary files /dev/null and b/z-utils/daemontools/daemontools-docs.tar.bz2 differ
diff --git a/z-utils/daemontools/init.d/svscan b/z-utils/daemontools/init.d/svscan
index 7c17b48..f01f3d0 100644
--- a/z-utils/daemontools/init.d/svscan
+++ b/z-utils/daemontools/init.d/svscan
@@ -1,106 +1,88 @@
 #!/bin/bash
 
-# Note: svscan maybe started and respawned directly from inittab.
-# This init.d script primarily exists to provide the stop function during
-# shutdown.
-
-PROGRAM="/usr/bin/svscanboot" # default option
+# Note: svscan may be started and respawned directly from inittab.
+
+if [ -x "/command/svscan" ]; then
+  PROGRAM="/command/svscan"
+elif [ -x "/sbin/svscan" ]; then
+  PROGRAM="/sbin/svscan"
+else
+  error "svscan not found"
+fi
 
-if [ -f /etc/sorcery/local/depends/daemontools.p ] ; 
-then
-    . /etc/sorcery/local/depends/daemontools.p
-    if [ "$USE_SUPERVISE" == "y" ];
-    then
-	PROGRAM="/usr/bin/svscan-start"
-    fi
+if [ -d "/service" ]; then
+  ARGS="/service"
+elif [ -d "/etc/service" ]; then
+  ARGS="/etc/service"
+else
+  error "service directory not found"
 fi
 
 RUNLEVEL=3
-NEEDS="+network" # not strictly true, but most services should go down before they lose networking
-
-DJBDT_SVCDIR="/service"
+NEEDS="+network"
 
 . /etc/init.d/smgl_init
 
-
-restart()
-{
-    run_func stop  &&
-    run_func start
-}
-
+SUPERVISE_IN_INITTAB="`grep '^supervise:' /etc/inittab`"
 
 start()
 {
-  if grep -q -e "^svscanboot:.*" /etc/inittab ; 
-  then
-      echo "Not start $PROGRAM, init will restart it."
+  if [ -n "${SUPERVISE_IN_INITTAB}" ]; then
+    echo "svscan is being run from /etc/inittab."
   else
-      echo "Starting svscanboot..."
-      if ! pgrep -f "$PROGRAM" >/dev/null; then
-          ${PROGRAM} &
-	  evaluate_retval
-      fi
+    _start 
   fi
 }
 
-
-reload()
+stop_services()
 {
-  run_func restart
+  echo -n "Stopping supervised services... "
+  if [ `/bin/ls "${ARGS}" | wc -l` -gt 0 ]; then
+    echo
+    for SVC in "${ARGS}/"*; do
+      echo "Stopping $SVC..."
+      svc -dx "$SVC"
+      evaluate_retval
+      if [ -d "$SVC/log" ]; then
+        echo "Stopping $SVC/log..."
+        svc -dx "$SVC/log"
+        evaluate_retval
+      fi
+    done
+  else
+    echo "no services found."
+  fi
 }
 
-
 stop()
 {
-    echo -n "Stopping svscan services... "
-    if [ `ls $DJBDT_SVCDIR | wc -l` -gt 0 ]; 
-    then
-        echo
-        for SVC in ${DJBDT_SVCDIR}/*; 
-        do
-	    echo "Stopping $SVC..."
-	    svc -dx "$SVC"
-	    evaluate_retval
-            if [[ -d "$SVC/log" ]]; 
-            then
-                echo "Stopping $SVC/log..."
-                svc -dx "$SVC/log"
-                evaluate_retval
-            fi
-        done
-    else
-	echo "no services found."
-    fi
+  stop_services
 
-    if grep -q -e "^svscanboot:.*" /etc/inittab ; 
-    then
-	echo "Not stop $PROGRAM, init will restart it."
-    else
-	echo "Killing ${PROGRAM}..." 
-	pkill -f "${PROGRAM}"
-	evaluate_retval
-    fi
+  if [ -n "${SUPERVISE_IN_INITTAB}" ]; then
+    echo "svscan is being run from /etc/inittab and cannot be stopped."
+  else
+    _stop
+  fi
 }
 
-
-status()
+restart()
 {
-  SVPID=`pgrep -f "${PROGRAM}"`
-  if [ -n "${SVPID}" ]; then
-      echo -n "svscan (pid ${SVPID}) is running, "
-      if grep -q -e "^svscanboot:.*" /etc/inittab ; 
-      then
-	  echo "started by inittab."
-      else
-	  echo "started standalone."
-      fi
+  if [ -n "${SUPERVISE_IN_INITTAB}" ]; then
+    stop_services
+    _stop
+    echo "svscan will be restarted by init."
   else
-      echo "svscan is not running"
+    _restart
   fi
-  if [ `ls $DJBDT_SVCDIR | wc -l` -gt 0 ]; then
-      svstat $DJBDT_SVCDIR
+}
+
+status()
+{
+  _status
+  if [ -n "${SUPERVISE_IN_INITTAB}" ]; then
+    echo "run from /etc/inittab."
   else
-      echo "services not found"
+    echo "run standalone."
   fi
+  svstat "${ARGS}/"*
 }



More information about the SM-Commit mailing list