From c9e8e7f0e09ecbf64b46b7213a5e9547f55abd65 Mon Sep 17 00:00:00 2001 From: Lorenzo Villani Date: Nov 29 2008 17:58:38 +0000 Subject: - 0.7.5 - support for running as system daemon - experimental (not used, yet) logrotate file --- diff --git a/bip-conf.patch b/bip-conf.patch new file mode 100644 index 0000000..ef09db1 --- /dev/null +++ b/bip-conf.patch @@ -0,0 +1,29 @@ +--- samples/bip.conf.orig 2008-05-15 15:45:04.000000000 +0100 ++++ samples/bip.conf 2008-05-15 15:48:43.000000000 +0100 +@@ -9,7 +9,7 @@ + # be sure to set the password to the value + # specified in the network you want to connect to. + # Port is 6667 by default. +-port = 7778; ++#port = 7778; + + # If you set this to true, you'll only be able to connect to bip + # with a SSL capable IRC client. Be sure to generate a certificate +@@ -21,7 +21,7 @@ + #client_side_ssl_pem = "/path/to/pemfile"; + + # Define where the pidfile should be stored. Defaults to /bip.pid +-#pid_file="/var/run/bip/bip.pid"; ++pid_file="/var/run/bip/bip.pid"; + + # Uncomment this line to disable logging and backlogging. + #log = false +@@ -37,7 +37,7 @@ + # This is where logs go. Channel and private messages will use that + # configuration value as a prefix, and then log_format to determine + # full log filename. +-#log_root = "/var/proxy/logs"; ++log_root = "/var/log/bip"; + + # Uncomment this line to disable bip's internal messages logging. + # This is not recommended, a better option is to reduce log_level. diff --git a/bip.init b/bip.init new file mode 100644 index 0000000..d78002b --- /dev/null +++ b/bip.init @@ -0,0 +1,63 @@ +#!/bin/sh +# +# chkconfig: - 92 5 +# description: bip is an IRC proxy server +# + +BIP=/usr/bin/bip + +# Source function library. +. /etc/init.d/functions + +# Source networking configuration. +. /etc/sysconfig/network + +# Check that networking is up. +[ ${NETWORKING} = "no" ] && exit 0 + +RETVAL="0" + +[ -x "$BIP" ] || exit 0 + +# See how we were called. +case "$1" in + start) + echo -n "Starting bip: " + daemon --user=bip $BIP -f /etc/bip.conf + RETVAL=$? + echo + [ $RETVAL -eq 0 ] && touch /var/lock/subsys/bip + ;; + stop) + echo -n "Stopping bip: " + killproc bip + RETVAL=$? + echo + [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/bip + ;; + status) + status bip + RETVAL=$? + ;; + restart) + $0 status >/dev/null && $0 stop + $0 start + RETVAL=$? + ;; + condrestart) + [ -f "/var/lock/subsys/bip" ] && $0 restart || : + RETVAL=$? + echo + ;; + reload) + echo -n "Reloading bip: " + killproc bip -HUP + RETVAL=$? + echo + ;; + *) + echo "Usage: $0 {start|stop|status|restart|reload}" + exit 1 +esac + +exit $RETVAL diff --git a/bip.logrotate b/bip.logrotate new file mode 100644 index 0000000..a542be5 --- /dev/null +++ b/bip.logrotate @@ -0,0 +1,5 @@ +/var/log/bip/* { + yearly + notifempty + missingok +} diff --git a/bip.spec b/bip.spec index 1fe87a9..2eaa8d7 100644 --- a/bip.spec +++ b/bip.spec @@ -1,11 +1,13 @@ Name: bip -Version: 0.7.4 +Version: 0.7.5 Release: 1%{?dist} -Summary: IRC Bouncer +Summary: IRC Bouncer Group: Applications/Internet License: GPLv2+ URL: http://bip.t1r.net Source0: http://bip.t1r.net/downloads/bip-%{version}.tar.gz +Source1: bip.init +Patch0: bip-conf.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRequires: openssl-devel flex byacc autoconf m4 @@ -20,6 +22,7 @@ while you were away. %prep %setup -q +%patch0 -p0 iconv -f iso-8859-1 -t utf-8 -o ChangeLog{.utf8,} mv ChangeLog{.utf8,} @@ -34,22 +37,57 @@ rm -rf $RPM_BUILD_ROOT make install DESTDIR=$RPM_BUILD_ROOT # Remove misplaced files rm -rf $RPM_BUILD_ROOT%{_defaultdocdir}/bip +mkdir -p $RPM_BUILD_ROOT%{_sysconfdir} +# Install bip.conf +install -m 644 samples/bip.conf $RPM_BUILD_ROOT%{_sysconfdir}/bip.conf +# Install initscript +mkdir -p $RPM_BUILD_ROOT%{_initrddir} +install -m755 %{SOURCE1} $RPM_BUILD_ROOT%{_initrddir}/bip +mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/run/bip +mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/log/bip %clean rm -rf $RPM_BUILD_ROOT +%pre +/usr/sbin/useradd -c "Bip IRC Proxy" \ + -s /bin/sh -r -d / bip 2> /dev/null || : + +%post +/sbin/chkconfig --add bip + +%preun +if [ "$1" = 0 ]; then + /sbin/service bip stop >/dev/null 2>&1 || : + /sbin/chkconfig --del bip +fi + +%postun +if [ "$1" -ge 1 ]; then + /sbin/service bip condrestart >/dev/null 2>&1 || : +fi + + %files %defattr(-,root,root,-) %doc AUTHORS ChangeLog COPYING README TODO -%doc samples/bip.conf %doc samples/bip.vim %{_bindir}/bip %{_bindir}/bipmkpw %{_mandir}/man1/bip.1.gz %{_mandir}/man5/bip.conf.5.gz +%config(noreplace) %{_sysconfdir}/bip.conf +%{_initrddir}/bip +%attr(-,bip,bip) %dir %{_localstatedir}/run/bip +%attr(-,bip,bip) %dir %{_localstatedir}/log/bip %changelog +* Sat Nov 29 2008 Lorenzo Villani - 0.7.5-1 +- 0.7.5 +- Added support for running bip as system daemon + (patches from Tom Hughes, thanks! - BugID: 471791) + * Tue Jun 08 2008 Lorenzo Villani - 0.7.4-1 - New version