Introduction
The standard installation of the Daniel J. Bernstein's
daemontools software creates some directories in "/".
For many years I just ignored the complaints from others that this is not according the OpenBSD standard file layout as described in
hier(7).
However for an installation on a Compact Flash card I needed to be able to specify where the files end up.
The following two scripts try to achieve this:
- new_daemontools_compile
- new_daemontools_install
new_daemontools_compile
Code:
#!/bin/sh +e
# $Id: new_daemontools_compile,v 1.4 2009/11/13 02:37:48 root Exp $
DAEMONTOOLS="daemontools-0.76"
DAEMONTOOLS_ARCHIVE="${DAEMONTOOLS}.tar.gz"
NEEDED="${DAEMONTOOLS_ARCHIVE} \
new_daemontools_install \
dt-makefile.patch"
for file in ${NEEDED} ; do
if [ ! -f $file ] ; then
echo $0 : Sorry cannot find file $file
exit 1
fi
echo "$0: OK found file $file"
done
echo
echo -Unpacking ${DAEMONTOOLS_ARCHIVE}
echo
tar -xpvzf ${DAEMONTOOLS_ARCHIVE}
CURDIR=$(pwd)
cd admin/${DAEMONTOOLS}/src/
echo
echo $0: -------- Patching Makefile
echo
patch -p0 -l Makefile ${CURDIR}/dt-makefile.patch
echo
echo $0: ------- compiling daemontools --------
echo
make || exit 100
echo
echo $0: ----- Compile finished --------
echo You now can run the 'new_daemontools_install' script
echo
After checking if all necessary files are in the current directory, it first unpacks the daemontools tarball. This results in a lot of files under the directory
./admin.
Before running Bernsteins makefile, it is patched with the
dt-makefile-patch file, shamelessly stolen from the FreeBSD daemontools port.
Code:
--- Makefile Thu Jul 12 18:49:49 2001
+++ /tmp/Makefile Sat Nov 5 02:56:33 2005
@@ -82,10 +82,9 @@
chkshsgr.o: chkshsgr.c compile
./compile chkshsgr.c
-choose: choose.sh home warn-auto.sh
+choose: choose.sh warn-auto.sh
rm -f choose
cat warn-auto.sh choose.sh \
- | sed s}HOME}"`head -1 home`"}g \
> choose
chmod 555 choose
@@ -387,10 +386,9 @@
pathexec.h str.h strerr.h svscan.c wait.h
./compile svscan.c
-svscanboot: home svscanboot.sh warn-auto.sh
+svscanboot: svscanboot.sh warn-auto.sh
rm -f svscanboot
cat warn-auto.sh svscanboot.sh \
- | sed s}HOME}"`head -1 home`"}g \
> svscanboot
chmod 555 svscanboot
Executing the script
Code:
# ./new_daemontools_compile
./new_daemontools_compile: OK found file daemontools-0.76.tar.gz
./new_daemontools_compile: OK found file new_daemontools_install
./new_daemontools_compile: OK found file dt-makefile.patch
-Unpacking daemontools-0.76.tar.gz
admin
admin/daemontools-0.76
admin/daemontools-0.76/package
admin/daemontools-0.76/package/README
admin/daemontools-0.76/package/files
admin/daemontools-0.76/package/sharing
admin/daemontools-0.76/package/commands
admin/daemontools-0.76/package/install
[snip]
admin/daemontools-0.76/src/readclose.c
admin/daemontools-0.76/src/openreadclose.h
admin/daemontools-0.76/src/openreadclose.c
./new_daemontools_compile: -------- Patching Makefile
Hmm... Looks like a unified diff to me...
The text leading up to this was:
--------------------------
|--- Makefile Thu Jul 12 18:49:49 2001
|+++ /tmp/Makefile Sat Nov 5 02:56:33 2005
--------------------------
Patching file Makefile using Plan A...
Hunk #1 succeeded at 82.
Hunk #2 succeeded at 386.
done
./new_daemontools_compile: ------- compiling daemontools --------
sh find-systype.sh > systype
rm -f compile
sh print-cc.sh > compile
chmod 555 compile
./compile byte_chr.c
./compile byte_copy.c
./compile byte_cr.c
[snip]
./compile tai64nlocal.c
./load tai64nlocal unix.a byte.a
env - /bin/sh rts.tests 2>&1 | cat -v > rts
[snip]
grep sysdep iopause.h >> sysdeps
grep sysdep hasmkffo.h >> sysdeps
grep sysdep hasflock.h >> sysdeps
grep sysdep hasshsgr.h >> sysdeps
./new_daemontools_compile: ----- Compile finished --------
You now can run the new_daemontools_install script