DaemonForums  

Go Back   DaemonForums > Miscellaneous > Guides

Guides All Guides and HOWTO's.

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1   (View Single Post)  
Old 13th November 2009
J65nko J65nko is offline
Administrator
 
Join Date: May 2008
Location: Budel - the Netherlands
Posts: 3,135
Thanked 182 Times in 149 Posts
Default DJB daemontools: compile and install scripts (OpenBSD)

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
__________________
You don't need to be a genius to debug a pf.conf firewall ruleset, you just need the guts to run tcpdump
Reply With Quote
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Can't load any scripts in ircII guitarscn General software and network 4 22nd November 2010 12:06 AM
Executing web scripts : can't! erehwon OpenBSD General 3 3rd November 2009 10:02 PM
Howto Compile in OpenBSD 4.5 shep OpenBSD Packages and Ports 2 7th May 2009 11:25 PM
Windows scripts can't print drhowarddrfine Other OS 15 31st March 2009 08:53 AM
Periodic scripts for mail scripts stukov FreeBSD General 2 8th March 2009 07:51 PM


All times are GMT. The time now is 11:36 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick