diff -r 3be96a4c8c18 -r f29abea29121 asterisk/asterisk.spec --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/asterisk/asterisk.spec Mon Apr 27 12:19:05 2009 +0200 @@ -0,0 +1,544 @@ +## +## asterisk.spec -- OpenPKG RPM Package Specification +## Copyright (c) 2000-2007 OpenPKG Foundation e.V. +## Copyright (c) 2000-2007 Ralf S. Engelschall +## +## Permission to use, copy, modify, and distribute this software for +## any purpose with or without fee is hereby granted, provided that +## the above copyright notice and this permission notice appear in all +## copies. +## +## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED +## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR +## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF +## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT +## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +## SUCH DAMAGE. +## + +# package component versions +%define V_langsounds 1.4.12 +%define V_extrasounds 1.4.9 +%define V_amoomasounds 1.4 +%define V_customsounds 1.0 +%define V_chan_capi 1.1.2 + +# package information +Name: asterisk +Summary: Private Branch Exchange (PBX) for VoIP +URL: http://www.asterisk.org/ +Vendor: Mark Spencer et al. +Packager: Michael Schloh von Bennewitz +Distribution: Michael Schloh von Bennewitz +Class: EVAL +Group: VoIP +License: GPL +Version: 1.4.24.1 +Release: 20090422 + +# package options +%option with_libpri yes +%option with_xfersips yes +%option with_proxymwi yes +%option with_parseavp yes +%option with_radius no +%option with_sqlite no +%option with_pgsql no +%option with_curl no +%option with_imap no +%option with_astman no +%option with_capi no +%option with_zaptel no +%option with_smdipoll 10 + +# list of sources +Source0: http://downloads.digium.com/pub/asterisk/releases/asterisk-%{version}.tar.gz +Source1: ftp://ftp.chan-capi.org/chan-capi/chan_capi-%{V_chan_capi}.tar.gz +Source2: http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-moh-freeplay-alaw.tar.gz +Source3: http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-moh-freeplay-g722.tar.gz +Source4: http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-moh-freeplay-g729.tar.gz +Source5: http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-moh-freeplay-gsm.tar.gz +Source6: http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-moh-freeplay-ulaw.tar.gz +Source7: http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-extra-sounds-en-alaw-%{V_extrasounds}.tar.gz +Source8: http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-extra-sounds-en-g722-%{V_extrasounds}.tar.gz +Source9: http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-extra-sounds-en-g729-%{V_extrasounds}.tar.gz +Source10: http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-extra-sounds-en-gsm-%{V_extrasounds}.tar.gz +Source11: http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-extra-sounds-en-ulaw-%{V_extrasounds}.tar.gz +Source12: http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-core-sounds-en-alaw-%{V_langsounds}.tar.gz +Source13: http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-core-sounds-en-g722-%{V_langsounds}.tar.gz +Source14: http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-core-sounds-en-g729-%{V_langsounds}.tar.gz +Source15: http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-core-sounds-en-gsm-%{V_langsounds}.tar.gz +Source16: http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-core-sounds-en-ulaw-%{V_langsounds}.tar.gz +Source17: http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-core-sounds-es-alaw-%{V_langsounds}.tar.gz +Source18: http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-core-sounds-es-g722-%{V_langsounds}.tar.gz +Source19: http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-core-sounds-es-g729-%{V_langsounds}.tar.gz +Source20: http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-core-sounds-es-gsm-%{V_langsounds}.tar.gz +Source21: http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-core-sounds-es-ulaw-%{V_langsounds}.tar.gz +Source22: http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-core-sounds-fr-alaw-%{V_langsounds}.tar.gz +Source23: http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-core-sounds-fr-g722-%{V_langsounds}.tar.gz +Source24: http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-core-sounds-fr-g729-%{V_langsounds}.tar.gz +Source25: http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-core-sounds-fr-gsm-%{V_langsounds}.tar.gz +Source26: http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-core-sounds-fr-ulaw-%{V_langsounds}.tar.gz +Source27: http://www.amooma.de/asterisk/sprachbausteine/asterisk-%{V_amoomasounds}-de-prompts.tar.gz +Source28: http://www.amooma.de/asterisk/sprachbausteine/asterisk-core-sounds-de-gsm-current.tar.gz +Source29: ftp://ftp.europalab.com/pub/sfw/machsnds/de-digits/de-digits-%{V_customsounds}.tar.bz2 +Source30: asterisk.conf +Source31: amd.conf +Source32: capi.conf +Source33: cdr.conf +Source34: cdr_custom.conf +Source35: codecs.conf +Source36: dundi.conf +Source37: enum.conf +Source38: extensions.conf +Source39: features.conf +Source40: festival.conf +Source41: followme.conf +Source42: indications.conf +Source33: logger.conf +Source34: manager.conf +Source45: meetme.conf +Source46: misdn.conf +Source47: modules.conf +Source48: musiconhold.conf +Source49: privacy.conf +Source50: rpt.conf +Source51: rtp.conf +Source52: say.conf +Source53: sip.conf +Source54: sip_notify.conf +Source55: sla.conf +Source56: voicemail.conf +Source57: zapata.conf +Source58: rc.asterisk +Source59: wakeup.agi +Patch0: asterisk.patch +Patch1: asterisk.patch.xfersips +Patch2: asterisk.patch.proxymwi +Patch3: asterisk.patch.parseavp + +# build information +Prefix: %{l_prefix} +BuildRoot: %{l_buildroot} +BuildPreReq: OpenPKG, openpkg >= 20040130, pkgconfig, awk, grep +PreReq: OpenPKG, openpkg >= 20040130 +BuildPreReq: ncurses, openssl, zlib +PreReq: ncurses, openssl, zlib +BuildPreReq: speex, vorbis-libs, sox +PreReq: speex, vorbis-libs, sox +%if "%{with_libpri}" == "yes" +BuildPreReq: libpri +PreReq: libpri +%endif +%if "%{with_radius}" == "yes" +BuildPreReq: radiusclient +PreReq: radiusclient +%endif +%if "%{with_sqlite}" == "yes" +BuildPreReq: sqlite +PreReq: sqlite +%endif +%if "%{with_pgsql}" == "yes" +BuildPreReq: postgresql +PreReq: postgresql +%endif +%if "%{with_curl}" == "yes" +BuildPreReq: curl +PreReq: curl +%endif +%if "%{with_imap}" == "yes" +BuildPreReq: imap +PreReq: imap +%endif +%if "%{with_astman}" == "yes" +BuildPreReq: newt +PreReq: newt +%endif +AutoReq: no +AutoReqProv: no + +%description + Asterisk is a complete Private Branch Exchange (PBX) in software. + It provides all of the features you would expect from a PBX and + more. Asterisk does Voice over IP (VoIP) in many protocols. Asterisk + provides Voicemail services with Directory, Call Conferencing, + Interactive Voice Response and Call Queuing. It has support for + three-way calling, caller ID services, ADSI, SIP, etc. Asterisk + needs no additional hardware for VoIP. + + This copy of Asterisk is optionally patched to allow the asterisk + server to respond to SIP/TLS transfer requests using the Transfer() + application. Should this option be chosen, the asterisk server + successfully dispatches all transfer destinations using 'SIPS' + technology by means of the standard SIP/2.0 302 Moved Temporarily + message, with a URI resembling . + + This copy of Asterisk is optionally patched as well to enclose the + correct user name in NOTIFY messages when MWI logic detects changes + in the state of Messages-Waiting. Asterisk will send NOTIFY messages + with the URI 'user@hostname' instead of simply 'hostname'. This can + be used by a external SIP proxy to route the MWI to the correct phone. + +%track + prog asterisk = { + version = %{version} + url = http://downloads.digium.com/pub/asterisk/releases/ + regex = asterisk-(__VER__)\.tar\.gz + } + +%prep + %setup -q -n asterisk-%{version} + %setup -q -n asterisk-%{version} -D -T -a 1 + %patch -p0 +%if "%{with_xfersips}" == "yes" + %patch -p0 -P 1 +%endif +%if "%{with_proxymwi}" == "yes" + %patch -p0 -P 2 +%endif +%if "%{with_parseavp}" == "yes" + %patch -p0 -P 3 +%endif + + # link install-sh to where Makefiles expect it + for dir in agi utils res channels pbx apps codecs formats cdr funcs main; do + ( cd $dir && ln -s ../install-sh ) || exit $? + done + + # apply corrections + case "%{l_platform -t}" in + *-sunos* ) + %{l_shtool} subst \ + -e 's|\(tmp->tm_gmtoff = ttisp->tt_gmtoff;\)|/*\1*/|' \ + main/stdtime/localtime.c + ;; + esac + %{l_shtool} subst \ + -e 's;sysconfdir=/etc;true;' \ + -e 's;mandir=/usr/share/man;true;' \ + -e 's;localstatedir=/var;true;' \ + -e 's;\(radiusclient\)-ng;\1;g' \ + -e 's;\(\-lsqlite\);\13;g' \ + -e 's;\(sqlite\)\(\.h\);\13\2;g' \ + -e 's;\(sqlite\)\(_exec\);\13\2;g' \ + -e 's;^\(LIBS="-lvorbis\);\1 ${OGG_LIB};' \ + -e 's;\(#include <\${NCURSES_DIR}/include\);\1/ncurses;' \ + -e 's;-I${IMAP_TK_DIR}/c-client;-I${IMAP_TK_DIR}/include/imap;g' \ + -e 's;${IMAP_TK_DIR}/c-client/c-client\.a;-limap -lssl -lcrypto -lcrypt;g' \ + configure + %{l_shtool} subst \ + -e 's; *-I/usr/local/ssl/include;;g' \ + -e 's;/opt/ssl/include;%{l_prefix}/include;g' \ + -e 's;/usr/local;%{l_prefix};g' \ + -e 's;^\(MOD_SUBDIR_CFLAGS=.*\ *\)$;\1 -I%{l_prefix}/include;' \ + -e 's;^\( *ASTETCDIR\)=.*;\1=$(sysconfdir)/asterisk;g' \ + -e 's;^\( *ASTLIBDIR\)=.*;\1=$(libdir)/asterisk;g' \ + -e 's;^\( *ASTHEADERDIR\)=.*;\1=$(includedir)/asterisk;g' \ + -e 's;^\( *ASTBINDIR\)=.*;\1=$(bindir);g' \ + -e 's;^\( *ASTSBINDIR\)=.*;\1=$(sbindir);g' \ + -e 's;^\( *ASTSPOOLDIR\)=.*;\1=$(localstatedir)/asterisk/spool;g' \ + -e 's;^\( *ASTLOGDIR\)=.*;\1=$(localstatedir)/asterisk/log;g' \ + -e 's;^\( *ASTVARRUNDIR\)=.*;\1=$(localstatedir)/asterisk/run;g' \ + -e 's;^\( *ASTMANDIR\)=.*;\1=$(mandir);g' \ + -e 's;^\( *ASTVARLIBDIR\)=.*;\1=$(localstatedir)/asterisk/lib;g' \ + -e 's;^\( *ASTVARRUNDIR\)=.*;\1=$(localstatedir)/asterisk/run;g' \ + -e 's;^\( *ASTDATADIR\):*=.*;\1=$(datadir)/asterisk;g' \ + -e 's/\(for f in\) \(\$(OLDMODS); do \\\)$/\1 "warning:" \2/' \ + Makefile + #-e 's;\(ASTSPOOLDIR=\$(localstatedir)\)\(/spool\)\(/asterisk\);\1\3\2;' \ + #-e 's;\(ASTLOGDIR=\$(localstatedir)\)\(/log\)\(/asterisk\);\1\3\2;' \ + #-e 's;\(ASTVARRUNDIR=\$(localstatedir)\)\(/run\);\1/asterisk\2;' \ + #-e 's;\(ASTVARRUNDIR=\$(localstatedir)\)\(/run\)\(/asterisk\);\1\3\2;' \ + #-e 's;\(ASTVARLIBDIR=\$(localstatedir)\)\(/lib\)\(/asterisk\);\1\3\2;' \ + #-e 's;\(ASTDATADIR:=\)\$(ASTVARLIBDIR);\1$(prefix)/share/asterisk;' \ + #Makefile + %{l_shtool} subst \ + -e 's; *-L/usr/local/ssl/lib;;g' \ + -e 's;/opt/ssl/lib;%{l_prefix}/lib;g' \ + -e 's;/usr/local;%{l_prefix};g' \ + -e 's;\(ASTLINK=\)$;\1-Wl,--export-dynamic;g' \ + main/Makefile + %{l_shtool} subst \ + -e 's;LOG_WARNING\(, "Failed to perform seek\);LOG_DEBUG\1;g' \ + main/channel.c + %{l_shtool} subst \ + -e 's;LOG_WARNING\(, "[^ ][^ ]* is not supported\);LOG_DEBUG\1;g' \ + formats/format_ogg_vorbis.c + %{l_shtool} subst \ + -e 's;\(/etc/radiusclient-ng/radiusclient.conf\);%{l_prefix}\1;g' \ + -e 's;\(radiusclient\)-ng;\1;g' \ + cdr/cdr_radius.c + %{l_shtool} subst \ + -e 's;\(sqlite\)\(\.h\);\13\2;g' \ + cdr/cdr_sqlite.c + %{l_shtool} subst \ + -e 's;\(#define DEFAULT_POLLING_INTERVAL\) *.*;\1 %{with_smdipoll};' \ + res/res_smdi.c + %{l_shtool} subst \ + -e 's;\(ASTERISK_HEADER_DIR=\).*;\1%{l_prefix}/include;g' \ + -e 's;\(MODULES_DIR=\).*;\1%{l_prefix}/lib/asterisk/modules;g' \ + -e 's;\(CONFIG_DIR=\).*;\1%{l_prefix}/etc/asterisk;g' \ + -e 's;\(\$(MODULES_DIR)\);$(DESTDIR)\1;g' \ + -e 's;\${CONFIG_DIR};$(DESTDIR)$(CONFIG_DIR);g' \ + chan_capi-%{V_chan_capi}/Makefile + +# # optionally specify CPU +# %{l_shtool} subst \ +# -e 's;build_cpu=\$1;build_cpu=i586;' \ +# -e 's;host_cpu=\$1;host_cpu=i586;' \ +# configure + +%build + # apply platform build rules + libs="`pkg-config openssl speex --libs-only-l`" +%if "%{with_curl}" == "yes" + libs="$libs `pkg-config libcurl --libs-only-l`" +%endif +%if "%{with_sqlite}" == "yes" + libs="$libs `pkg-config sqlite3 --libs-only-l`" +%endif +%if "%{with_pgsql}" == "yes" + libs="-lpq $libs" +%endif +%if "%{with_radius}" == "yes" + libs="$libs -lradiusclient" +%endif +%if "%{with_libpri}" == "yes" + libs="$libs -lpri" +%endif + case "%{l_platform -t}" in + *-linux* ) libs="$libs -lrt" ;; + *-sunos* ) libs="$libs -lrt" ;; + esac + + # configure package + CC="%{l_cc}" \ + CFLAGS="%{l_cflags -O}" \ +%if "%{with_imap}" == "yes" + CPPFLAGS="%{l_cppflags imap ncurses}" \ +%else + CPPFLAGS="%{l_cppflags ncurses}" \ +%endif + LDFLAGS="%{l_ldflags}" \ + LIBS="$libs" \ + ./configure \ + --prefix=%{l_prefix} \ + --mandir=%{l_prefix}/man \ + --with-ncurses=%{l_prefix} \ +%if "%{with_libpri}" == "yes" + --with-pri=%{l_prefix} \ +%else + --with-pri=no \ +%endif + --with-ssl=%{l_prefix} \ +%if "%{with_radius}" == "yes" + --with-radius=%{l_prefix} \ +%else + --with-radius=no \ +%endif +%if "%{with_sqlite}" == "yes" + --with-sqlite=%{l_prefix} \ +%else + --with-sqlite=no \ +%endif +%if "%{with_postgresql}" == "yes" + --with-postgres=%{l_prefix} \ +%else + --with-postgres=no \ +%endif +%if "%{with_curl}" == "yes" + --with-curl=%{l_prefix} \ +%else + --with-curl=no \ +%endif +%if "%{with_imap}" == "yes" + --with-imap=%{l_prefix} \ + --disable-largefile \ +%else + --with-imap=no \ +%endif +%if "%{with_astman}" == "yes" + --with-newt=%{l_prefix} \ +%else + --with-newt=no \ +%endif + --with-speex=%{l_prefix} \ + --with-speexdsp=%{l_prefix} \ + --with-ogg=%{l_prefix} \ + --with-vorbis=%{l_prefix} \ + --with-z=%{l_prefix} + + # build package + %{l_make} %{l_mflags -O} menuselect/menuselect menuselect-tree + menuselect/menuselect --check-deps menuselect.makeopts + %{l_shtool} subst \ + -e 's;\(MENUSELECT_MOH=\).*;\1;' \ + -e 's;\(MENUSELECT_CORE_SOUNDS=\).*;\1;' \ + -e 's;\(MENUSELECT_EXTRA_SOUNDS=\).*;\1;' \ + menuselect.makeopts +%if "%{with_imap}" == "yes" + %{l_shtool} subst \ + -e 's;\(MENUSELECT_OPTS_app_voicemail=\)$;\1IMAP_STORAGE;' \ + menuselect.makeopts +%endif + %{l_make} %{l_mflags -O} EXTLIBS="$libs" NOISY_BUILD=yes +%if "%{with_capi}" == "yes" + ( cd chan_capi-%{V_chan_capi} + %{l_make} %{l_mflags -O} + ) || exit $? +%endif + +%install + rm -rf $RPM_BUILD_ROOT + + # install package + %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT +%if "%{with_capi}" == "yes" + ( cd chan_capi-%{V_chan_capi} + %{l_make} %{l_mflags} install samples DESTDIR=$RPM_BUILD_ROOT + ) || exit $? +%endif + + # install all sound prompt files + for codec in alaw ulaw g722 g729 gsm; do + for lang in es fr; do + ( cd $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/${lang} + %{l_tar} zxf %{_sourcedir}/asterisk-core-sounds-${lang}-${codec}-%{V_langsounds}.tar.gz + ) || exit $? + done + ( cd $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds + %{l_tar} zxf %{_sourcedir}/asterisk-extra-sounds-en-${codec}-%{V_extrasounds}.tar.gz + %{l_tar} zxf %{_sourcedir}/asterisk-core-sounds-en-${codec}-%{V_langsounds}.tar.gz + ) || exit $? + done + + # install special case sound files + ( cd $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds + %{l_tar} jxf %{SOURCE de-digits-%{V_customsounds}.tar.bz2} + %{l_tar} zxf %{SOURCE asterisk-core-sounds-de-gsm-current.tar.gz} + cd de + %{l_tar} zxf %{_sourcedir}/asterisk-%{V_amoomasounds}-de-prompts.tar.gz + mv -f de/* . && rm -rf de + mv -f dictate/de/* letters/ && rm -rf dictate/de + mv -f digits/de/* letters/ && rm -rf digits/de + mv -f letters/de/* letters/ && rm -rf letters/de + mv -f phonetic/de/* letters/ && rm -rf phonetic/de + ) || exit $? + + # install additional music on hold files + ( cd $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/moh + for codec in alaw ulaw g722 g729 gsm; do + %{l_tar} zxf %{_sourcedir}/asterisk-moh-freeplay-${codec}.tar.gz + done + ) || exit $? + +# # install nonstandard voicemail prompts +# %{l_shtool} mkdir -f -p -m 755 \ +# $RPM_BUILD_ROOT%{l_prefix}/var/asterisk/spool/voicemail/default/%{exten}/unavail +# %{l_shtool} install -c -m 660 \ +# %{_sourcedir}/ansage-%{V_ansage}.wav} \ +# $RPM_BUILD_ROOT%{l_prefix}/var/asterisk/spool/voicemail/default/%{exten}/unavail.wav + + # install default configuration + %{l_shtool} install -c -m 660 %{l_value -s -a} \ + %{SOURCE asterisk.conf} \ + %{SOURCE amd.conf} \ + %{SOURCE cdr.conf} \ + %{SOURCE codecs.conf} \ + %{SOURCE extensions.conf} \ + %{SOURCE features.conf} \ + %{SOURCE festival.conf} \ + %{SOURCE followme.conf} \ + %{SOURCE indications.conf} \ + %{SOURCE logger.conf} \ + %{SOURCE manager.conf} \ + %{SOURCE meetme.conf} \ + %{SOURCE modules.conf} \ + %{SOURCE musiconhold.conf} \ + %{SOURCE rtp.conf} \ + %{SOURCE sip.conf} \ + %{SOURCE sla.conf} \ + %{SOURCE voicemail.conf} \ + %{SOURCE zapata.conf} \ + $RPM_BUILD_ROOT%{l_prefix}/etc/asterisk/ + + # install runcommand script + %{l_shtool} mkdir -f -p -m 755 \ + $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d + %{l_shtool} install -c -m 755 %{l_value -s -a} \ + %{SOURCE rc.asterisk} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/ + + # install additional AGI scripts + %{l_shtool} install -c -m 755 %{l_value -s -a} \ + %{SOURCE wakeup.agi} $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/agi-bin/ + + # correct installation hierarchy + %{l_shtool} mkdir -f -p -m 755 \ + $RPM_BUILD_ROOT%{l_prefix}/var/asterisk/lib \ + $RPM_BUILD_ROOT%{l_prefix}/var/asterisk/spool/outgoing + + # remove unused components + rm -rf \ + $RPM_BUILD_ROOT%{l_prefix}/bin \ + $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/images \ + $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/de/.DS_Store \ + $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/de/autogen.sh \ + >/dev/null 2>&1 || true + + # adjust inconsistent names + for bin in $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/agi-bin/*.*; do + mv $bin `echo $bin | sed -e 's;\.[^.]*$;;'` + done + + # strip down installation + strip $RPM_BUILD_ROOT%{l_prefix}/bin/* \ + $RPM_BUILD_ROOT%{l_prefix}/sbin/* \ + $RPM_BUILD_ROOT%{l_prefix}/lib/asterisk/modules/* \ + $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/agi-bin/* \ + >/dev/null 2>&1 || true + + # determine installation files + %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std} \ + '%config %attr(660,%{l_musr},%{l_rgrp}) %{l_prefix}/etc/asterisk/*' \ + '%config %attr(644,%{l_musr},%{l_mgrp}) %{l_prefix}/share/asterisk/sounds/de/*' \ + '%config %attr(755,%{l_musr},%{l_mgrp}) %{l_prefix}/share/asterisk/sounds/de/dictate' \ + '%config %attr(755,%{l_musr},%{l_mgrp}) %{l_prefix}/share/asterisk/sounds/de/digits' \ + '%config %attr(755,%{l_musr},%{l_mgrp}) %{l_prefix}/share/asterisk/sounds/de/followme' \ + '%config %attr(755,%{l_musr},%{l_mgrp}) %{l_prefix}/share/asterisk/sounds/de/letters' \ + '%config %attr(755,%{l_musr},%{l_mgrp}) %{l_prefix}/share/asterisk/sounds/de/phonetic' \ + '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/asterisk/*' \ + '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/asterisk/*/*' + +%files -f files + +%clean + rm -rf $RPM_BUILD_ROOT + +%post + # after upgrade, restart service + [ $1 -eq 2 ] || exit 0 + eval `%{l_rc} asterisk status 2>/dev/null` + [ ".$asterisk_active" = .yes ] && %{l_rc} asterisk restart + exit 0 + +%preun + # before erase, stop service and remove log files + [ $1 -eq 0 ] || exit 0 + %{l_rc} asterisk stop 2>/dev/null + rm -f $RPM_INSTALL_PREFIX/var/asterisk/lib/* >/dev/null 2>&1 || true + rm -f $RPM_INSTALL_PREFIX/var/asterisk/log/* >/dev/null 2>&1 || true + rm -f $RPM_INSTALL_PREFIX/var/asterisk/log/cdr-*/* >/dev/null 2>&1 || true + rm -f $RPM_INSTALL_PREFIX/var/asterisk/run/* >/dev/null 2>&1 || true + for deldir in meetme outgoing system tmp; do + rm -rf \ + $RPM_INSTALL_PREFIX/var/asterisk/spool/$deldir \ + >/dev/null 2>&1 || true + done + exit 0 +