rpms/kannel/devel kannel.conf, NONE, 1.1 kannel.init, NONE, 1.1 kannel.logrotate, NONE, 1.1 kannel.spec, 1.7, 1.8

Matthias Saou (thias) fedora-extras-commits at redhat.com
Thu Nov 17 12:25:56 UTC 2005


Author: thias

Update of /cvs/extras/rpms/kannel/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv6060

Modified Files:
	kannel.spec 
Added Files:
	kannel.conf kannel.init kannel.logrotate 
Log Message:
Package improvements (init script, default config, logrotate) and rebuild for latest openssl update.



--- NEW FILE kannel.conf ---
# Default kannel configuration file
group = core
admin-port = 13000
admin-password = changemenow
status-password = changemetoo
admin-deny-ip = "*.*.*.*"
admin-allow-ip = "127.0.0.1"
#smsbox-port = 13001
#wapbox-port = 13002
box-deny-ip = "*.*.*.*"
box-allow-ip = "127.0.0.1"
wdp-interface-name = "*"
log-file = "/var/log/kannel/bearerbox.log"
log-level = 1


--- NEW FILE kannel.init ---
#!/bin/sh
#
# kannel	This script takes care of starting and stopping the kannel \
#		WAP gateway services (bearer/wap/smsbox).
# chkconfig: - 97 03
# description:  The Kannel WAP and SMS gateway services
# config: /etc/kannel.conf

# Use start-stop-kannel
prog="/usr/sbin/start-stop-kannel"
args="--start --background --chuid kannel:kannel --exec "
config="/etc/kannel.conf"

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

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

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

[ -f $config ] || exit 1

RETVAL=0
RETVAL_BEARER=0
RETVAL_WAP=0
RETVAL_SMS=0

start() {
        # Start daemons.
        echo -n "Starting kannel bearer box: "
	daemon $prog $args /usr/sbin/bearerbox $config
	RETVAL_BEARER=$?
	echo

	# Starting wap and sms only makes sense if bearerbox is running
	if [ $RETVAL_BEARER -eq 0 ]; then
	  if grep "^group = wapbox" $config &>/dev/null; then
	    echo -n "Starting kannel wap box: "
	    daemon $prog $args /usr/sbin/wapbox $config
	    RETVAL_WAP=$?
	    echo
	  fi
	  if grep "^group = smsbox" $config &>/dev/null; then
	    echo -n "Starting kannel sms box: "
	    daemon $prog $args /usr/sbin/smsbox $config
	    RETVAL_SMS=$?
	    echo
	  fi
	fi
 	[ $RETVAL_BEARER -eq 0 -a $RETVAL_WAP -eq 0 -a $RETVAL_SMS -eq 0 ] \
	  && touch /var/lock/subsys/kannel || RETVAL=1
}

stop() {
        # Stop daemons.
	if grep "^group = smsbox" $config &>/dev/null; then
	  echo -n "Shutting down kannel sms box: "
	  killproc /usr/sbin/smsbox
	  RETVAL_SMS=$?
	  echo
	fi
	if grep "^group = wapbox" $config &>/dev/null; then
	  echo -n "Shutting down kannel wap box: "
	  killproc /usr/sbin/wapbox
	  RETVAL_WAP=$?
	  echo
	fi
	echo -n "Shutting down kannel bearer box: "
        killproc /usr/sbin/bearerbox
	RETVAL_BEARER=$?
	echo
	[ $RETVAL_BEARER -eq 0 -a $RETVAL_WAP -eq 0 -a $RETVAL_SMS -eq 0 ] \
	  || RETVAL=1
	rm -f /var/lock/subsys/kannel
}

# See how we were called.
case "$1" in
  start)
	start
        ;;
  stop)
	stop
        ;;
  status)
	status /usr/sbin/bearerbox
	RETVAL_BEARER=$?
	if grep "^group = wapbox" $config &>/dev/null; then
	  status /usr/sbin/wapbox
	  RETVAL_WAP=$?
	fi
	if grep "^group = smsbox" $config &>/dev/null; then
	  status /usr/sbin/smsbox
	  RETVAL_SMS=$?
	fi
	[ $RETVAL_BEARER -eq 0 -a $RETVAL_WAP -eq 0 -a $RETVAL_SMS -eq 0 ] \
	  || RETVAL=1
	;;
  restart)
	stop
	start
	;;  
  *)
        echo $"Usage: $0 {start|stop|restart|status}"
        RETVAL=1
esac

exit $RETVAL



