summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Joseph Barnhart Clark <dclark@pobox.com>2006-08-05 19:19:27 +0000
committerDaniel Joseph Barnhart Clark <dclark@pobox.com>2006-08-05 19:19:27 +0000
commit46e88c9f72f5994aa7d7bf5f20aa6c002309bf7e (patch)
tree4f8c89adcb0830cc99d97168dcda4877c5df89c0
parent8f53e1d47c3f7a8ee2a1fe0290405e840cf1dadd (diff)
downloadbcfg2-46e88c9f72f5994aa7d7bf5f20aa6c002309bf7e.tar.gz
bcfg2-46e88c9f72f5994aa7d7bf5f20aa6c002309bf7e.tar.bz2
bcfg2-46e88c9f72f5994aa7d7bf5f20aa6c002309bf7e.zip
* Added Makefiles for tools
* Fixes for daemontools - .svscan logging works now. git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@2046 ce84e21b-d406-0410-9b95-82705330c041
-rw-r--r--encap/Makefile1
-rw-r--r--encap/TODO12
-rw-r--r--encap/tools/bcfg2-server/Makefile67
-rw-r--r--encap/tools/daemontools/Makefile67
-rw-r--r--encap/tools/daemontools/daemontools-0.76.ep112
-rw-r--r--encap/tools/daemontools/patch-2.5.9.ep2
-rw-r--r--encap/tools/ostiary/Makefile65
-rw-r--r--encap/tools/ostiary/ostiary-3.4.ep2
8 files changed, 318 insertions, 10 deletions
diff --git a/encap/Makefile b/encap/Makefile
index 2d508b65a..45de670d0 100644
--- a/encap/Makefile
+++ b/encap/Makefile
@@ -77,6 +77,7 @@ clean :
( rm *.log || true )
( rm *.packaged || true )
( rm *.gz || true )
+ ( rm *~ || true )
uninstall : clean
( rm *.installed || true )
diff --git a/encap/TODO b/encap/TODO
index 9fb555a9a..ab536f293 100644
--- a/encap/TODO
+++ b/encap/TODO
@@ -1,24 +1,20 @@
- * Install default bcfg2.conf if one doesn't yet exist
-
* daemontools:
- * Test encap, including postinstall scripts for config
- * Modify Makefile, README, bcfg2-0.8.2.ep to work with daemontools
+ * Modify README, bcfg2-0.8.2.ep to work with daemontools
* Create bcfg2 "run" scripts (look at init scripts for other platforms):
* Run bcfg2 server on bootup (configurable like debian, default off)
* Run bcfg2 client once on bootup (")
* Run bcfg2 client at specified interval (")
* ostiary:
- * Test encap
- * Create daemontools "run" script
- * Make sure paths point to right places under /usr/local
- * Modify Makefile, README, bcfg2-0.8.2.ep to work with ostiary
+ * Modify README to work with ostiary
* Integration with bcfg2 client
* bcfg2-site: create/test
* Double-check all permissions, and make sure they are not effected by umask
+ * Make *-doc* .ep's "shared" instead of platform-specific.
+
* Announce to mailing list:
* daemontools & ostiary stuff
* encap support for Solaris (sparc and x86)
diff --git a/encap/tools/bcfg2-server/Makefile b/encap/tools/bcfg2-server/Makefile
new file mode 100644
index 000000000..6e73f0576
--- /dev/null
+++ b/encap/tools/bcfg2-server/Makefile
@@ -0,0 +1,67 @@
+# $Id:$
+
+.PHONY : all install clean uninstall encaps rename
+.SUFFIXES :
+.SUFFIXES : .ep .installed .packaged
+
+BASEDIR = /usr/local
+ENCAPDIR = ${BASEDIR}/encap
+export ENCAPDIR
+EPKG = ${BASEDIR}/bin/epkg
+export EPKG
+MKENCAP = ${BASEDIR}/bin/mkencap
+export MKENCAP
+
+GLIB = bcfg2-glib-2.8.6
+GAMIN = bcfg2-gamin-0.1.7
+
+.ep.installed : # Clean, compile and install an encap package
+ @printf "***** START .ep.installed for |$*| ***** \n"
+ ( ${EPKG} -q -r ${ENCAPDIR}/$* || true )
+ ( rm -rf ${ENCAPDIR}/$* || true )
+ ( ${MKENCAP} -m /usr/local/bin/m4 -b -DUP $*.ep || true ) > $*.log 2>&1
+ ( ${MKENCAP} -m /usr/local/bin/m4 -b -T $*.ep || true ) >> $*.log 2>&1
+ ( ${MKENCAP} -m /usr/local/bin/m4 -b -CBI $*.ep ) >> $*.log 2>&1
+ ${EPKG} -q -i ${ENCAPDIR}/$*
+ test -h ${BASEDIR}/var/encap/$*
+ touch $*.installed
+ @printf "***** STOP .ep.installed for |$*| ***** \n"
+
+.installed.packaged : # Create .tar.gz encap packages for distribution
+ @printf "***** START .installed.packaged for |$*| ***** \n"
+ ( rm ${ENCAPDIR}/$*-*.tar.gz || true )
+ ( cd ${ENCAPDIR} && ${MKENCAP} -e $* || true )
+ cd ${ENCAPDIR} && ${MKENCAP} -c $*
+ mv ${ENCAPDIR}/$*-encap-*.tar.gz .
+ touch $*.packaged
+ @printf "***** STOP .installed.packaged for |$*| ***** \n"
+
+all :
+ ( $(MAKE) install > make.log 2>&1 && $(MAKE) encaps >> make.log 2>&1 ) &
+
+install : ${EPKG} ${MKENCAP} ${GAMIN}.installed
+
+encaps : ${EPKG} ${MKENCAP} ${GAMIN}.packaged
+
+rename : encaps
+ test "$${OS}x" != "x"
+ for EARCHIVE in `ls *-encap-*.tar.gz`; do \
+ mv $${EARCHIVE} `printf $${EARCHIVE} | awk -F- '{$$NF = "OSDIST.tar.gz" ; print}' | sed s:\ :-:g | sed s:OSDIST:\$${OS}:g` ; \
+ done
+
+clean :
+ ( rm *.log || true )
+ ( rm *.packaged || true )
+ ( rm *.gz || true )
+ ( rm *~ || true )
+
+uninstall : clean
+ ( rm *.installed || true )
+ ( ${EPKG} -q -r ${ENCAPDIR}/bcfg2-glib* || true )
+ ( rm -rf ${ENCAPDIR}/bcfg2-glib* || true )
+ ( ${EPKG} -q -r ${ENCAPDIR}/bcfg2-gamin* || true )
+ ( rm -rf ${ENCAPDIR}/bcfg2-gamin* || true )
+
+${GAMIN}.installed : ${GLIB}.installed
+
+${GAMIN}.packaged : ${GLIB}.packaged
diff --git a/encap/tools/daemontools/Makefile b/encap/tools/daemontools/Makefile
new file mode 100644
index 000000000..b477f2ba6
--- /dev/null
+++ b/encap/tools/daemontools/Makefile
@@ -0,0 +1,67 @@
+# $Id:$
+
+.PHONY : all install clean uninstall encaps rename
+.SUFFIXES :
+.SUFFIXES : .ep .installed .packaged
+
+BASEDIR = /usr/local
+ENCAPDIR = ${BASEDIR}/encap
+export ENCAPDIR
+EPKG = ${BASEDIR}/bin/epkg
+export EPKG
+MKENCAP = ${BASEDIR}/bin/mkencap
+export MKENCAP
+
+PATCH = patch-2.5.9
+DAEMONTOOLS = daemontools-0.76
+DAEMONTOOLS-DOC = daemontools-doc-20060731
+
+.ep.installed : # Clean, compile and install an encap package
+ @printf "***** START .ep.installed for |$*| ***** \n"
+ ( ${EPKG} -q -r ${ENCAPDIR}/$* || true )
+ ( rm -rf ${ENCAPDIR}/$* || true )
+ ( ${MKENCAP} -m /usr/local/bin/m4 -b -DUP $*.ep || true ) > $*.log 2>&1
+ ( ${MKENCAP} -m /usr/local/bin/m4 -b -T $*.ep || true ) >> $*.log 2>&1
+ ( ${MKENCAP} -m /usr/local/bin/m4 -b -CBI $*.ep ) >> $*.log 2>&1
+ ${EPKG} -q -i ${ENCAPDIR}/$*
+ test -h ${BASEDIR}/var/encap/$*
+ touch $*.installed
+ @printf "***** STOP .ep.installed for |$*| ***** \n"
+
+.installed.packaged : # Create .tar.gz encap packages for distribution
+ @printf "***** START .installed.packaged for |$*| ***** \n"
+ ( rm ${ENCAPDIR}/$*-*.tar.gz || true )
+ ( cd ${ENCAPDIR} && ${MKENCAP} -e $* || true )
+ cd ${ENCAPDIR} && ${MKENCAP} -c $*
+ mv ${ENCAPDIR}/$*-encap-*.tar.gz .
+ touch $*.packaged
+ @printf "***** STOP .installed.packaged for |$*| ***** \n"
+
+all :
+ ( $(MAKE) install > make.log 2>&1 && $(MAKE) encaps >> make.log 2>&1 ) &
+
+install : ${EPKG} ${MKENCAP} ${DAEMONTOOLS-DOC}.installed
+
+encaps : ${EPKG} ${MKENCAP} ${DAEMONTOOLS-DOC}.packaged
+
+rename : encaps
+ test "$${OS}x" != "x"
+ for EARCHIVE in `ls *-encap-*.tar.gz`; do \
+ mv $${EARCHIVE} `printf $${EARCHIVE} | awk -F- '{$$NF = "OSDIST.tar.gz" ; print}' | sed s:\ :-:g | sed s:OSDIST:\$${OS}:g` ; \
+ done
+
+clean :
+ ( rm *.log || true )
+ ( rm *.packaged || true )
+ ( rm *.gz || true )
+ ( rm *~ || true )
+
+uninstall : clean
+ ( rm *.installed || true )
+ ( ${EPKG} -q -r ${ENCAPDIR}/daemontools* || true )
+ ( rm -rf ${ENCAPDIR}/daemontools* || true )
+
+${DAEMONTOOLS}.installed : ${PATCH}.installed
+${DAEMONTOOLS-DOC}.installed : ${DAEMONTOOLS}.installed
+
+${DAEMONTOOLS-DOC}.packaged : ${DAEMONTOOLS}.packaged
diff --git a/encap/tools/daemontools/daemontools-0.76.ep b/encap/tools/daemontools/daemontools-0.76.ep
index 21e8c8293..e61ec1217 100644
--- a/encap/tools/daemontools/daemontools-0.76.ep
+++ b/encap/tools/daemontools/daemontools-0.76.ep
@@ -8,6 +8,7 @@
>
<prereq package="patch-2.5.9" />
+<prereq package="m4-1.4.4" />
<environment
variable="CC"
@@ -271,6 +272,11 @@ cp package/run.rclocal ${ENCAP_SOURCE}/${ENCAP_PKGNAME}/package
</source>
<prepackage>
+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.inittab.orig
+mv package/boot.rclocal package/boot.inittab.orig
mkdir var 2>/dev/null || exit 1
mkdir var/svc.d 2>/dev/null || exit 1
mkdir var/svc.d/svscan 2>/dev/null || exit 1
@@ -285,6 +291,109 @@ exec 2>&1
exec /command/multilog t /usr/local/var/multilog/svscan
]]></include_file>
+<include_file name="bin/svscan.rc" mode="0755"><![CDATA[
+#!/bin/sh
+# svscan.rc - replacement for /command/svscanboot
+# * Combined with .svscan patch, logs svscan to a file
+# * If /service/*/shutdown exists, run it before killing service
+
+PATH=/command:/usr/local/bin:/usr/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin
+SERVICES=${2:-"/service"}
+
+exec </dev/null >/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"
+]]></include_file>
+
+<include_file name="package/run" mode="0755"><![CDATA[
+#!/bin/sh -e
+
+umask 022
+test -d package || ( echo 'Wrong working directory.'; exit 1 )
+test -d src || ( echo 'Wrong working directory.'; exit 1 )
+
+if test -d /service
+then
+ echo '/service exists. I assume that svscan is already running.'
+ exit 0
+fi
+
+echo 'Creating /service...'
+mkdir /service
+echo 'Creating symlink /service/.svscan -> /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
+]]></include_file>
+
+<include_file name="package/run.inittab" mode="0755"><![CDATA[
+#!/bin/sh -e
+
+if grep svscan.rc /etc/inittab >/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
+]]></include_file>
+
+<include_file name="package/boot.inittab" mode="0644"><![CDATA[
+
+SV:2345:respawn:/command/svscan.rc start
+SZ:S016:once:/command/svscan.rc stop
+]]></include_file>
+
+<include_file name="package/run.rclocal" mode="0755"><![CDATA[
+#!/bin/sh -e
+
+if grep svscan.rc /etc/rc.local >/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
+]]></include_file>
+
+<include_file name="package/boot.rclocal" mode="0644"><![CDATA[
+
+csh -cf '/command/svscan.rc start &'
+]]></include_file>
+
<include_file name="postinstall" mode="0755"><![CDATA[
#!/bin/sh -e
umask 002
@@ -293,11 +402,10 @@ LOG=${BASEDIR}/postinstall.log
exec > $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
-test -d /service || mkdir /service
-test -h /service/.svscan || ln -s /usr/local/var/svc.d/svscan /service/.svscan
cd /usr/local/encap/daemontools-0.76 && ./package/run
printf "Finished daemontools postinstall script.\n"
]]></include_file>
diff --git a/encap/tools/daemontools/patch-2.5.9.ep b/encap/tools/daemontools/patch-2.5.9.ep
index 3707a4c1f..c6e2f6b69 100644
--- a/encap/tools/daemontools/patch-2.5.9.ep
+++ b/encap/tools/daemontools/patch-2.5.9.ep
@@ -7,6 +7,8 @@
pkgspec="patch-2.5.9"
>
+<prereq package="m4-1.4.4" />
+
<environment
variable="CC"
value="gcc"
diff --git a/encap/tools/ostiary/Makefile b/encap/tools/ostiary/Makefile
new file mode 100644
index 000000000..f7885f1c5
--- /dev/null
+++ b/encap/tools/ostiary/Makefile
@@ -0,0 +1,65 @@
+# $Id:$
+
+.PHONY : all install clean uninstall encaps rename
+.SUFFIXES :
+.SUFFIXES : .ep .installed .packaged
+
+BASEDIR = /usr/local
+ENCAPDIR = ${BASEDIR}/encap
+export ENCAPDIR
+EPKG = ${BASEDIR}/bin/epkg
+export EPKG
+MKENCAP = ${BASEDIR}/bin/mkencap
+export MKENCAP
+
+OSTIARTY = ostiary-3.4
+OSTIARTY-DOC = ostiary-doc-20060801
+
+.ep.installed : # Clean, compile and install an encap package
+ @printf "***** START .ep.installed for |$*| ***** \n"
+ ( ${EPKG} -q -r ${ENCAPDIR}/$* || true )
+ ( rm -rf ${ENCAPDIR}/$* || true )
+ ( ${MKENCAP} -m /usr/local/bin/m4 -b -DUP $*.ep || true ) > $*.log 2>&1
+ ( ${MKENCAP} -m /usr/local/bin/m4 -b -T $*.ep || true ) >> $*.log 2>&1
+ ( ${MKENCAP} -m /usr/local/bin/m4 -b -CBI $*.ep ) >> $*.log 2>&1
+ ${EPKG} -q -i ${ENCAPDIR}/$*
+ test -h ${BASEDIR}/var/encap/$*
+ touch $*.installed
+ @printf "***** STOP .ep.installed for |$*| ***** \n"
+
+.installed.packaged : # Create .tar.gz encap packages for distribution
+ @printf "***** START .installed.packaged for |$*| ***** \n"
+ ( rm ${ENCAPDIR}/$*-*.tar.gz || true )
+ ( cd ${ENCAPDIR} && ${MKENCAP} -e $* || true )
+ cd ${ENCAPDIR} && ${MKENCAP} -c $*
+ mv ${ENCAPDIR}/$*-encap-*.tar.gz .
+ touch $*.packaged
+ @printf "***** STOP .installed.packaged for |$*| ***** \n"
+
+all :
+ ( $(MAKE) install > make.log 2>&1 && $(MAKE) encaps >> make.log 2>&1 ) &
+
+install : ${EPKG} ${MKENCAP} ${OSTIARTY-DOC}.installed
+
+encaps : ${EPKG} ${MKENCAP} ${OSTIARTY-DOC}.packaged
+
+rename : encaps
+ test "$${OS}x" != "x"
+ for EARCHIVE in `ls *-encap-*.tar.gz`; do \
+ mv $${EARCHIVE} `printf $${EARCHIVE} | awk -F- '{$$NF = "OSDIST.tar.gz" ; print}' | sed s:\ :-:g | sed s:OSDIST:\$${OS}:g` ; \
+ done
+
+clean :
+ ( rm *.log || true )
+ ( rm *.packaged || true )
+ ( rm *.gz || true )
+ ( rm *~ || true )
+
+uninstall : clean
+ ( rm *.installed || true )
+ ( ${EPKG} -q -r ${ENCAPDIR}/ostiary* || true )
+ ( rm -rf ${ENCAPDIR}/ostiary* || true )
+
+${OSTIARTY-DOC}.installed : ${OSTIARTY}.installed
+
+${OSTIARTY-DOC}.packaged : ${OSTIARTY}.packaged
diff --git a/encap/tools/ostiary/ostiary-3.4.ep b/encap/tools/ostiary/ostiary-3.4.ep
index 3aa6fa7b9..19ca2fe0a 100644
--- a/encap/tools/ostiary/ostiary-3.4.ep
+++ b/encap/tools/ostiary/ostiary-3.4.ep
@@ -7,6 +7,8 @@
pkgspec="ostiary-3.4"
>
+<prereq package="m4-1.4.4" />
+
<environment
variable="CC"
value="gcc"