michael@202: ## michael@202: ## asterisk.spec -- OpenPKG RPM Package Specification michael@310: ## Copyright (c) 2000-2010 OpenPKG Foundation e.V. michael@202: ## michael@202: ## Permission to use, copy, modify, and distribute this software for michael@202: ## any purpose with or without fee is hereby granted, provided that michael@202: ## the above copyright notice and this permission notice appear in all michael@202: ## copies. michael@202: ## michael@202: ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED michael@202: ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF michael@202: ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. michael@202: ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR michael@202: ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, michael@202: ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT michael@202: ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF michael@202: ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND michael@202: ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, michael@202: ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT michael@202: ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF michael@202: ## SUCH DAMAGE. michael@202: ## michael@202: michael@310: # package version michael@310: %define V_opkg 1.6.2.13 michael@310: %define V_asterisk 1.6.2.13 michael@310: %define V_asterisk_addons 1.6.2.2 michael@310: %define V_asterisk_sounds_core_en 1.4.20 michael@310: %define V_asterisk_sounds_core_de current michael@310: %define V_asterisk_sounds_extra_en 1.4.11 michael@310: %define V_chan_capi 1.1.5 michael@202: michael@202: # package information michael@202: Name: asterisk michael@310: Summary: Private Branch Exchange (PBX) michael@202: URL: http://www.asterisk.org/ michael@202: Vendor: Mark Spencer et al. michael@310: Packager: OpenPKG Foundation e.V. michael@310: Distribution: OpenPKG Community michael@310: Class: BASE michael@202: Group: VoIP michael@202: License: GPL michael@310: Version: %{V_opkg} michael@310: Release: 20101019 michael@202: michael@202: # package options michael@310: %option with_dahdi no michael@310: %option with_capi no michael@310: %option with_ogg no michael@310: %option with_mp3 no michael@310: %option with_fax no michael@310: %option with_avcodec no michael@310: %option with_ldap no michael@310: %option with_radius no michael@310: %option with_sqlite no michael@310: %option with_lua no michael@310: %option with_jabber no michael@310: %option with_imap no michael@310: %option with_odbc no michael@202: michael@202: # list of sources michael@310: Source0: http://downloads.asterisk.org/pub/telephony/asterisk/releases/asterisk-%{V_asterisk}.tar.gz michael@310: Source1: http://downloads.asterisk.org/pub/telephony/asterisk/releases/asterisk-addons-%{V_asterisk_addons}.tar.gz michael@310: Source2: http://downloads.asterisk.org/pub/telephony/sounds/releases/asterisk-core-sounds-en-alaw-%{V_asterisk_sounds_core_en}.tar.gz michael@310: Source3: http://downloads.asterisk.org/pub/telephony/sounds/releases/asterisk-extra-sounds-en-alaw-%{V_asterisk_sounds_extra_en}.tar.gz michael@310: Source4: http://www.amooma.de/asterisk/sprachbausteine/asterisk-core-sounds-de-gsm-%{V_asterisk_sounds_core_de}.tar.gz michael@310: Source5: ftp://ftp.chan-capi.org/chan-capi/chan_capi-%{V_chan_capi}.tar.gz michael@310: Source6: asterisk.txt michael@310: Source7: rc.asterisk michael@202: Patch0: asterisk.patch michael@202: michael@202: # build information michael@310: BuildPreReq: OpenPKG, openpkg >= 20100101, bison, gcc, make, grep michael@310: PreReq: OpenPKG, openpkg >= 20100101, MTA michael@310: BuildPreReq: zlib, curl, openssl, ncurses, speex, popt, gmime22 michael@310: PreReq: zlib, curl, openssl, ncurses, speex, popt, gmime22 michael@310: %if "%{with_ogg}" == "yes" michael@310: BuildPreReq: vorbis-libs michael@310: PreReq: vorbis-libs michael@310: %endif michael@310: %if "%{with_mp3}" == "yes" michael@310: PreReq: mpg123 michael@310: %endif michael@310: %if "%{with_imap}" == "yes" michael@310: BuildPreReq: imap michael@310: PreReq: imap michael@310: %endif michael@310: %if "%{with_sqlite}" == "yes" michael@310: BuildPreReq: sqlite michael@310: PreReq: sqlite michael@310: %endif michael@310: %if "%{with_lua}" == "yes" michael@310: BuildPreReq: lua michael@310: PreReq: lua michael@310: %endif michael@310: %if "%{with_fax}" == "yes" michael@310: BuildPreReq: spandsp, tiff, jpeg, zlib michael@310: PreReq: spandsp, tiff, jpeg, zlib michael@310: %endif michael@310: %if "%{with_avcodec}" == "yes" michael@310: BuildPreReq: ffmpeg michael@310: PreReq: ffmpeg michael@310: %endif michael@310: %if "%{with_ldap}" == "yes" michael@310: BuildPreReq: openldap michael@310: PreReq: openldap michael@202: %endif michael@202: %if "%{with_radius}" == "yes" michael@202: BuildPreReq: radiusclient michael@202: PreReq: radiusclient michael@202: %endif michael@310: %if "%{with_jabber}" == "yes" michael@310: BuildPreReq: iksemel michael@310: PreReq: iksemel michael@202: %endif michael@310: %if "%{with_odbc}" == "yes" michael@310: BuildPreReq: unixodbc, sqlite, sqlite::with_odbc = yes michael@310: PreReq: unixodbc, sqlite, sqlite::with_odbc = yes michael@202: %endif michael@202: michael@202: %description michael@202: Asterisk is a complete Private Branch Exchange (PBX) in software. michael@202: It provides all of the features you would expect from a PBX and michael@202: more. Asterisk does Voice over IP (VoIP) in many protocols. Asterisk michael@202: provides Voicemail services with Directory, Call Conferencing, michael@202: Interactive Voice Response and Call Queuing. It has support for michael@202: three-way calling, caller ID services, ADSI, SIP, etc. Asterisk michael@202: needs no additional hardware for VoIP. michael@202: michael@202: %track michael@202: prog asterisk = { michael@310: version = %{V_asterisk} michael@310: url = http://downloads.asterisk.org/pub/telephony/asterisk/releases/ michael@310: regex = asterisk-(\d+\.\d+(\.\d+)+)\.tar\.gz michael@310: } michael@310: prog asterisk:addons = { michael@310: version = %{V_asterisk_addons} michael@310: url = http://downloads.asterisk.org/pub/telephony/asterisk/releases/ michael@310: regex = asterisk-addons-(\d+\.\d+(\.\d+)+)\.tar\.gz michael@310: } michael@310: prog asterisk:sounds_core_en = { michael@310: version = %{V_asterisk_sounds_core_en} michael@310: url = http://downloads.asterisk.org/pub/telephony/sounds/releases/ michael@310: regex = asterisk-core-sounds-en-alaw-(\d+\.\d+(\.\d+)+)\.tar\.gz michael@310: } michael@310: prog asterisk:sounds_extra_en = { michael@310: version = %{V_asterisk_sounds_extra_en} michael@310: url = http://downloads.asterisk.org/pub/telephony/sounds/releases/ michael@310: regex = asterisk-extra-sounds-en-alaw-(\d+\.\d+(\.\d+)+)\.tar\.gz michael@310: } michael@310: prog asterisk:sounds_core_de = { michael@310: version = %{V_asterisk_sounds_core_de} michael@310: url = http://www.amooma.de/asterisk/sprachbausteine/ michael@310: regex = asterisk-core-sounds-de-gsm-(__VER__)\.tar\.gz michael@310: } michael@310: prog asterisk:chan_capi = { michael@310: version = %{V_chan_capi} michael@310: url = ftp://ftp.chan-capi.org/chan-capi/ michael@310: regex = chan_capi-(__VER__)\.tar\.gz michael@202: } michael@202: michael@202: %prep michael@310: %setup -q -n asterisk-%{V_asterisk} michael@310: %setup -q -n asterisk-%{V_asterisk} -D -T -a 1 michael@310: %setup -q -n asterisk-%{V_asterisk} -D -T -a 5 michael@202: %patch -p0 michael@310: exit 0 michael@310: cp %{SOURCE2} %{SOURCE3} sounds/ michael@310: %{l_shtool} subst \ michael@310: -e 's;\(CORE_SOUNDS_VERSION\):=.*$;\1:=%{V_asterisk_sounds_core_en};' \ michael@310: -e 's;\(EXTRA_SOUNDS_VERSION\):=.*$;\1:=%{V_asterisk_sounds_extra_en};' \ michael@310: sounds/Makefile michael@310: %{l_shtool} subst \ michael@310: -e 's;-lradiusclient-ng;-lradiusclient;g' \ michael@310: -e 's;radiusclient-ng\.h;radiusclient.h;g' \ michael@310: configure cdr/cdr_radius.c michael@310: michael@310: %build michael@310: # sanity check michael@310: %if "%{with_dahdi}" == "yes" michael@310: dahdi_prefix="" michael@310: case "%{l_platform -t}" in michael@310: *-linux* ) michael@310: if [ ! -f /usr/include/linux/dahdi.h ]; then michael@310: echo "option \"with_dahdi\" requires DAHDI Linux drivers installed" 1>&2; exit 1 michael@310: fi michael@310: dahdi_prefix=/usr michael@310: ;; michael@310: *-freebsd* ) michael@310: if [ ! -f /usr/local/include/dahdi/dahdi.h ]; then michael@310: echo "option \"with_dahdi\" requires DAHDI FreeBSD drivers installed" 1>&2; exit 1 michael@310: fi michael@310: dahdi_prefix=/usr/local michael@310: ;; michael@310: * ) echo "option \"with_dahdi\" supported under Linux and FreeBSD only" 1>&2; exit 1 ;; michael@310: esac michael@202: %endif michael@202: michael@310: # re-configure music-on-hold to find mpg123 michael@310: %if "%{with_mp3}" == "yes" michael@310: mpg123="%{l_prefix}/bin/mpg123" michael@310: %else michael@310: mpg123="`which false`" michael@310: %endif michael@310: %{l_shtool} subst \ michael@310: -e "s;/usr/local/bin/mpg123;$mpg123;" \ michael@310: -e "s;/usr/bin/mpg123;$mpg123;" \ michael@310: res/res_musiconhold.c apps/app_mp3.c michael@202: michael@310: # build program michael@202: %{l_shtool} subst \ michael@310: -e 's;-llua5\.1;-llua;' \ michael@310: -e 's;lua5\.1/lua\.h;lua/lua.h;' \ michael@310: -e 's;ffmpeg/avcodec\.h;libavcodec/avcodec.h;' \ michael@202: configure michael@310: ( echo "ac_cv_prog_CONFIG_GMIME=%{l_prefix}/bin/gmime-config" michael@310: ) >config.cache michael@310: cflags="%{l_cflags -O}" michael@310: cppflags="%{l_cppflags ncurses lua .}" michael@310: ldflags="%{l_ldflags}" michael@310: libs="" michael@310: cppflags="$cppflags `pkg-config gmime-2.0 --cflags-only-I`" michael@310: ldflags="$ldflags `pkg-config gmime-2.0 --libs-only-L`" michael@310: libs="$libs `pkg-config gmime-2.0 --libs-only-l`" michael@310: %if "%{with_ogg}" == "yes" michael@310: libs="$libs -logg -lm" michael@202: %endif michael@310: %if "%{with_avcodec}" == "yes" michael@310: libs="$libs -lavcodec -lavutil" michael@202: %endif michael@310: %if "%{with_ldap}" == "yes" michael@310: libs="$libs -lldap -llber -lssl -lcrypto" michael@202: %endif michael@310: %if "%{with_dahdi}" == "yes" michael@310: cppflags="$cppflags -I$dahdi_prefix/include" michael@310: ldflags="$ldflags -L$dahdi_prefix/lib" michael@202: %endif michael@202: CC="%{l_cc}" \ michael@310: CFLAGS="$cflags" \ michael@310: CPPFLAGS="$cppflags" \ michael@310: LDFLAGS="$ldflags" \ michael@202: LIBS="$libs" \ michael@202: ./configure \ michael@310: --cache-file=./config.cache \ michael@202: --prefix=%{l_prefix} \ michael@202: --mandir=%{l_prefix}/man \ michael@310: --sysconfdir=%{l_prefix}/etc \ michael@310: --localstatedir=%{l_prefix}/var/asterisk \ michael@310: --with-curl=%{l_prefix} \ michael@310: --with-ncurses \ michael@310: --with-gsm="internal" \ michael@310: --with-popt=%{l_prefix} \ michael@310: %if "%{with_sqlite}" == "yes" michael@310: --with-sqlite3=%{l_prefix} \ michael@202: %else michael@310: --without-sqlite3 \ michael@202: %endif michael@310: --with-speex=%{l_prefix} \ michael@310: --with-speexdsp=%{l_prefix} \ michael@202: --with-ssl=%{l_prefix} \ michael@310: --with-gmime=%{l_prefix} \ michael@310: --with-z=%{l_prefix} \ michael@310: %if "%{with_ogg}" == "yes" michael@310: --with-ogg=%{l_prefix} \ michael@310: --with-vorbis=%{l_prefix} \ michael@310: %else michael@310: --without-ogg \ michael@310: --without-vorbis \ michael@310: %endif michael@310: %if "%{with_jabber}" == "yes" michael@310: --with-iksemel=%{l_prefix} \ michael@310: %else michael@310: --without-iksemel \ michael@310: %endif michael@310: %if "%{with_lua}" == "yes" michael@310: --with-lua=%{l_prefix} \ michael@310: %else michael@310: --without-lua \ michael@310: %endif michael@310: %if "%{with_dahdi}" == "yes" michael@310: --with-dahdi=$dahdi_prefix \ michael@310: --with-tonezone=$dahdi_prefix \ michael@310: %else michael@310: --without-dahdi \ michael@310: --without-tonezone \ michael@310: %endif michael@310: %if "%{with_avcodec}" == "yes" michael@310: --with-avcodec=%{l_prefix} \ michael@310: %else michael@310: --without-avcodec \ michael@310: %endif michael@310: %if "%{with_ldap}" == "yes" michael@310: --with-ldap=%{l_prefix} \ michael@310: %else michael@310: --without-ldap \ michael@310: %endif michael@202: %if "%{with_radius}" == "yes" michael@202: --with-radius=%{l_prefix} \ michael@202: %else michael@310: --without-radius \ michael@202: %endif michael@202: %if "%{with_imap}" == "yes" michael@202: --with-imap=%{l_prefix} \ michael@202: %else michael@310: --without-imap \ michael@202: %endif michael@310: %if "%{with_odbc}" == "yes" michael@310: --with-odbc=%{l_prefix} \ michael@202: %else michael@310: --without-odbc \ michael@202: %endif michael@310: --without-netsnmp \ michael@310: --without-isdnnet \ michael@310: --without-misdn \ michael@310: --without-kde \ michael@310: --without-nbs \ michael@310: --without-newt \ michael@310: --without-asound \ michael@310: --without-oss \ michael@310: --without-qt \ michael@310: --without-sqlite \ michael@310: --without-postgres \ michael@310: --without-tds \ michael@310: --without-osptk \ michael@310: --without-pri \ michael@310: --without-suppserv \ michael@310: --without-vpb \ michael@310: --without-sdl \ michael@310: --without-x11 \ michael@310: --without-gtk \ michael@310: --without-gtk2 michael@310: %{l_make} %{l_mflags} \ michael@310: CC="%{l_cc} $cflags -I. -I./include -I../include -I../../include $cppflags" michael@202: michael@310: # build addon modules michael@310: ( cd asterisk-addons-* michael@310: ASTERISK_DIR="`pwd`/.." \ michael@310: CC="%{l_cc}" \ michael@310: CFLAGS="%{l_cflags -O}" \ michael@310: CPPFLAGS="%{l_cppflags ncurses tiff .}" \ michael@310: LDFLAGS="%{l_ldflags}" \ michael@310: %if "%{with_fax}" == "yes" michael@310: LIBS="-ltiff -ljpeg -lz -lm" \ michael@310: %else michael@310: LIBS="-lm" \ michael@202: %endif michael@310: ./configure \ michael@310: --prefix=%{l_prefix} \ michael@310: --mandir=%{l_prefix}/man \ michael@310: --sysconfdir=%{l_prefix}/etc \ michael@310: --localstatedir=%{l_prefix}/var/asterisk \ michael@310: --with-ncurses \ michael@310: --with-asterisk \ michael@310: --without-mysqlclient \ michael@310: %if "%{with_fax}" == "yes" michael@310: --with-spandsp=%{l_prefix} michael@310: %else michael@310: --without-spandsp michael@310: %endif michael@310: %{l_make} %{l_mflags} \ michael@310: CC="%{l_cc} %{l_cflags -O} -I. %{l_cppflags ncurses tiff .}" michael@310: ) || exit $? michael@202: %if "%{with_capi}" == "yes" michael@310: ( cd chan_capi-* michael@310: ln -s ../include/asterisk . michael@310: ln -s ../include/asterisk.h . michael@310: %{l_make} %{l_mflags} \ michael@310: INSTALL_PREFIX=%{l_prefix} \ michael@310: ASTERISK_HEADER_DIR="`pwd`" michael@202: ) || exit $? michael@202: %endif michael@202: michael@202: %install michael@310: # install program michael@310: %{l_make} %{l_mflags} install \ michael@310: DESTDIR=$RPM_BUILD_ROOT \ michael@310: INSTALL_PREFIX=%{l_prefix} michael@202: michael@310: # install addon modules michael@310: ( cd asterisk-addons-* michael@310: %{l_make} %{l_mflags} install \ michael@310: DESTDIR=$RPM_BUILD_ROOT \ michael@310: INSTALL_PREFIX=%{l_prefix} michael@310: ) || exit $? michael@202: %if "%{with_capi}" == "yes" michael@310: ( cd chan_capi-* michael@310: %{l_make} %{l_mflags} install \ michael@310: INSTALL_PREFIX=$RPM_BUILD_ROOT%{l_prefix} \ michael@310: INSTALL="%{l_shtool} install -c" \ michael@310: MODULES_DIR='$(INSTALL_PREFIX)/lib/asterisk/modules' michael@202: ) || exit $? michael@202: %endif michael@202: michael@310: # install addon sounds michael@310: %{l_shtool} mkdir -f -p -m 755 \ michael@310: $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/de michael@310: ( cd $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/de michael@310: %{l_gzip} -d -c %{SOURCE4} | %{l_tar} xf - michael@310: ) || exit $? michael@310: michael@310: # strip down installation michael@310: rm -f $RPM_BUILD_ROOT%{l_prefix}/sbin/autosupport >/dev/null 2>&1 || true michael@310: rm -f $RPM_BUILD_ROOT%{l_prefix}/sbin/safe_asterisk >/dev/null 2>&1 || true michael@310: rm -f $RPM_BUILD_ROOT%{l_prefix}/man/man8/autosupport.8 >/dev/null 2>&1 || true michael@310: rm -f $RPM_BUILD_ROOT%{l_prefix}/man/man8/safe_asterisk.8 >/dev/null 2>&1 || true michael@310: rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/firmware >/dev/null 2>&1 || true michael@310: rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/images >/dev/null 2>&1 || true michael@310: rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/.asterisk* >/dev/null 2>&1 || true michael@310: rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/en/CREDIT* >/dev/null 2>&1 || true michael@310: rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/en/CHANGES* >/dev/null 2>&1 || true michael@310: rmdir $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/es >/dev/null 2>&1 || true michael@310: rmdir $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/fr >/dev/null 2>&1 || true michael@310: michael@310: # create additional directories michael@310: %{l_shtool} mkdir -f -p -m 755 \ michael@310: $RPM_BUILD_ROOT%{l_prefix}/var/asterisk/db michael@310: michael@310: # post-adjust installation michael@310: strip $RPM_BUILD_ROOT%{l_prefix}/sbin/* >/dev/null 2>&1 || true michael@310: mv $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/agi-bin \ michael@310: $RPM_BUILD_ROOT%{l_prefix}/lib/asterisk/agi-bin michael@310: for bin in $RPM_BUILD_ROOT%{l_prefix}/lib/asterisk/agi-bin/*.*; do michael@310: mv $bin `echo $bin | sed -e 's;\.[^.]*$;;'` michael@202: done michael@202: michael@310: # install default configuration michael@310: for name in `grep "^/d" -e "/<\/file>/,\$d" >$name michael@310: %{l_shtool} install -c -m 644 %{l_value -s -a} \ michael@310: $name $RPM_BUILD_ROOT%{l_prefix}/etc/asterisk/ michael@310: done michael@202: michael@310: # install run-command script michael@202: %{l_shtool} mkdir -f -p -m 755 \ michael@202: $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d michael@202: %{l_shtool} install -c -m 755 %{l_value -s -a} \ michael@202: %{SOURCE rc.asterisk} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/ michael@202: michael@202: # determine installation files michael@310: %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \ michael@310: %{l_files_std} \ michael@310: '%config %attr(640,%{l_mgrp},%{l_rgrp}) %{l_prefix}/etc/asterisk/*' \ michael@310: '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/asterisk' michael@202: michael@202: %files -f files michael@202: michael@202: %clean michael@202: michael@202: %post michael@310: %if "%{with_dahdi}" == "yes" michael@310: if [ $1 -eq 1 ]; then michael@310: case "%{l_platform -t}" in michael@310: *-freebsd* ) michael@310: ( echo "To allow Asterisk to use the DAHDI /dev/dahdi/pseudo device(s)" michael@310: echo "you have add the following entry to /etc/devfs.rules:" michael@310: echo "" michael@310: echo "[openpkg_asterisk=10]" michael@310: echo "add path 'dahdi/pseudo*' mode 0664 user %{l_rusr} group %{l_rgrp}" michael@310: echo "" michael@310: ) | %{l_rpmtool} msg -b -t notice michael@310: ;; michael@310: esac michael@310: fi michael@310: %endif michael@310: %if "%{with_odbc}" == "yes" michael@310: # after install, optionally link into ODBC and create database michael@310: if $RPM_INSTALL_PREFIX/bin/odbcinst -q -s -n "asterisk-sqlite" >/dev/null 2>&1; then michael@310: : michael@310: else michael@310: ( echo "[asterisk-sqlite]" michael@310: echo "Description = Asterisk SQLite Database" michael@310: echo "Driver = SQLite3" michael@310: echo "Database = $RPM_INSTALL_PREFIX/var/asterisk/db/asterisk.sqlite" michael@310: echo "Timeout = 2000" michael@310: ) | $RPM_INSTALL_PREFIX/bin/odbcinst -i -s -l -n "asterisk-sqlite" -r >/dev/null 2>&1 || true michael@310: fi michael@310: if [ ! -f $RPM_INSTALL_PREFIX/var/asterisk/run/asterisk.db ]; then michael@310: ( umask 007 michael@310: echo "CREATE TABLE map (key TEXT, val TEXT);" | $RPM_INSTALL_PREFIX/bin/isql "asterisk-sqlite" -b michael@310: chown %{l_rusr}:%{l_rgrp} $RPM_INSTALL_PREFIX/var/asterisk/db/asterisk.sqlite >/dev/null 2>&1 || true michael@310: ) || exit $? michael@310: fi michael@310: %endif michael@202: # after upgrade, restart service michael@202: [ $1 -eq 2 ] || exit 0 michael@202: eval `%{l_rc} asterisk status 2>/dev/null` michael@202: [ ".$asterisk_active" = .yes ] && %{l_rc} asterisk restart michael@202: exit 0 michael@202: michael@202: %preun michael@202: # before erase, stop service and remove log files michael@202: [ $1 -eq 0 ] || exit 0 michael@202: %{l_rc} asterisk stop 2>/dev/null michael@310: rm -f $RPM_INSTALL_PREFIX/var/asterisk/log/* >/dev/null 2>&1 || true michael@310: rm -f $RPM_INSTALL_PREFIX/var/asterisk/log/cdr-*/* >/dev/null 2>&1 || true michael@310: rm -f $RPM_INSTALL_PREFIX/var/asterisk/run/* >/dev/null 2>&1 || true michael@310: rm -f $RPM_INSTALL_PREFIX/var/asterisk/spool/*/* >/dev/null 2>&1 || true michael@310: rm -f $RPM_INSTALL_PREFIX/var/asterisk/db/* >/dev/null 2>&1 || true michael@310: %if "%{with_odbc}" == "yes" michael@310: # before erase, optionally unlink from ODBC and destroy database michael@310: $RPM_INSTALL_PREFIX/bin/odbcinst -u -s -l -n "asterisk-sqlite" >/dev/null 2>&1 || true michael@310: %endif michael@202: exit 0 michael@202: