# This makefile creates ipkgs - nothing else
# We assume that you have recent releases of all of th 
# syslog and util-linux stuff to work from, and that 
# you have copied the relevant files to the local directory.
#
# Specifically, you need a copy of the sysklogd-X source tree
# and the util-linux-2X tree below here.  You don't need to build
# all of util-linux - just the misc-utils will do.
#
# Source for sysklog can be downloaded from:
#    ftp://ftp.ibiblio.org/pub/Linux/system/daemons/
#
# Source for util-linux can be downloaded from:
#    ftp://ftp.win.tue.nl/pub/linux-local/utils/util-linux/

PACKAGE = syslog
VERSION = 1.0
PCKNAME = $(PACKAGE)_$(VERSION)_arm.ipk

SYSDIR  = sysklogd-1.4.1
LOGDIR  = util-linux-2.11h/misc-utils

clean: 
	rm -f *.o *~ $(PCKNAME)

ipkg::
	rm -fr $(PCKNAME)
	mkdir -p ipkg/sbin
	mkdir -p ipkg/usr/bin
	mkdir -p ipkg/etc
	mkdir -p ipkg/etc/init.d
	cp $(SYSDIR)/syslogd ipkg/sbin
	cp $(SYSDIR)/klogd ipkg/sbin
	cp $(LOGDIR)/logger ipkg/usr/bin
	cp syslog ipkg/etc/init.d
	cp syslog.conf ipkg/etc
	chown -R root ipkg

	echo "Package: " $(PACKAGE) > control
	echo "Priority: optional" >> control
	echo "Version: " ${VERSION} >> control
	echo "Architecture: arm" >> control
	echo "Maintainer: Andrew Christian <andrew.christian@compaq.com>" >> control
	echo "Depends: " >> control
	echo "Section: admin" >> control
	echo "Description: System logging (syslog) functions" >> control
	mkdir -p ipkg/CONTROL; mv control ipkg/CONTROL
	echo "#!/bin/sh" > postinst 
	echo "ln -s /etc/init.d/syslog /etc/rc2.d/S30syslog" >> postinst
	chmod agu+rx postinst; mv postinst ipkg/CONTROL
	echo "#!/bin/sh" > postrm 
	echo "rm /etc/rc2.d/S30syslog" >> postrm
	chmod agu+rx postrm; mv postrm ipkg/CONTROL
	ipkg-build ipkg
	rm -fr ipkg


