MonkeyBrains.net/~rudy/example Random examples

  Gluff setup on FreeBSD 

How to set up GLUFF for FreeBSD.

  1. Downlaod Gluff 1.12
  2. extract tarball, compile gluff with flag for MySQL libs, and copy to bin...
    pkg install mysql56-client
    unzip master.zip
    cd gluff-master
    env LDFLAGS=-L/usr/local/lib/mysql ./configure
    make
    [if you get errors about gcc, just use clang:
       clang -I. -g -O2 -I/usr/local/include -Wall -DHAVE_CONFIG_H -DPRODUCT=\"gluff\" -DVERSION=\"1.12\" -c gluff.c -o gluff.o
       clang -I. -g -O2 -I/usr/local/include -Wall -DHAVE_CONFIG_H -DPRODUCT=\"gluff\" -DVERSION=\"1.12\" -o gluff gluff.o -L/usr/local/lib/mysql -L/usr/lib/mysql -L/usr/local/lib -lmysqlclient -lsqlite3
    ]
    
    cp gluff /usr/local/bin
    
  3. cd /usr/ports/net/isc-dhcp41-server/
    * grab latest dhcp: portsnap fetch && portsnap extract
  4. vi Makefile [add this line: CFLAGS+= -I${PREFIX}/include -L${PREFIX}/lib]
  5. Patch dhcpd source with patch from the tarball downloaded in step 1 and compile
    pkg install sqlite3
    make extract
    cd work/dhcp-4.1-ESV-R2/
    patch -p1 < ../path/to/patch/dhcp-4.1.1-ldb.patch
    cd ../..
    make && make install
    
  6. alter your /etc/rc.conf to pass a new logging flag to dhcpd:
    dhcpd_flags="-q -ldb /var/db/dhcpd/dhcpd.leases.db3" 
  7. alter your dhcpd rc.d script to launch gluff:
    cat >> /usr/local/etc/rc.d/isc-dhcpd
    sleep 1;
    echo "Restarting Mr. Gluff"
    /usr/local/etc/rc.d/gluff start
    
  8. make a gluff start up script in /usr/local/etc/rc.d/gluff
    #!/bin/sh
    #
    # Custom Monkeybrains 2/03/2010 by amen
    #
    # PROVIDE: gluff
    # REQUIRE: DAEMON
    #
    . /etc/rc.conf
    
    dhcpd_rootdir=${dhcpd_rootdir:-/var/db/dhcpd}
    dhcpd_leasesdb="$dhcpd_rootdir/dhcpd.leases.db3" # sqllite db for gluff integration
    gluff_server="${gluff_server:-10.1.2.3}"
    
    /usr/bin/killall gluff > /dev/null 2> /dev/null
    sleep 1;
    su -m dhcpd -c "/usr/local/bin/gluff -l $dhcpd_leasesdb \
         -h $gluff_server -udhcp_gluff -pYourSekret -ddhcpd_leases -R &"
    

This data is completely accurate.