--- NEW FILE kannel.logrotate ---
/var/log/kannel/*.log {
    compress
    missingok
    notifempty
    create 640 kannel kannel
    sharedscripts
    postrotate
        /usr/bin/killall -HUP bearerbox smsbox wapbox 2>/dev/null || true
    endscript
}


Index: kannel.spec
===================================================================
RCS file: /cvs/extras/rpms/kannel/devel/kannel.spec,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- kannel.spec	25 May 2005 23:50:47 -0000	1.7
+++ kannel.spec	17 Nov 2005 12:25:54 -0000	1.8
@@ -1,12 +1,14 @@
 Summary: WAP and SMS gateway
 Name: kannel
 Version: 1.4.0
-Release: 5
-
+Release: 6
 License: Kannel
 Group: System Environment/Daemons
 URL: http://www.kannel.org/
-Source: http://www.kannel.org/download/%{version}/gateway-%{version}.tar.bz2
+Source0: http://www.kannel.org/download/%{version}/gateway-%{version}.tar.bz2
+Source1: kannel.logrotate
+Source2: kannel.init
+Source3: kannel.conf
 Patch: kannel-1.4.0-depend.patch
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
 BuildRequires: bison, byacc, flex, ImageMagick
@@ -51,6 +53,7 @@
 %build
 %configure \
     --enable-start-stop-daemon \
+    --enable-pcre \
     --with-sqlite
 %{__make} %{?_smp_mflags}
 
@@ -58,35 +61,56 @@
 %install
 %{__rm} -rf %{buildroot}
 %makeinstall
+# Install fakesmsc and fakewap, useful for monitoring
+%{__install} -m 0755 test/{fakesmsc,fakewap} %{buildroot}%{_bindir}/
+# Logrotate entry
+%{__install} -D -m 0644 %{SOURCE1} %{buildroot}%{_sysconfdir}/logrotate.d/kannel
+# Init script
+%{__install} -D -m 0755 %{SOURCE2} %{buildroot}%{_sysconfdir}/rc.d/init.d/kannel
+# Default configuration file
+%{__install} -D -m 0640 %{SOURCE3} %{buildroot}%{_sysconfdir}/kannel.conf
+# Empty log directory
+%{__mkdir_p} %{buildroot}%{_var}/log/kannel/
+# Rename start-stop-daemon to start-stop-kannel
+%{__mv} %{buildroot}%{_sbindir}/start-stop-daemon \
+        %{buildroot}%{_sbindir}/start-stop-kannel
 
 
 %clean
 %{__rm} -rf %{buildroot}
 
 
-#post
-#if [ $1 -eq 1 ]; then
-#   /sbin/chkconfig --add foobar
-#fi
-
-#preun
-#if [ $1 -eq 0 ]; then
-#   /sbin/service foobar stop >/dev/null 2>&1 || :
-#   /sbin/chkconfig --del foobar
-#fi
-
-#postun
-#if [ $1 -ge 1 ]; then
-#   /sbin/service foobar condrestart >/dev/null 2>&1 || :
-#fi
+%pre
+# Create system account
+/usr/sbin/useradd -c "Kannel WAP and SMS gateway" -r -M -s '' \
+    -d %{_var}/lib/kannel kannel &>/dev/null || :
+
+%post
+/sbin/chkconfig --add kannel
+
+%preun
+if [ $1 -eq 0 ]; then
+    # Last removal, stop service and remove it
+    /sbin/service kannel stop &>/dev/null || :
+    /sbin/chkconfig --del kannel
+fi
+
+%postun
+if [ $1 -ge 1 ]; then
+    /sbin/service kannel condrestart &>/dev/null || :
+fi
 
 
 %files
 %defattr(-, root, root, 0755)
 %doc AUTHORS COPYING ChangeLog NEWS README STATUS
+%attr(0640, kannel, kannel) %config(noreplace) %{_sysconfdir}/kannel.conf
+%config(noreplace) %{_sysconfdir}/logrotate.d/kannel
+%config %{_sysconfdir}/rc.d/init.d/kannel
 %{_bindir}/*
 %{_sbindir}/*
 %{_mandir}/man?/*
+%attr(0750, kannel, kannel) %dir %{_var}/log/kannel/
 
 
 %files devel
@@ -97,6 +121,15 @@
 
 
 %changelog
+* Thu Nov 17 2005 Matthias Saou <http://freshrpms.net/> 1.4.0-6
+- Rebuild on FC-5 devel for new openssl library.
+- Enable pcre.
+- Include at last my pending improvements (detail below).
+- Include (at last!) user creation, logrotate entry and init script.
+- Include default configuration file (do nothing, access only from 127.0.0.1).
+- Include empty log directory.
+- Include fakesmsc and fakewap programs, useful for monitoring purposes.
+
 * Wed May 25 2005 Jeremy Katz <katzj at redhat.com> - 1.4.0-5
 - rebuild with change to depend on sqlite2 (#156229)
 




More information about the fedora-extras-commits mailing list