[Pkg-ulog-acctd-general] submit patches

Amin Azez azez at ufomechanic.net
Tue Oct 18 13:36:04 UTC 2005


Here is a redhat-style .spec file for ulogd which permits easy building
of rpm and .srp.rpm packages

It currently depends on the debian patch as one of it's source files, as
it pulls its sample config files from the debian/ folder

This means the .spec is mostly useful in this context:

1) put the two release source file (not the dsc) in the redhat source dir
2) rpmbuild -bs ulog-acct.spec
and out pops a src.rpm which can also be released

as part of the current release process.

Manually, dowload the patch.gz and orig.tar.gz files and .spec file, and
then follow steps 1,2 above.


[The redhat-style init script is embedded in the spec file which is
probably the best place for it until some formal way of tainting the
source with distro-specific files is devised. Maybe it should be under
contrib/rh, or maybe just rh ?]


I'm also about to submit more patches which log the physical device
packets traverse on, useful when %i and %o are a bridge and it would be
nice to know what the real interfaces were.

Azez
-------------- next part --------------
Name: ulog-acctd
Summary: ulog-acctd is a userspace network accounting daemon which collects headers of IP packets that travel through the Linux 2.4+ Netfilter. It logs aggregated accounting records that consist of source/dest, ports, byte/packet counter, interfaces, protocol.
Version: 0.4.3
Release: 1

Source: ulog-acctd_%{version}.orig.tar.gz
Patch: ulog-acctd_%{version}-1.diff.gz

Vendor: DBAM Systems Ltd
Group: net
URL: ulog-acctd_0.4.3-1.diff.gz
BuildRoot: %{_tmppath}/%{name}-buildroot
License: GPL2
Requires(post,postun): chkconfig
Prefix: %{_prefix}

%description
Accounting daemon for Linux 2.4+ netfilter
 This program collects headers of IP packets that travel through the
 Linux 2.4+ netfilter.
 .
 It writes accounting information to a log which can include protocol
 type, source/destination address, port information, byte and packet
 count, incoming/outgoing network interfaces.
 .
 Records in the accounting logfile are freely configurable via a
 format string, for example it is possible to mimic the output format
 of Cisco's "ip accounting output-packets" or to generate SQL
 statements that can be fed directly into a DBMS.

%prep
rm -rf %{buildroot}

%setup -c -q
%patch -b .predeb

%build
cd ulog-acctd-0.4.3.orig

cd src
make
cd ..

cd doc
make
cd ..

cat >init.d <<'INITD' ### ======= Redhat INIT SCRIPT HERE ====== ###
#! /bin/sh
# chkconfig: 345 09 09
# description: Userspace netfilter accounting daemon
# processname: ulog-acctd 
# config: /etc/ulog-acctd
# pidfile: /var/run/ulog-acctd.pid

PATH=/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/sbin/ulog-acctd
NAME=ulog-acctd
DESC="ulog-acctd net accounting daemon"

prog="$NAME"

# Source function library.
. /etc/init.d/functions

# Source networking configuration.
. /etc/sysconfig/network

# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0

test -x $DAEMON || exit 0

set -e

start() {
        echo -n "Starting $DESC: $NAME"
	daemon $DAEMON
	RETVAL=$?
        echo
	return $RETVAL
}

stop() {
        echo -n "Stopping $DESC: $NAME"
	killproc "$DAEMON" -TERM
	RETVAL=$?
        echo
	return $RETVAL
}

case "$1" in
  start) start;;
  stop) stop;;
  reload|force-reload|restart)
	stop
	start
	RETVAL=$?;;
  *)
        N=/etc/init.d/$NAME
        echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2
        exit 1
        ;;
esac

exit 0
INITD
chmod +x init.d

%install
cd ulog-acctd-0.4.3.orig

for dir in /etc/init.d /etc/logrotate.d /usr/sbin /usr/man/man8 /var/log/ulog-acctd /usr/share/info
do 
  mkdir -p %{buildroot}/$dir
done

cp init.d %{buildroot}/etc/init.d/ulog-acctd
cp debian/logrotate %{buildroot}/etc/logrotate.d/ulog-acctd
cp src/ulog-acctd %{buildroot}/usr/sbin/
cp src/ulog-acctd.conf %{buildroot}/etc/
cp doc/ulog-acctd.8 %{buildroot}/usr/man/man8/
cp doc/ulog-acctd.info %{buildroot}/usr/share/info/

%post
chkconfig --add ulog-acctd
/etc/init.d/ulog-acctd restart

%preun
if [ $1 = 0 ]; then
  /etc/init.d/ulog-acctd stop
  chkconfig --del ulog-acctd
fi

%postun
if [ "$1" -ge "1" ]; then
  /etc/init.d/ulog-acctd restart
fi

%clean
rm -rf $RPM_BUILD_ROOT 

%files
%defattr(-,root,root,0755)
/etc/init.d/ulog-acctd
/etc/logrotate.d/ulog-acctd
/usr/sbin/ulog-acctd
/etc/ulog-acctd.conf
/usr/man/man8/
/var/log/ulog-acctd/
/usr/share/info/

%doc ulog-acctd-0.4.3.orig/doc/ulog-acctd.html

%changelog
* Tue Oct 18 2005 Sam Liddicott
- First cut


More information about the Pkg-ulog-acctd-general mailing list