From d011b8571a333ec8bf704c294303e2bfe71794d8 Mon Sep 17 00:00:00 2001 From: Stefan Sayer Date: Wed, 6 Feb 2008 23:36:53 +0000 Subject: [PATCH] debian package files adapted from ser's git-svn-id: http://svn.berlios.de/svnroot/repos/sems/trunk@685 8eb893ce-cfd4-0310-b710-fb5ebe64c474 --- debian/changelog | 6 + debian/compat | 1 + debian/control | 26 ++++ debian/copyright | 19 +++ debian/files | 2 + debian/postinst | 175 +++++++++++++++++++++++++++ debian/postrm | 13 ++ debian/rules | 149 +++++++++++++++++++++++ debian/sems-python-modules.substvars | 1 + debian/sems.config | 29 +++++ debian/sems.default | 39 ++++++ debian/sems.init | 122 +++++++++++++++++++ debian/sems.substvars | 2 + debian/sems.templates | 41 +++++++ debian/shlibs.local | 0 debian/watch | 7 ++ 16 files changed, 632 insertions(+) create mode 100644 debian/changelog create mode 100644 debian/compat create mode 100644 debian/control create mode 100644 debian/copyright create mode 100644 debian/files create mode 100644 debian/postinst create mode 100644 debian/postrm create mode 100755 debian/rules create mode 100644 debian/sems-python-modules.substvars create mode 100644 debian/sems.config create mode 100644 debian/sems.default create mode 100644 debian/sems.init create mode 100644 debian/sems.substvars create mode 100644 debian/sems.templates create mode 100644 debian/shlibs.local create mode 100644 debian/watch diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 00000000..f7f38bd4 --- /dev/null +++ b/debian/changelog @@ -0,0 +1,6 @@ +sems (1.1.0-1) unstable; urgency=low + + * Initial Debian Release. + + -- Stefan Sayer Thu Feb 7 00:35:27 CET 2008 + diff --git a/debian/compat b/debian/compat new file mode 100644 index 00000000..b8626c4c --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +4 diff --git a/debian/control b/debian/control new file mode 100644 index 00000000..115761e5 --- /dev/null +++ b/debian/control @@ -0,0 +1,26 @@ +Source: sems +Section: net +Priority: optional +Maintainer: Stefan Sayer +Build-Depends: debhelper (>= 4), libspeex-dev, flite-dev +Standards-Version: 3.5.2 + +Package: sems +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends} +Suggests: sems-python-modules +Conflicts: sems-python-modules (<< ${Source-Version}) +Description: SIP Express Media Server, very fast and flexible SIP media server + SEMS, the SIP Express Media Server, is a free, high performance, extensible media + server for SIP (RFC3261) based VoIP services. It features voicemail, conferencing, + announcements, pre-call announcements, prepaid service, calling card service etc. + +Package: sems-python-modules +Architecture: any +Depends: ${shlibs:Depends}, sems (= ${Source-Version}) +Description: contains the python modules for SEMS + This has been split out of the main SEMS package, so that SEMS will not + depend upon python. This module will enable you to use the applications using the embedded + python interpreter and script new applications in python. + + diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 00000000..6af6bae6 --- /dev/null +++ b/debian/copyright @@ -0,0 +1,19 @@ +This package was debianized by Stefan Sayer + on Wed Feb 6 20:46:22 CET 2008. + +All debian stuff was stolen and adapted from SER +(http://iptel.org/ser). + +It was downloaded from http://iptel.org/sems. + +Upstream Authors: Raphael Coeffic , +Stefan Sayer , Juha Heinanen, Maxim +Sobolev, Andreas Granig (see AUTHORS file for details) + +This software is copyright (c) 2002-2005 by FhG Fokus + +You are free to distribute this software under the terms of +the GNU General Public License. + +On Debian systems, the complete text of the GNU General Public +License can be found in the file `/usr/share/common-licenses/GPL. diff --git a/debian/files b/debian/files new file mode 100644 index 00000000..effb949b --- /dev/null +++ b/debian/files @@ -0,0 +1,2 @@ +sems_0.8.7.6-1_i386.deb net optional +sems-python-modules_0.8.7.6-1_i386.deb net optional diff --git a/debian/postinst b/debian/postinst new file mode 100644 index 00000000..56493f72 --- /dev/null +++ b/debian/postinst @@ -0,0 +1,175 @@ +#!/bin/sh + +set -e + +# don't do anything when called with other argument than configure +case "$1" in + configure) + ;; + abort-upgrade|abort-remove|abort-deconfigure) + exit 0 + ;; + *) + echo "postinst called with unknown argument \$1'" >&2 + exit 1 + ;; +esac + +. /usr/share/debconf/confmodule + +# add sems user +adduser --quiet --system --group --disabled-password --shell /bin/false \ +--gecos "SIP Express Media Server" --home /var/run/sems sems || true + +if [ -d /usr/doc -a ! -e /usr/doc/sems -a -d /usr/share/doc/sems ]; then + ln -sf ../share/doc/sems /usr/doc/sems +fi + + +# ser defaults file, which will be modified by this script +DEFAULTFILE=/etc/default/sems + +if ! test -e $DEFAULTFILE; then + echo "Warning: sems postinst script can't find config file $DEFAULTFILE. Configuration aborted." + exit 0 +fi + +# ---------------------------------------------------------------------- + +function fn_config_replace +{ + if test $# -ne 2; then + echo "Error - bad number of input parameters" + echo "usage:" + echo "fn_config_replace config_file CFG_OPTION_something" + exit 1 + fi + + FILENAME="$1" + ITEM="$2" + + echo "Changing config option $ITEM." + OLDFILE="$FILENAME.config_replace_bck" + cp -f $FILENAME $OLDFILE + + REPLACEMENT="$FILENAME.repl" + TEMPFILE="$FILENAME.temp" + TAIL="$FILENAME.tail" + + rm -f $REPLACEMENT + touch $REPLACEMENT # needed if the input is empty + while read -r LINE + do + echo "$LINE" >> $REPLACEMENT + done + + STARTPOS=`nl -b a $FILENAME | grep -w "DEBCONF-$ITEM-START" | sed -e "s/^ *\([0-9]*\).*/\1/g"` + if [ "$STARTPOS" == "" ]; then + echo "WARNING: section $ITEM not found" + return + fi + + ENDPOS=`nl -b a $FILENAME | sed -e "1,${STARTPOS}d" | grep "DEBCONF-$ITEM-END" | head -n 1 | sed -e "s/^ *\([0-9]*\).*/\1/g"` + if [ "$STARTPOS" == "" ]; then + echo "WARNING: end of section $ITEM not found" + return + fi + ENDPOS=$(($ENDPOS-1)) + STARTPOS=$(($STARTPOS+1)) + + cat $FILENAME | sed -e "1,${ENDPOS}d" > $TAIL + cat $FILENAME | sed -e "${STARTPOS},\$d" > $TEMPFILE + cat $REPLACEMENT >> $TEMPFILE + cat $TAIL >> $TEMPFILE + rm -f $TAIL + mv -f $TEMPFILE $FILENAME +} + +# pads $1 with as many empty rows as needed until $2 lines are complete +padLines() { + output="$1" + needed="$2" + num=`echo "$output" | wc -l` + echo "$output" + moreneeded=$(($needed-$num)) + while (true); do + if [ $moreneeded -gt 0 ] + then + echo "" + moreneeded=$(($moreneeded-1)) + else + break + fi + done +} + +#---------------------------------------------------------------------------- + + +db_get sems/config +if [ "$RET" = "false" ] ; then + # do not change config file + echo "Package sems postinstall script: NOT modifying config file $DEFAULTFILE." +else + +BACKUP="$DEFAULTFILE.config_bck" + +echo "Package sems postinstall script: MODIFYING config file $DEFAULTFILE." +echo "Creating backup copy as $BACKUP" +cp -f $DEFAULTFILE $BACKUP + +db_get sems/USER +if test "$RET" != "!" ; then + fn_config_replace $DEFAULTFILE USER <<+++ +SEMS_USER="$RET" ++++ +fi + +db_get sems/GROUP +if test "$RET" != "!" ; then + fn_config_replace $DEFAULTFILE GROUP <<+++ +SEMS_GROUP="$RET" ++++ +fi + +#db_get sems/WORKDIR +#if test "$RET" != "!" ; then +# fn_config_replace $DEFAULTFILE WORKDIR <<+++ +#SEMS_WORKDIR="$RET" +#+++ +#fi + +db_get sems/KERNEL_CORE_PID +if test "$RET" != "!" ; then + fn_config_replace $DEFAULTFILE KERNEL_CORE_PID <<+++ +SEMS_KERNEL_CORE_PID="$RET" ++++ +fi + +fi # if changing config + +echo "" +echo "***" +echo "Configuration of sems has finished." +echo "" +echo "To restart it when configuration has changed use '/etc/init.d/sems restart'" +echo "" +echo "To change it's configuration use 'dpkg-reconfigure sems'" +echo "***" +echo "" + +echo "Setting sems to start automatically" +/usr/sbin/update-rc.d sems defaults || true + + +if [ -x "/etc/init.d/sems" ]; then + if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then + invoke-rc.d sems restart || exit 0 + else + /etc/init.d/sems restart || exit 0 + fi +fi + + +exit 0 + diff --git a/debian/postrm b/debian/postrm new file mode 100644 index 00000000..a879d122 --- /dev/null +++ b/debian/postrm @@ -0,0 +1,13 @@ +#!/bin/sh + +#DEBHELPER# + +if [ "$1" = "purge" ] ; then + # remove user/group on purge + deluser --quiet --remove-home sems &>/dev/null || true + # remove /etc/ser if empty + rmdir /etc/sems || true +fi + +exit 0 + diff --git a/debian/rules b/debian/rules new file mode 100755 index 00000000..f33f8b8e --- /dev/null +++ b/debian/rules @@ -0,0 +1,149 @@ +#!/usr/bin/make -f +# Sample debian/rules that uses debhelper. +# GNU copyright 1997 to 1999 by Joey Hess. +# +# $Id: rules,v 1.7 2007/12/20 14:21:19 paka Exp $ +# +# History: +# -------- +# 2008-02-06 stolen from SER and adapted for SEMS (stefan) + +# Uncomment this to turn on verbose mode. +export DH_VERBOSE=1 + +# This is the debhelper compatibility version to use. +# export DH_COMPAT=4 +# -- already set in compat +# force no striping (always include debug symbols for now) +export DEB_BUILD_OPTIONS:="$(DEB_BUILD_OPTIONS) nostrip" + + + + + +PYTHON_MODULES=ivr py_sems conf_auth mailbox pin_collect + +EXCLUDED_MODULES=mp3 examples + + +ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS))) + CFLAGS += -g +endif +ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS))) + INSTALL_PROGRAM += -s +endif + +configure: configure-stamp +configure-stamp: + dh_testdir + # Add here commands to configure the package. + + touch configure-stamp + +build: build-stamp + +build-stamp: configure-stamp + dh_testdir + +# Add here commands to compile the package. + $(MAKE) cfg-target=/etc/sems/ prefix=/usr +#/usr/bin/docbook-to-man debian/ser.sgml > ser.1 + + touch build-stamp + +clean: + dh_testdir + dh_testroot + rm -f build-stamp configure-stamp + +# Add here commands to clean up after the build process. + + dh_clean + +install: build + dh_testdir + dh_testroot + dh_clean -k + dh_installdirs + +# Add here commands to install the package into debian/sems + $(MAKE) -C core/ install \ + basedir=$(CURDIR)/debian/sems \ + prefix=/usr \ + cfg-prefix=$(CURDIR)/debian/sems \ + cfg-target=/etc/sems/ + + + $(MAKE) -C apps/ install exclude_modules="$(EXCLUDED_MODULES) $(PYTHON_MODULES)" \ + basedir=$(CURDIR)/debian/sems \ + prefix=/usr \ + cfg-prefix=$(CURDIR)/debian/sems \ + cfg-target=/etc/sems/ + +# fix etc/ser dir location +# mv -f $(CURDIR)/debian/ser/usr/etc $(CURDIR)/debian/ser + +# install only the python modules + $(MAKE) -C apps/ install modules="$(PYTHON_MODULES)" \ + basedir=$(CURDIR)/debian/sems-python-modules \ + prefix=/usr \ + cfg-prefix=$(CURDIR)/debian/sems-python-modules \ + cfg-target=/etc/sems/ + +# install /etc/default/sems file + mkdir -p $(CURDIR)/debian/sems/etc/default + cp -f debian/sems.default $(CURDIR)/debian/sems/etc/default/sems +#dh_movefiles + + +# This single target is used to build all the packages, all at once, or +# one at a time. So keep in mind: any options passed to commands here will +# affect _all_ packages. Anything you want to only affect one package +# should be put in another target, such as the install target. +binary-common: + dh_testdir + dh_testroot + dh_installdebconf + dh_installdocs + dh_installexamples + dh_installmenu +# dh_installlogrotate +# dh_installemacsen +# dh_installpam +# dh_installmime + dh_installinit -- defaults 23 + dh_installcron + dh_installman + dh_installinfo +# dh_undocumented + dh_installchangelogs + dh_link + dh_strip + dh_compress + dh_fixperms +# dh_makeshlibs + dh_installdeb +# dh_perl + dh_shlibdeps + dh_gencontrol + dh_md5sums + dh_builddeb + +# Build architecture-independent packages using the common target +binary-indep: build install +# (Uncomment this next line if you have such packages.) +# $(MAKE) -f debian/rules DH_OPTIONS=-i binary-common +# We have nothing to do by default. + + +# Build architecture-dependent packages using the common target +binary-arch: build install + $(MAKE) -f debian/rules DH_OPTIONS=-a binary-common + +# Any other binary targets build just one binary package at a time. +binary-%: build install + $(MAKE) -f debian/rules binary-common DH_OPTIONS=-p$* + +binary: binary-indep binary-arch +.PHONY: build clean binary-indep binary-arch binary install configure + diff --git a/debian/sems-python-modules.substvars b/debian/sems-python-modules.substvars new file mode 100644 index 00000000..f28bc387 --- /dev/null +++ b/debian/sems-python-modules.substvars @@ -0,0 +1 @@ +shlibs:Depends=libc6 (>= 2.3.2.ds1-21), libflite1, libgcc1 (>= 1:3.4.1-3), python2.3 (>= 2.3) diff --git a/debian/sems.config b/debian/sems.config new file mode 100644 index 00000000..4318e3ec --- /dev/null +++ b/debian/sems.config @@ -0,0 +1,29 @@ +#!/bin/sh -e + +. /usr/share/debconf/confmodule + +# configure ? +db_input medium sems/config || true +db_go + +db_get sems/config + +if [ "$RET" = "false" ]; then + exit 0 +fi + +db_input medium sems/USER || true +db_go + +db_input medium sems/GROUP || true +db_go + +#db_input medium sems/WORKDIR || true +#db_go + +db_input medium sems/KERNEL_CORE_PID || true +db_go + +db_input medium sems/MEMORY || true +db_go + diff --git a/debian/sems.default b/debian/sems.default new file mode 100644 index 00000000..a487bccb --- /dev/null +++ b/debian/sems.default @@ -0,0 +1,39 @@ +# configuration for SEMS - SIP Express Media Server +# +# this file is sourced by SEMS init script /etc/init.d/sems + +# Note: the #DEBCONF-xxx-START and DEBCONF-xxx-END lines are used for +# debconf configuration, please don't remove or alter them. + +# ser configuration file +#DEBCONF-CFG_FILE-START +SEMS_CFG_FILE="/etc/sems/sems.conf" +#DEBCONF-CFG_FILE-END + +# user to run ser as +#DEBCONF-USER-START +SEMS_USER="sems" +#DEBCONF-USER-END + +# group to run ser as +#DEBCONF-GROUP-START +SEMS_GROUP="sems" +#DEBCONF-GROUP-END + +# ser pidfile +SEMS_PIDFILE="/var/run/sems/sems.pid" + +# working dir (cores will be placed there in case of sems crash) +#DEBCONF-WORKDIR-START +#SEMS_WORKDIR="/var/cores" +#DEBCONF-WORKDIR-END + +# set if you want kernel flag to use pid for core files +#DEBCONF-KERNEL_CORE_PID-START +#SEMS_KERNEL_CORE_PID="yes" +#DEBCONF-KERNEL_CORE_PID-END + + + + + diff --git a/debian/sems.init b/debian/sems.init new file mode 100644 index 00000000..53e43408 --- /dev/null +++ b/debian/sems.init @@ -0,0 +1,122 @@ +#! /bin/sh +# +# skeleton example file to build /etc/init.d/ scripts. +# This file should be used to construct scripts for /etc/init.d. +# +# Written by Miquel van Smoorenburg . +# Modified for Debian GNU/Linux +# by Ian Murdock . +# +# Version: @(#)skeleton 1.8 03-Mar-1998 miquels@cistron.nl +# +# adapted for ser by Andrei Pelinescu-Onciul +# $Id: ser.init,v 1.3 2007/11/05 15:33:12 paka Exp $ + +# read configuration from /etc/default/sems file +if test -f /etc/default/sems ; then + . /etc/default/sems +fi + +PATH=/sbin:/bin:/usr/sbin:/usr/bin +DAEMON=/usr/sbin/sems +NAME=sems +DESC=sems + +PARAMS="" + +if test "$SEMS_PIDFILE" ; then + PARAMS="$PARAMS -P $SEMS_PIDFILE" +fi + +if test "$SEMS_USER" ; then + PARAMS="$PARAMS -u $SEMS_USER" +fi + +if test "$SEMS_GROUP" ; then + PARAMS="$PARAMS -g $SEMS_GROUP" +fi + +if test "$SEMS_CFG_FILE" ; then + PARAMS="$PARAMS -f $SEMS_CFG_FILE" + CFGPARAMS="-f $SEMS_CFG_FILE" +fi + +#if test "$SEMS_WORKDIR" ; then +# PARAMS="$PARAMS -w $SEMS_WORKDIR" +# # try to create the working dir +# mkdir -p $SEMS_WORKDIR || echo "Warning: error creating SEMS working dir $SEMS_WORKDIR" +#fi + +if test "$SEMS_KERNEL_CORE_PID" = "true" ; then + # enable using pid for cores + echo 1 > /proc/sys/kernel/core_uses_pid || echo "Warning: error when enabling /proc/sys/kernel/core_uses_pid" +fi + +if ! test -f $DAEMON ; then + echo "Error: cannot find $DAEMON" + exit 0 +fi + +LD_LIBRARY_PATH=/usr/lib/sems +export LD_LIBRARY_PATH + +set -e + +case "$1" in + start) + echo -n "Starting $DESC: $NAME" + start-stop-daemon --start --quiet --pidfile $SEMS_PIDFILE \ + --exec $DAEMON -- $PARAMS + echo "." + ;; + stop) + echo -n "Stopping $DESC: $NAME" + start-stop-daemon --oknodo --stop --quiet --pidfile $SEMS_PIDFILE \ + --exec $DAEMON + echo "." + ;; + #reload) + # + # If the daemon can reload its config files on the fly + # for example by sending it SIGHUP, do it here. + # + # If the daemon responds to changes in its config file + # directly anyway, make this a do-nothing entry. + # + # echo "Reloading $DESC configuration files." + # start-stop-daemon --stop --signal 1 --quiet --pidfile \ + # $SEMS_PIDFILE --exec $DAEMON + #;; + restart|force-reload) + # + # If the "reload" option is implemented, move the "force-reload" + # option to the "reload" entry above. If not, "force-reload" is + # just the same as "restart". + # + # Check if configuration is valid before restarting the server + #(($DAEMON $CFGPARAMS -c 2>&1) | grep "config file ok, exiting") > /dev/null + #if [ $? -ne 0 ]; then + # ($DAEMON $CFGPARAMS -c 2>&1) + # echo -e "\nThere are errors in the configuration file. Please fix them first" + # echo -e "\n$out\n" + # exit 0 + #fi + + echo -n "Restarting $DESC: $NAME" + start-stop-daemon --oknodo --stop --quiet --pidfile \ + $SEMS_PIDFILE --exec $DAEMON + sleep 1 + start-stop-daemon --start --quiet --pidfile \ + $SEMS_PIDFILE --exec $DAEMON -- $PARAMS + echo "." + ;; + *) + N=/etc/init.d/$NAME + # echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2 + echo "Usage: $N {start|stop|restart|force-reload}" >&2 + exit 1 + ;; +esac + +exit 0 + diff --git a/debian/sems.substvars b/debian/sems.substvars new file mode 100644 index 00000000..ffb319ff --- /dev/null +++ b/debian/sems.substvars @@ -0,0 +1,2 @@ +misc:Depends=debconf (>= 0.5) | debconf-2.0 +shlibs:Depends=libc6 (>= 2.3.2.ds1-21), libgcc1 (>= 1:3.4.1-3), libspeex1, libstdc++6 (>= 3.4.3-1) diff --git a/debian/sems.templates b/debian/sems.templates new file mode 100644 index 00000000..341ca9d9 --- /dev/null +++ b/debian/sems.templates @@ -0,0 +1,41 @@ +Template: sems/config +Type: boolean +Default: false +Description: Change config file now ? + You have now opportunity to modify basic configuration values in '/etc/default/sems' + config file for SEMS Sip Express Media Server, installed from 'sems' package. Settings from this + file are used by SEMS init script when it is started - e.g. size of shared memory used, + usems and group to run as, working directory. + . + If you do not want to modify the config file now you can modify it manually later, + or repeat this configuartion by running "dpkg-reconfigure sems". + . + Note: if you choose 'yes' here then the values you enter will be automatically applied + each time the sems package is upgraded (or installed without purging previous installation). + +Template: sems/USER +Type: string +Default: sems +Description: User to run SEMS as + Set the user which SEMS should run as. Default is 'sems' user. + . + Note: if you want sems to be able to dump a core file in case of crash, you have to run it as root user. + . + Enter "!" to not modify this option. + +Template: sems/GROUP +Type: string +Default: sems +Description: Group to run SEMS as + Set the group which SEMS should run as. Default is 'sems' group. + . + Enter "!" to not modify this option. + +Template: sems/KERNEL_CORE_PID +Type: boolean +Default: false +Description: Set kernel to use pid for core files + If enabled the '/proc/sys/kernel/core_uses_pid' will be set to '1' before starting SEMS, + to enable using of pid for core files creation. If disabled nothing will be set. + For debugging purposes it is recommended to enable this option. + diff --git a/debian/shlibs.local b/debian/shlibs.local new file mode 100644 index 00000000..e69de29b diff --git a/debian/watch b/debian/watch new file mode 100644 index 00000000..0b49c6ef --- /dev/null +++ b/debian/watch @@ -0,0 +1,7 @@ +# Example watch control file for uscan +# Rename this file to "watch" and then you can run the "uscan" command +# to check for upstream updates and more. +version=2 + +# Site Directory Pattern Version Script +ftp://ftp.berlios.de/pub/sems/latest/src/sems-(.*)_src\.tar\.gz debian uupdate