From 79a8958bc2502912e2fbba8ca15ed1eb2377d614 Mon Sep 17 00:00:00 2001 From: Daniel Joseph Barnhart Clark Date: Tue, 20 Feb 2007 03:08:47 +0000 Subject: EncapPackages: Move from daemontools to runit to avoid any issues with redistributing patched daemontool binaries. git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@2856 ce84e21b-d406-0410-9b95-82705330c041 --- encap/README | 26 +- .../bcfg2-site/bcfg2-site-RENAME/encapinfo.tmpl | 2 +- .../bcfg2-site-RENAME/etc/ostiary.cfg.tmpl | 10 +- .../bcfg2-site/bcfg2-site-RENAME/postinstall.tmpl | 28 +- .../bcfg2-site/bcfg2-site-RENAME/sbin/ost-bcfg2.sh | 20 +- encap/src/encap-profiles/Makefile | 9 +- encap/src/encap-profiles/bcfg2-0.9.2.ep | 57 +-- encap/src/encap-profiles/daemontools-0.76.ep | 533 --------------------- .../src/encap-profiles/daemontools-doc-20060731.ep | 62 --- encap/src/encap-profiles/ostiary-3.4.ep | 25 +- encap/src/encap-profiles/runit-1.7.2.ep | 159 ++++++ encap/src/makeself-dist/makedist.sh | 16 +- 12 files changed, 255 insertions(+), 692 deletions(-) delete mode 100644 encap/src/encap-profiles/daemontools-0.76.ep delete mode 100644 encap/src/encap-profiles/daemontools-doc-20060731.ep create mode 100644 encap/src/encap-profiles/runit-1.7.2.ep (limited to 'encap') diff --git a/encap/README b/encap/README index 5338a07b6..76428a3c8 100644 --- a/encap/README +++ b/encap/README @@ -14,7 +14,7 @@ that does a complete client install, which includes: * all software on which bcfg2 depends * bcfg2 itself * ostiary to kick off bcfg2 client runs remotely - * daemontools to run bcfg2 client as a periodic service with logging + * runit to run bcfg2 client as a periodic service with logging * all with site-specific configuration parameters, set at build time in a single unified build-time configuration file, site-settings.conf * optional install-time entry of bcfg2 and ostiary passwords, interactively @@ -88,27 +88,25 @@ Directory with sentinel file(s) Covered config files /usr/local/sbin ost-bcfg2.sh }}} -== About daemontools integration == +== About runit integration == In order to avoid a lot of platform/distribution-specific code, the encap -bcfg2 distribution includes and uses [http://cr.yp.to/daemontools.html -daemontools] (with some common patches) instead of init scripts and cron. +bcfg2 distribution includes and uses [http://smarden.org/runit/useinit.html +runit] instead of init scripts and cron. -The bcfg2 client (.run) distribution uses daemontools to run ostiary, and to -run the bcfg2 client periodically. +The bcfg2 client (.run) distribution uses runit to run ostiary, and to run +the bcfg2 client periodically. On the server, edit `/usr/local/etc/default/bcfg2-server/env/OPTIONS` to include the options you want to start up the bcfg2 server with, and then do {{{ -ln -s /usr/local/var/svc.d/bcfg2-server /service/ +ln -s /usr/local/etc/sv/bcfg2-server /usr/local/var/service/ }}} to enable the service. -You can use `/command/svstat /service/bcfg2-server` to see the status, and -`/command/svrm /service/bcfg2-server` to remove it. +You can use `sv status /usr/local/var/service/bcfg2-server` to see the +status, and `rm /usr/local/var/service/bcfg2-server` to remove it. -Logs for all daemontools services are under `/usr/local/var/multilog`. -They use a highly precise time format; to translate into a readable format, -pipe the logs through `/command/tai64nlocal`. +Logs for all runit services are under `/usr/local/var/svlogd`. == About ostiary integration == In order to enable the remote kickoff of bcfg2 client runs, the bcfg2 client @@ -125,7 +123,7 @@ compile-time or (preferably) .run file install time. * `-bcfg2-dv` : Run `bcfg2-client -d -v` * `-bcfg2-vq` : Run `bcfg2-client -v -q` * `-bcfg2-v` : Run `bcfg2-client -v` - * `-bcfg2-restart` : Restart the bcfg2-client daemontools service + * `-bcfg2-restart` : Restart the bcfg2-client runit service There are plans for the future for a bcfg2 plugin that will set per-machine passwords after the initial install, however as with cfengine the worst that @@ -142,7 +140,7 @@ point you will enter one of the above-listed values, such as integrated into the same string). Logs of bcfg2-client runs kicked off via ostiary are in -`/usr/local/var/multilog/bcfg2-client-ostiary` +`/usr/local/var/svlogd/bcfg2-client-ostiary` == Supported Platforms == Below is a table of platforms that have been successfully bootstrapped using diff --git a/encap/src/bcfg2-site/bcfg2-site-RENAME/encapinfo.tmpl b/encap/src/bcfg2-site/bcfg2-site-RENAME/encapinfo.tmpl index f54cb1e18..998a34b4a 100644 --- a/encap/src/bcfg2-site/bcfg2-site-RENAME/encapinfo.tmpl +++ b/encap/src/bcfg2-site/bcfg2-site-RENAME/encapinfo.tmpl @@ -5,7 +5,7 @@ date ${DATE} contact "${ADMIN_NAME}" <${ADMIN_EMAIL}> description bcfg2-site-${SITE_SHORTNAME} - bcfg2 configuration for ${SITE_NAME} prereq pkgspec >= bcfg2-0.8.2 -prereq pkgspec >= daemontools-0.76 prereq pkgspec >= ostiary-3.4 +prereq pkgspec >= runit-1.7.2 exclude etc exclude sbin diff --git a/encap/src/bcfg2-site/bcfg2-site-RENAME/etc/ostiary.cfg.tmpl b/encap/src/bcfg2-site/bcfg2-site-RENAME/etc/ostiary.cfg.tmpl index ebc39b61d..2c98e910f 100644 --- a/encap/src/bcfg2-site/bcfg2-site-RENAME/etc/ostiary.cfg.tmpl +++ b/encap/src/bcfg2-site/bcfg2-site-RENAME/etc/ostiary.cfg.tmpl @@ -1,20 +1,20 @@ #include "site-settings.conf" # If present, ostiaryd will shut down once the cache of bad IPs is full. -# Under daemontools, this just has the effect of generating a service -# restart log message. +# Under runit, this just has the effect of generating a service restart +# log message. EXIT_ON_IPCACHE_FULL # If present, ostiaryd will not detach from the terminal it was started # from. This is useful when running ostiaryd from programs like inetd or -# cygrunsrv or daemontools. +# cygrunsrv or runit. SKIP_DETACH # Port to listen on. (Can be specified on command line.) PORT=${OSTIARY_PORT} # The password to remotely kill ostiaryd. Sort of useless when running under -# daemontools, since daemontools will just start ostiaryd back up. (But it -# is required to be in this file) +# runit, since runit will just start ostiaryd back up. (But it is required +# to be in this file) KILL="${OSTIARY_PASSWORD}-kill" # Must be at least one action. Format is: diff --git a/encap/src/bcfg2-site/bcfg2-site-RENAME/postinstall.tmpl b/encap/src/bcfg2-site/bcfg2-site-RENAME/postinstall.tmpl index 1ac29eb7e..c8ed2d694 100755 --- a/encap/src/bcfg2-site/bcfg2-site-RENAME/postinstall.tmpl +++ b/encap/src/bcfg2-site/bcfg2-site-RENAME/postinstall.tmpl @@ -124,31 +124,31 @@ else touch ${BASEDIR}/sbin/.SENTINEL_SITE fi -# ostiary (daemontools) -if [ ! -h /service/ostiary ]; then - if [ -d /usr/local/var/svc.d/ostiary ]; then - printf "INFO: Enabling ostiary service (via daemontools)...\n" - ln -s /usr/local/var/svc.d/ostiary /service/ostiary +# ostiary (runit) +if [ ! -h /usr/local/var/service/ostiary ]; then + if [ -d /usr/local/etc/sv/ostiary ]; then + printf "INFO: Enabling ostiary service (via runit)...\n" + ln -s /usr/local/etc/sv/ostiary /usr/local/var/service/ostiary else - printf "ERROR: /usr/local/var/svc.d/ostiary does not exist.\n" + printf "ERROR: /usr/local/etc/sv/ostiary does not exist.\n" exit 1 fi else - printf "INFO: /service/ostiary already exists, not replacing...\n" + printf "INFO: /usr/local/var/service/ostiary already exists, not replacing...\n" fi -# bcfg2-client (daemontools) +# bcfg2-client (runit) //if int(@BCFG2_CLIENT_RUN_INTERVAL_SECONDS) > 0 -if [ ! -h /service/bcfg2-client ]; then - if [ -d /usr/local/var/svc.d/bcfg2-client ]; then - printf "INFO: Enabling bcfg2-client service (via daemontools)...\n" - ln -s /usr/local/var/svc.d/bcfg2-client /service/bcfg2-client +if [ ! -h /usr/local/var/service/bcfg2-client ]; then + if [ -d /usr/local/etc/sv/bcfg2-client ]; then + printf "INFO: Enabling bcfg2-client service (via runit)...\n" + ln -s /usr/local/etc/sv/bcfg2-client /usr/local/var/service/bcfg2-client else - printf "ERROR: /usr/local/var/svc.d/bcfg2-client does not exist.\n" + printf "ERROR: /usr/local/etc/sv/bcfg2-client does not exist.\n" printf "ERROR: Could not enable bcfg2-client service.\n" fi else - printf "INFO: /service/bcfg2-client already exists, not replacing...\n" + printf "INFO: /usr/local/var/service/bcfg2-client already exists, not replacing...\n" fi //end if diff --git a/encap/src/bcfg2-site/bcfg2-site-RENAME/sbin/ost-bcfg2.sh b/encap/src/bcfg2-site/bcfg2-site-RENAME/sbin/ost-bcfg2.sh index 55b20caac..a446e27f0 100755 --- a/encap/src/bcfg2-site/bcfg2-site-RENAME/sbin/ost-bcfg2.sh +++ b/encap/src/bcfg2-site/bcfg2-site-RENAME/sbin/ost-bcfg2.sh @@ -8,19 +8,19 @@ umask 002 exec 2>&1 -LOG="multilog t /usr/local/var/multilog/bcfg2-client-ostiary" -PATH=/usr/local/lib/bcfg2/bin:/command:/usr/local/bin:/usr/bin:/bin +LOG="svlogd -tt /usr/local/var/svlogd/bcfg2-client-ostiary" +PATH=/usr/local/lib/bcfg2/bin:/usr/local/bin:/usr/bin:/bin export PATH case $1 in - dvqn) bcfg2 -d -v -q -n | $LOG ;; - dvn) bcfg2 -d -v -n | $LOG ;; - dvq) bcfg2 -d -v -q | $LOG ;; - dv) bcfg2 -d -v | $LOG ;; - vq) bcfg2 -v -q | $LOG ;; - v) bcfg2 -v | $LOG ;; - restart) svc -t bcfg2-client | $LOG ;; - *) printf "ERROR in $0\n" | $LOG ;; + dvqn) bcfg2 -d -v -q -n | $LOG ;; + dvn) bcfg2 -d -v -n | $LOG ;; + dvq) bcfg2 -d -v -q | $LOG ;; + dv) bcfg2 -d -v | $LOG ;; + vq) bcfg2 -v -q | $LOG ;; + v) bcfg2 -v | $LOG ;; + restart) sv restart bcfg2-client | $LOG ;; + *) printf "ERROR in $0\n" | $LOG ;; esac exit 0 \ No newline at end of file diff --git a/encap/src/encap-profiles/Makefile b/encap/src/encap-profiles/Makefile index 722557964..e40cf20fe 100644 --- a/encap/src/encap-profiles/Makefile +++ b/encap/src/encap-profiles/Makefile @@ -30,19 +30,18 @@ BCFG2_PYREX := $(basename $(wildcard bcfg2-pyrex-*.ep)) BCFG2_PYTHON := $(basename $(wildcard bcfg2-python-[0-9].[0-9]*.ep)) BCFG2_READLINE := $(basename $(wildcard bcfg2-readline-*.ep)) BCFG2_ZLIB := $(basename $(wildcard bcfg2-zlib-*.ep)) -DAEMONTOOLS := $(basename $(wildcard daemontools-[0-9].[0-9]*.ep)) -DAEMONTOOLS_DOC := $(basename $(wildcard daemontools-doc-*.ep)) M4 := $(basename $(wildcard m4-*.sh)) MAKESELF := $(basename $(wildcard makeself-*.ep)) OSTIARTY := $(basename $(wildcard ostiary-[0-9].[0-9]*.ep)) OSTIARTY_DOC := $(basename $(wildcard ostiary-doc-*.ep)) PATCH := $(basename $(wildcard patch-*.ep)) +RUNIT := $(basename $(wildcard runit-[0-9].[0-9]*.ep)) -sources_ep := $(sort $(BCFG2) $(BCFG2_CHEETAH) $(BCFG2_ELEMENTTREE) $(BCFG2_GZIP) $(BCFG2_OPENSSL) $(BCFG2_PKG_CONFIG) $(BCFG2_PYOPENSSL) $(BCFG2_PYTHON) $(BCFG2_READLINE) $(BCFG2_ZLIB) $(DAEMONTOOLS) $(MAKESELF) $(OSTIARTY) $(PATCH)) +sources_ep := $(sort $(BCFG2) $(BCFG2_CHEETAH) $(BCFG2_ELEMENTTREE) $(BCFG2_GZIP) $(BCFG2_OPENSSL) $(BCFG2_PKG_CONFIG) $(BCFG2_PYOPENSSL) $(BCFG2_PYTHON) $(BCFG2_READLINE) $(BCFG2_ZLIB) $(MAKESELF) $(OSTIARTY) $(PATCH) $(RUNIT)) sources_sh := $(sort $(M4)) -sources_server := $(sort $(BCFG2_GLIB) $(BCFG2_GAMIN) $(BCFG2_LIBXML2) $(BCFG2_LIBXSLT) $(BCFG2_LXML) $(BCFG2_CHEETAH_DOC) $(BCFG2_PYREX) $(DAEMONTOOLS_DOC) $(OSTIARTY_DOC)) +sources_server := $(sort $(BCFG2_GLIB) $(BCFG2_GAMIN) $(BCFG2_LIBXML2) $(BCFG2_LIBXSLT) $(BCFG2_LXML) $(BCFG2_CHEETAH_DOC) $(BCFG2_PYREX) $(OSTIARTY_DOC)) # Only compile bcfg2-glib and bcfg2-gamin (needed by bcfg2 server) on Linux # (Gamin only supports Linux), and only compile bcfg2-python-apt on known @@ -183,7 +182,7 @@ distclean : clean uninstall : distclean -(find $(BASEDIR)/lib/bcfg2 | grep "\.pyc" | xargs -n1 rm) - -(ENCAPS="m4 patch daemontools makeself ostiary bcfg2"; \ + -(ENCAPS="m4 patch runit makeself ostiary bcfg2"; \ for ENCAP in $${ENCAPS}; do \ $(EPKG) -q -r $(ENCAPDIR)/$${ENCAP}-*; \ rm -rf $(ENCAPDIR)/$${ENCAP}-*; \ diff --git a/encap/src/encap-profiles/bcfg2-0.9.2.ep b/encap/src/encap-profiles/bcfg2-0.9.2.ep index 61e4e317d..c78c59171 100644 --- a/encap/src/encap-profiles/bcfg2-0.9.2.ep +++ b/encap/src/encap-profiles/bcfg2-0.9.2.ep @@ -165,13 +165,14 @@ for FILE in `ls lib/bcfg2/tools`; do \ ln -sf ../../../../lib/bcfg2/tools/${FILE} share/doc/bcfg2/tools/${FILE}; \ fi; \ done -# daemontools stuff +# runit stuff test -d var || mkdir var -test -d var/svc.d || mkdir var/svc.d -test -d var/svc.d/bcfg2-client || mkdir var/svc.d/bcfg2-client -test -d var/svc.d/bcfg2-client/log || mkdir var/svc.d/bcfg2-client/log -test -d var/svc.d/bcfg2-server || mkdir var/svc.d/bcfg2-server -test -d var/svc.d/bcfg2-server/log || mkdir var/svc.d/bcfg2-server/log +test -d etc || mkdir etc +test -d etc/sv || mkdir etc/sv +test -d etc/sv/bcfg2-client || mkdir etc/sv/bcfg2-client +test -d etc/sv/bcfg2-client/log || mkdir etc/sv/bcfg2-client/log +test -d etc/sv/bcfg2-server || mkdir etc/sv/bcfg2-server +test -d etc/sv/bcfg2-server/log || mkdir etc/sv/bcfg2-server/log # Make "this encap is installed" sentinal file available in /usr/local/var/encap test -d var/encap || mkdir var/encap touch var/encap/${ENCAP_PKGNAME} @@ -369,10 +370,10 @@ ${PYTHON} ${COMPILEALL} ${BASEDIR} exit 0 ]]> - -&1 -printf "*** exec /command/envdir /usr/local/etc/default/bcfg2-client/env ./bcfg2-client.sh ...\n" -exec /command/envdir /usr/local/etc/default/bcfg2-client/env ./bcfg2-client.sh +printf "*** exec /usr/local/bin/chpst -e /usr/local/etc/default/bcfg2-client/env ./bcfg2-client.sh ...\n" +exec /usr/local/bin/chpst -e /usr/local/etc/default/bcfg2-client/env ./bcfg2-client.sh ]]> -&1 -exec /command/multilog t /usr/local/var/multilog/bcfg2-client +exec /usr/local/bin/svlogd -tt /usr/local/var/svlogd/bcfg2-client ]]> -&1 -/command/envdir /usr/local/etc/default/bcfg2-server/env /bin/sh -c '\ +/usr/local/bin/chpst -e /usr/local/etc/default/bcfg2-server/env /bin/sh -c '\ printf "*** exec /usr/local/bin/bcfg2-server ${OPTIONS} ...\n"' -exec /command/envdir /usr/local/etc/default/bcfg2-server/env /bin/sh -c '\ +exec /usr/local/bin/chpst -e /usr/local/etc/default/bcfg2-server/env /bin/sh -c '\ exec /usr/local/bin/bcfg2-server ${OPTIONS}' ]]> -&1 -exec /command/multilog t /usr/local/var/multilog/bcfg2-server +exec /usr/local/bin/svlogd -tt /usr/local/var/svlogd/bcfg2-server ]]> - - - - - - - - - - - - -PLATFORM_IF_MATCH(linux) -PLATFORM_ELSE - -PLATFORM_ENDIF - - - - - - extern int error_intr; - extern int error_nomem; -diff -ru daemontools-0.76/src/svscan.c daemontools-0.76.new/src/svscan.c ---- daemontools-0.76/src/svscan.c 2001-07-12 12:49:49.000000000 -0400 -+++ daemontools-0.76.new/src/svscan.c 2004-02-08 01:50:27.000000000 -0500 -@@ -1,6 +1,7 @@ - #include - #include - #include -+#include - #include "direntry.h" - #include "strerr.h" - #include "error.h" -@@ -14,6 +15,11 @@ - - #define SERVICES 1000 - -+#ifndef SVSCANINFO -+#define SVSCANINFO ".svscan" /* must begin with dot ('.') */ -+#endif -+ -+#define INFO "svscan: info: " - #define WARNING "svscan: warning: " - #define FATAL "svscan: fatal: " - -@@ -38,7 +44,7 @@ - int i; - const char *args[3]; - -- if (fn[0] == '.') return; -+ if (fn[0] == '.' && str_diff(fn,SVSCANINFO)) return; - - if (stat(fn,&st) == -1) { - strerr_warn4(WARNING,"unable to stat ",fn,": ",&strerr_sys); -@@ -59,7 +65,8 @@ - } - x[i].ino = st.st_ino; - x[i].dev = st.st_dev; -- x[i].pid = 0; -+ /*(fn[0]=='.' here only if SVSCANINFO; if so only supervise log/ subdir)*/ -+ x[i].pid = (fn[0] != '.') ? 0 : -1; - x[i].pidlog = 0; - x[i].flaglog = 0; - -@@ -190,12 +197,39 @@ - } - } - -+static void open_svscan_log(void) -+{ -+ const int i = numx; -+ struct stat st; -+ static char fn[] = SVSCANINFO; /* avoid compiler warning on const string */ -+ -+ /* (semi-paranoid; could be moreso) */ -+ if (fstat(STDIN_FILENO,&st) != 0 && errno == EBADF) -+ (void) open("/dev/null", O_RDONLY); -+ if (fstat(STDOUT_FILENO,&st) != 0 && errno == EBADF) -+ (void) open("/dev/null", O_WRONLY); -+ if (fstat(STDERR_FILENO,&st) != 0 && errno == EBADF) -+ (void) open("/dev/null", O_WRONLY); -+ -+ if (stat(fn,&st) == 0) { -+ start(fn); -+ if (i+1 == numx && x[i].pidlog != 0) { -+ (void) dup2(x[i].pi[1], STDOUT_FILENO); -+ (void) dup2(x[i].pi[1], STDERR_FILENO); -+ strerr_warn1("",0); -+ strerr_warn2(INFO,"*** Starting svscan",0); -+ } -+ } -+} -+ - int main(int argc,char **argv) - { - if (argv[0] && argv[1]) - if (chdir(argv[1]) == -1) - strerr_die4sys(111,FATAL,"unable to chdir to ",argv[1],": "); - -+ open_svscan_log(); -+ - for (;;) { - doit(); - sleep(5); - -]]> - - - - - - - - -./package/compile - - - -test -d ${ENCAP_SOURCE} || mkdir ${ENCAP_SOURCE} -test -d ${ENCAP_SOURCE}/${ENCAP_PKGNAME} || mkdir ${ENCAP_SOURCE}/${ENCAP_PKGNAME} -test -d ${ENCAP_SOURCE}/${ENCAP_PKGNAME}/bin || mkdir ${ENCAP_SOURCE}/${ENCAP_PKGNAME}/bin -test -d ${ENCAP_SOURCE}/${ENCAP_PKGNAME}/src || mkdir ${ENCAP_SOURCE}/${ENCAP_PKGNAME}/src -test -d ${ENCAP_SOURCE}/${ENCAP_PKGNAME}/package || mkdir ${ENCAP_SOURCE}/${ENCAP_PKGNAME}/package -cp command/* ${ENCAP_SOURCE}/${ENCAP_PKGNAME}/bin -cp package/run ${ENCAP_SOURCE}/${ENCAP_PKGNAME}/package -cp package/commands ${ENCAP_SOURCE}/${ENCAP_PKGNAME}/package -cp package/boot.inittab ${ENCAP_SOURCE}/${ENCAP_PKGNAME}/package -cp package/boot.rclocal ${ENCAP_SOURCE}/${ENCAP_PKGNAME}/package -cp package/run.inittab ${ENCAP_SOURCE}/${ENCAP_PKGNAME}/package -cp package/run.rclocal ${ENCAP_SOURCE}/${ENCAP_PKGNAME}/package - - - - - - - -mv package/run package/run.orig -mv package/run.inittab package/run.inittab.orig -mv package/boot.inittab package/boot.inittab.orig -mv package/run.rclocal package/run.rclocal.orig -mv package/boot.rclocal package/boot.rclocal.orig -test -d var || mkdir var -test -d var/svc.d || mkdir var/svc.d -test -d var/svc.d/svscan || mkdir var/svc.d/svscan -test -d var/svc.d/svscan/log || mkdir var/svc.d/svscan/log -# Make "this encap is installed" sentinal file available in /usr/local/var/encap -test -d var/encap || mkdir var/encap -touch var/encap/${ENCAP_PKGNAME} - - -&1 -exec /command/multilog t /usr/local/var/multilog/svscan -]]> - - - -/dev/null 2>&1 - -for log_dir in "$SERVICES"/*/log "$SERVICES"/.svscan/log; do - if [ -d "$log_dir" ] \ - && svok "$log_dir" \ - && svstat "$log_dir" | grep -q ": up" - then - svc -ox "$log_dir" - fi -done - -for service_dir in "$SERVICES"/*; do - if [ -d "$service_dir" ] \ - && svok "$service_dir" \ - && svstat "$service_dir" | grep -q ": up" - then - [ -x "$service_dir"/shutdown ] && "$service_dir"/shutdown - svc -dx "$service_dir" - fi -done - -[ "$1" = "start" ] && exec env - PATH=$PATH svscan "$SERVICES" -]]> - - /usr/local/var/svc.d/svscan ...' -ln -s /usr/local/var/svc.d/svscan /service/.svscan - -if test -r /etc/inittab -then - /command/setlock /etc/inittab package/run.inittab -else - /command/setlock /etc/rc.local package/run.rclocal -fi -]]> - - - -/dev/null -then - echo 'inittab contains an svscan.rc line. I assume that svscan is already running. -' -else - echo 'Adding svscan.rc to inittab...' - rm -f /etc/inittab'{new}' - cat /etc/inittab package/boot.inittab > /etc/inittab'{new}' - mv -f /etc/inittab'{new}' /etc/inittab - kill -HUP 1 - echo 'init should start svscan now.' -fi -]]> - -/dev/null -then - echo 'Backing up inittab to .inittab.backup...' - rm -f /etc/.inittab.backup - cp -f /etc/inittab /etc/.inittab.backup - echo 'Removing svscan lines from inittab...' - rm -f /etc/inittab'{new}' - grep -v svscan /etc/inittab > /etc/inittab'{new}' - mv -f /etc/inittab'{new}' /etc/inittab - kill -HUP 1 - echo 'init should stop svscan now.' -else - echo 'inittab does not contain an svscan.rc line. -' -fi -]]> - - -/tmp/svscan-start.log 2>&1 -SZ:S016:once:/command/svscan.rc stop /tmp/svscan-stop.log 2>&1 -]]> - -/dev/null -then - echo 'rc.local contains an svscan.rc line. I assume that svscan is already running -.' -else - echo 'Adding svscan.rc to /etc/rc.local...' - rm -f /etc/rc.local'{new}' - cat /etc/rc.local package/boot.rclocal > /etc/rc.local'{new}' - mv -f /etc/rc.local'{new}' /etc/rc.local - echo 'Reboot now to start svscan.' -fi -]]> - -/dev/null -then - echo 'Backing up rc.local to .rc.local.backup...' - rm -f /etc/.rc.local.backup - cp -f /etc/rc.local /etc/.rc.local.backup - echo 'Removing svscan lines from /etc/rc.local...' - rm -f /etc/rc.local'{new}' - grep -v svscan /etc/rc.local > /etc/rc.local'{new}' - mv -f /etc/rc.local'{new}' /etc/rc.local - echo 'Reboot now to stop svscan.' -else - echo 'rc.local does not contain an svscan.rc line. -.' -fi -]]> - - - - $LOG 2>&1 -printf "Running daemontools postinstall script...\n" -date -test -d /usr/local/var || mkdir /usr/local/var -test -d /usr/local/var/multilog || mkdir /usr/local/var/multilog -test -d /usr/local/var/multilog/svscan || mkdir /usr/local/var/multilog/svscan -test -h /command || ln -s /usr/local/encap/daemontools-0.76/bin /command -cd /usr/local/encap/daemontools-0.76 && ./package/run -printf "Finished daemontools postinstall script.\n" -]]> - - - - -description daemontools - a collection of tools for managing UNIX services -exclude src -exclude package - - - diff --git a/encap/src/encap-profiles/daemontools-doc-20060731.ep b/encap/src/encap-profiles/daemontools-doc-20060731.ep deleted file mode 100644 index 81540d2b3..000000000 --- a/encap/src/encap-profiles/daemontools-doc-20060731.ep +++ /dev/null @@ -1,62 +0,0 @@ - - - - - - - - - - - - - -: - - - -: - - - -test -d ${ENCAP_SOURCE} || mkdir ${ENCAP_SOURCE} -test -d ${ENCAP_SOURCE}/${ENCAP_PKGNAME} || mkdir ${ENCAP_SOURCE}/${ENCAP_PKGNAME} -test -d ${ENCAP_SOURCE}/${ENCAP_PKGNAME}/share || mkdir ${ENCAP_SOURCE}/${ENCAP_PKGNAME}/share -test -d ${ENCAP_SOURCE}/${ENCAP_PKGNAME}/share/doc || mkdir ${ENCAP_SOURCE}/${ENCAP_PKGNAME}/share/doc -test -d ${ENCAP_SOURCE}/${ENCAP_PKGNAME}/share/doc/daemontools || mkdir ${ENCAP_SOURCE}/${ENCAP_PKGNAME}/share/doc/daemontools -cp -R * ${ENCAP_SOURCE}/${ENCAP_PKGNAME}/share/doc/daemontools - - - -: - - - - - -# Make "this encap is installed" sentinal file available in /usr/local/var/encap -test -d var || mkdir var -test -d var/encap || mkdir var/encap -touch var/encap/${ENCAP_PKGNAME} - - - -description daemontools-doc - documentation from daemontools websites - - - diff --git a/encap/src/encap-profiles/ostiary-3.4.ep b/encap/src/encap-profiles/ostiary-3.4.ep index 5199c3abd..da57d6891 100644 --- a/encap/src/encap-profiles/ostiary-3.4.ep +++ b/encap/src/encap-profiles/ostiary-3.4.ep @@ -81,26 +81,27 @@ rmdir etc # daemons should be in /usr/local/sbin test -d sbin || mkdir sbin mv bin/ostiaryd sbin/ostiaryd -# daemontool stuff +# runit stuff test -d var || mkdir var -test -d var/svc.d || mkdir var/svc.d -test -d var/svc.d/ostiary || mkdir var/svc.d/ostiary -test -d var/svc.d/ostiary/log || mkdir var/svc.d/ostiary/log +test -d etc || mkdir etc +test -d etc/sv || mkdir etc/sv +test -d etc/sv/ostiary || mkdir etc/sv/ostiary +test -d etc/sv/ostiary/log || mkdir etc/sv/ostiary/log # Make "this encap is installed" sentinal file available in /usr/local/var/encap test -d var/encap || mkdir var/encap touch var/encap/${ENCAP_PKGNAME} -&1 exec /usr/local/sbin/ostiaryd -c /usr/local/etc/ostiary.cfg -v -D ]]> -&1 -exec /command/multilog t /usr/local/var/multilog/ostiary +exec /usr/local/bin/svlogd -tt /usr/local/var/svlogd/ostiary ]]> $LOG 2>&1 printf "Running ostiary postinstall script...\n" date -test -d /usr/local/var/multilog || mkdir /usr/local/var/multilog -test -d /usr/local/var/multilog/ostiary || mkdir /usr/local/var/multilog/ostiary +test -d /usr/local/var/svlogd || mkdir /usr/local/var/svlogd +test -d /usr/local/var/svlogd/ostiary || mkdir /usr/local/var/svlogd/ostiary printf "Finished ostiary postinstall script.\n" ]]> @@ -122,9 +123,9 @@ printf "Finished ostiary postinstall script.\n" printf "Running ostiary preremove script...\n" date -if [ -h /service/ostiary ]; then - printf "INFO: Removing /service/ostiary...\n" - /command/svrm /service/ostiary +if [ -h /usr/local/var/service/ostiary ]; then + printf "INFO: Removing /usr/local/var/service/ostiary...\n" + rm /usr/local/var/service/ostiary fi printf "Finished ostiary preremove script.\n" diff --git a/encap/src/encap-profiles/runit-1.7.2.ep b/encap/src/encap-profiles/runit-1.7.2.ep new file mode 100644 index 000000000..afd02bca9 --- /dev/null +++ b/encap/src/encap-profiles/runit-1.7.2.ep @@ -0,0 +1,159 @@ + + + + + + + + + + + + + +PLATFORM_IF_MATCH(linux) +PLATFORM_ELSE + +PLATFORM_ENDIF + + + + + + +./package/compile +./package/check + + + +test -d ${ENCAP_SOURCE} || mkdir ${ENCAP_SOURCE} +test -d ${ENCAP_SOURCE}/${ENCAP_PKGNAME} || mkdir ${ENCAP_SOURCE}/${ENCAP_PKGNAME} +test -d ${ENCAP_SOURCE}/${ENCAP_PKGNAME}/bin || mkdir ${ENCAP_SOURCE}/${ENCAP_PKGNAME}/bin +test -d ${ENCAP_SOURCE}/${ENCAP_PKGNAME}/share || mkdir ${ENCAP_SOURCE}/${ENCAP_PKGNAME}/share +test -d ${ENCAP_SOURCE}/${ENCAP_PKGNAME}/share/doc || mkdir ${ENCAP_SOURCE}/${ENCAP_PKGNAME}/share/doc +test -d ${ENCAP_SOURCE}/${ENCAP_PKGNAME}/share/doc/runit || mkdir ${ENCAP_SOURCE}/${ENCAP_PKGNAME}/share/doc/runit +test -d ${ENCAP_SOURCE}/${ENCAP_PKGNAME}/man || mkdir ${ENCAP_SOURCE}/${ENCAP_PKGNAME}/man +test -d ${ENCAP_SOURCE}/${ENCAP_PKGNAME}/man/man8 || mkdir ${ENCAP_SOURCE}/${ENCAP_PKGNAME}/man/man8 +cp command/* ${ENCAP_SOURCE}/${ENCAP_PKGNAME}/bin +cp -r doc/* ${ENCAP_SOURCE}/${ENCAP_PKGNAME}/share/doc/runit +cp -r etc ${ENCAP_SOURCE}/${ENCAP_PKGNAME}/share/doc/runit +cp -r package ${ENCAP_SOURCE}/${ENCAP_PKGNAME}/share/doc/runit +cp man/* ${ENCAP_SOURCE}/${ENCAP_PKGNAME}/man/man8 + + + + + + + +# Make "this encap is installed" sentinal file available in /usr/local/var/encap +test -d var || mkdir var +test -d var/encap || mkdir var/encap +touch var/encap/${ENCAP_PKGNAME} + + + + + + +/dev/null +then + echo 'inittab contains an SV: line. I assume that runsvdir is already running. +' +else + echo 'Adding runsvdir to inittab...' + rm -f /etc/inittab'{new}' + cat /etc/inittab boot.inittab > /etc/inittab'{new}' + mv -f /etc/inittab'{new}' /etc/inittab + kill -HUP 1 + echo 'init should start runsvdir now. +' +fi +]]> + +/dev/null +then + echo 'Backing up inittab to .inittab.backup...' + rm -f /etc/.inittab.backup + cp -f /etc/inittab /etc/.inittab.backup + echo 'Removing svscan lines from inittab...' + rm -f /etc/inittab'{new}' + grep -v SV: /etc/inittab > /etc/inittab'{new}' + mv -f /etc/inittab'{new}' /etc/inittab + kill -HUP 1 + echo 'init should stop runsvdir now. +' +else + echo 'inittab does not contain a runsvdir line. +' +fi +]]> + + $LOG 2>&1 +printf "Running runit postinstall script...\n" +date +test -d /usr/local/var || mkdir /usr/local/var +test -d /usr/local/var/svlogd || mkdir /usr/local/var/svlog +test -d /usr/local/var/service || mkdir /usr/local/var/service +test -d /usr/local/etc || mkdir /usr/local/etc +test -d /usr/local/etc/default || mkdir /usr/local/etc/default +test -d /usr/local/etc/sv || mkdir /usr/local/etc/sv +cd ${ENCAP_SOURCE}/${ENCAP_PKGNAME} && ./inittab-install +printf "Finished runit postinstall script.\n" +]]> + + + + +description runit - a UNIX init scheme with service supervision + + + diff --git a/encap/src/makeself-dist/makedist.sh b/encap/src/makeself-dist/makedist.sh index 8c80f2e14..fdd5e81df 100755 --- a/encap/src/makeself-dist/makedist.sh +++ b/encap/src/makeself-dist/makedist.sh @@ -50,8 +50,8 @@ tar -cf $DISTDIR/epkg.tar $EPKGDIR/* BCFG2="`basename $EPDIR/bcfg2-[0-9].[0-9]*-encap-*.tar.gz`" BCFG2_ELEMENTTREE="`basename $EPDIR/bcfg2-elementtree-*-encap-*.tar.gz`" BCFG2_PYTHON="`basename $EPDIR/bcfg2-python-[0-9].[0-9]*-encap-*.tar.gz`" -DAEMONTOOLS="`basename $EPDIR/daemontools-[0-9].[0-9]*-encap-*.tar.gz`" OSTIARTY="`basename $EPDIR/ostiary-[0-9].[0-9]*-encap-*.tar.gz`" +RUNIT="`basename $EPDIR/runit-[0-9].[0-9]*-encap-*.tar.gz`" BCFG2_PYTHON_APT_TMP="`basename $EPDIR/bcfg2-python-apt-*-encap-*.tar.gz`" if [ "${BCFG2_PYTHON_APT_TMP}x" != 'bcfg2-python-apt-*-encap-*.tar.gzx' ]; then @@ -60,7 +60,7 @@ fi BCFG2DEPS="$BCFG2_ELEMENTTREE $BCFG2_PYTHON $BCFG2_PYTHON_APT" -FILES="$BCFG2DEPS $BCFG2 $DAEMONTOOLS $OSTIARTY" +FILES="$BCFG2DEPS $BCFG2 $RUNIT $OSTIARTY" for FILE in ${FILES}; do cp $EPDIR/$FILE $DISTDIR @@ -106,7 +106,7 @@ if [ ! -h "$EPKG" -o ! -d "$ENCAPDIR/epkg-2.3.[89]" ]; then fi # Install everything else -for LOC_PKG in $BCFG2DEPS $BCFG2 $DAEMONTOOLS $OSTIARTY $BCFG2_SITE; do +for LOC_PKG in $BCFG2DEPS $BCFG2 $RUNIT $OSTIARTY $BCFG2_SITE; do LOC_PKGSPEC="\`printf "%s\n" "\$LOC_PKG" | sed s:-encap.*::g\`" if [ -d "$ENCAPDIR/\$LOC_PKGSPEC" ]; then if [ "\${LOC_PKGSPEC}x" != "x" ]; then @@ -237,13 +237,13 @@ chmod 600 \${LOC_BCFG2_CONF}* chmod 600 \${LOC_OST_CFG}* # Restart services if they exist to catch any config file changes -if [ -x /command/svc -a -x /command/svstat ]; then +if [ -x /usr/local/bin/sv ]; then for LOC_SERVICE in bcfg2-client bcfg2-server ostiary; do - if [ -h /service/\${LOC_SERVICE} ]; then - printf "Restarting daemontools service \${LOC_SERVICE}...\n" - /command/svc -t /service/\${LOC_SERVICE} + if [ -h /usr/local/var/service/\${LOC_SERVICE} ]; then + printf "Restarting runit service \${LOC_SERVICE}...\n" + /usr/local/bin/sv restart /usr/local/var/service/\${LOC_SERVICE} sleep 2 - /command/svstat /service/\${LOC_SERVICE} + /usr/local/bin/sv status /usr/local/var/service/\${LOC_SERVICE} fi done fi -- cgit v1.2.3-1-g7c22