asterisk/asterisk.spec

Sun, 20 Mar 2011 20:00:02 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sun, 20 Mar 2011 20:00:02 +0100
changeset 310
73d852a30c9a
parent 202
f29abea29121
child 311
263143ec0fb2
permissions
-rw-r--r--

Resynchronize with upstream package maintainer version.

     1 ##
     2 ##  asterisk.spec -- OpenPKG RPM Package Specification
     3 ##  Copyright (c) 2000-2010 OpenPKG Foundation e.V. <http://openpkg.net/>
     4 ##
     5 ##  Permission to use, copy, modify, and distribute this software for
     6 ##  any purpose with or without fee is hereby granted, provided that
     7 ##  the above copyright notice and this permission notice appear in all
     8 ##  copies.
     9 ##
    10 ##  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
    11 ##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
    12 ##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
    13 ##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
    14 ##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    15 ##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
    16 ##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
    17 ##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
    18 ##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
    19 ##  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
    20 ##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
    21 ##  SUCH DAMAGE.
    22 ##
    24 #   package version
    25 %define       V_opkg                     1.6.2.13
    26 %define       V_asterisk                 1.6.2.13
    27 %define       V_asterisk_addons          1.6.2.2
    28 %define       V_asterisk_sounds_core_en  1.4.20
    29 %define       V_asterisk_sounds_core_de  current
    30 %define       V_asterisk_sounds_extra_en 1.4.11
    31 %define       V_chan_capi                1.1.5
    33 #   package information
    34 Name:         asterisk
    35 Summary:      Private Branch Exchange (PBX)
    36 URL:          http://www.asterisk.org/
    37 Vendor:       Mark Spencer et al.
    38 Packager:     OpenPKG Foundation e.V.
    39 Distribution: OpenPKG Community
    40 Class:        BASE
    41 Group:        VoIP
    42 License:      GPL
    43 Version:      %{V_opkg}
    44 Release:      20101019
    46 #   package options
    47 %option       with_dahdi   no
    48 %option       with_capi    no
    49 %option       with_ogg     no
    50 %option       with_mp3     no
    51 %option       with_fax     no
    52 %option       with_avcodec no
    53 %option       with_ldap    no
    54 %option       with_radius  no
    55 %option       with_sqlite  no
    56 %option       with_lua     no
    57 %option       with_jabber  no
    58 %option       with_imap    no
    59 %option       with_odbc    no
    61 #   list of sources
    62 Source0:      http://downloads.asterisk.org/pub/telephony/asterisk/releases/asterisk-%{V_asterisk}.tar.gz
    63 Source1:      http://downloads.asterisk.org/pub/telephony/asterisk/releases/asterisk-addons-%{V_asterisk_addons}.tar.gz
    64 Source2:      http://downloads.asterisk.org/pub/telephony/sounds/releases/asterisk-core-sounds-en-alaw-%{V_asterisk_sounds_core_en}.tar.gz
    65 Source3:      http://downloads.asterisk.org/pub/telephony/sounds/releases/asterisk-extra-sounds-en-alaw-%{V_asterisk_sounds_extra_en}.tar.gz
    66 Source4:      http://www.amooma.de/asterisk/sprachbausteine/asterisk-core-sounds-de-gsm-%{V_asterisk_sounds_core_de}.tar.gz
    67 Source5:      ftp://ftp.chan-capi.org/chan-capi/chan_capi-%{V_chan_capi}.tar.gz
    68 Source6:      asterisk.txt
    69 Source7:      rc.asterisk
    70 Patch0:       asterisk.patch
    72 #   build information
    73 BuildPreReq:  OpenPKG, openpkg >= 20100101, bison, gcc, make, grep
    74 PreReq:       OpenPKG, openpkg >= 20100101, MTA
    75 BuildPreReq:  zlib, curl, openssl, ncurses, speex, popt, gmime22
    76 PreReq:       zlib, curl, openssl, ncurses, speex, popt, gmime22
    77 %if "%{with_ogg}" == "yes"
    78 BuildPreReq:  vorbis-libs
    79 PreReq:       vorbis-libs
    80 %endif
    81 %if "%{with_mp3}" == "yes"
    82 PreReq:       mpg123
    83 %endif
    84 %if "%{with_imap}" == "yes"
    85 BuildPreReq:  imap
    86 PreReq:       imap
    87 %endif
    88 %if "%{with_sqlite}" == "yes"
    89 BuildPreReq:  sqlite
    90 PreReq:       sqlite
    91 %endif
    92 %if "%{with_lua}" == "yes"
    93 BuildPreReq:  lua
    94 PreReq:       lua
    95 %endif
    96 %if "%{with_fax}" == "yes"
    97 BuildPreReq:  spandsp, tiff, jpeg, zlib
    98 PreReq:       spandsp, tiff, jpeg, zlib
    99 %endif
   100 %if "%{with_avcodec}" == "yes"
   101 BuildPreReq:  ffmpeg
   102 PreReq:       ffmpeg
   103 %endif
   104 %if "%{with_ldap}" == "yes"
   105 BuildPreReq:  openldap
   106 PreReq:       openldap
   107 %endif
   108 %if "%{with_radius}" == "yes"
   109 BuildPreReq:  radiusclient
   110 PreReq:       radiusclient
   111 %endif
   112 %if "%{with_jabber}" == "yes"
   113 BuildPreReq:  iksemel
   114 PreReq:       iksemel
   115 %endif
   116 %if "%{with_odbc}" == "yes"
   117 BuildPreReq:  unixodbc, sqlite, sqlite::with_odbc = yes
   118 PreReq:       unixodbc, sqlite, sqlite::with_odbc = yes
   119 %endif
   121 %description
   122     Asterisk is a complete Private Branch Exchange (PBX) in software.
   123     It provides all of the features you would expect from a PBX and
   124     more. Asterisk does Voice over IP (VoIP) in many protocols. Asterisk
   125     provides Voicemail services with Directory, Call Conferencing,
   126     Interactive Voice Response and Call Queuing. It has support for
   127     three-way calling, caller ID services, ADSI, SIP, etc. Asterisk
   128     needs no additional hardware for VoIP.
   130 %track
   131     prog asterisk = {
   132         version   = %{V_asterisk}
   133         url       = http://downloads.asterisk.org/pub/telephony/asterisk/releases/
   134         regex     = asterisk-(\d+\.\d+(\.\d+)+)\.tar\.gz
   135     }
   136     prog asterisk:addons = {
   137         version   = %{V_asterisk_addons}
   138         url       = http://downloads.asterisk.org/pub/telephony/asterisk/releases/
   139         regex     = asterisk-addons-(\d+\.\d+(\.\d+)+)\.tar\.gz
   140     }
   141     prog asterisk:sounds_core_en = {
   142         version   = %{V_asterisk_sounds_core_en}
   143         url       = http://downloads.asterisk.org/pub/telephony/sounds/releases/
   144         regex     = asterisk-core-sounds-en-alaw-(\d+\.\d+(\.\d+)+)\.tar\.gz
   145     }
   146     prog asterisk:sounds_extra_en = {
   147         version   = %{V_asterisk_sounds_extra_en}
   148         url       = http://downloads.asterisk.org/pub/telephony/sounds/releases/
   149         regex     = asterisk-extra-sounds-en-alaw-(\d+\.\d+(\.\d+)+)\.tar\.gz
   150     }
   151     prog asterisk:sounds_core_de = {
   152         version   = %{V_asterisk_sounds_core_de}
   153         url       = http://www.amooma.de/asterisk/sprachbausteine/
   154         regex     = asterisk-core-sounds-de-gsm-(__VER__)\.tar\.gz
   155     }
   156     prog asterisk:chan_capi = {
   157         version   = %{V_chan_capi}
   158         url       = ftp://ftp.chan-capi.org/chan-capi/
   159         regex     = chan_capi-(__VER__)\.tar\.gz
   160     }
   162 %prep
   163     %setup -q -n asterisk-%{V_asterisk}
   164     %setup -q -n asterisk-%{V_asterisk} -D -T -a 1
   165     %setup -q -n asterisk-%{V_asterisk} -D -T -a 5
   166     %patch -p0
   167     exit 0
   168     cp %{SOURCE2} %{SOURCE3} sounds/
   169     %{l_shtool} subst \
   170         -e 's;\(CORE_SOUNDS_VERSION\):=.*$;\1:=%{V_asterisk_sounds_core_en};' \
   171         -e 's;\(EXTRA_SOUNDS_VERSION\):=.*$;\1:=%{V_asterisk_sounds_extra_en};' \
   172         sounds/Makefile
   173     %{l_shtool} subst \
   174         -e 's;-lradiusclient-ng;-lradiusclient;g' \
   175         -e 's;radiusclient-ng\.h;radiusclient.h;g' \
   176         configure cdr/cdr_radius.c
   178 %build
   179     #   sanity check
   180 %if "%{with_dahdi}" == "yes"
   181     dahdi_prefix=""
   182     case "%{l_platform -t}" in
   183         *-linux* )
   184             if [ ! -f /usr/include/linux/dahdi.h ]; then
   185                 echo "option \"with_dahdi\" requires DAHDI Linux drivers installed" 1>&2; exit 1
   186             fi
   187             dahdi_prefix=/usr
   188             ;;
   189         *-freebsd* )
   190             if [ ! -f /usr/local/include/dahdi/dahdi.h ]; then
   191                 echo "option \"with_dahdi\" requires DAHDI FreeBSD drivers installed" 1>&2; exit 1
   192             fi
   193             dahdi_prefix=/usr/local
   194             ;;
   195         * ) echo "option \"with_dahdi\" supported under Linux and FreeBSD only" 1>&2; exit 1 ;;
   196     esac
   197 %endif
   199     #   re-configure music-on-hold to find mpg123
   200 %if "%{with_mp3}" == "yes"
   201     mpg123="%{l_prefix}/bin/mpg123"
   202 %else
   203     mpg123="`which false`"
   204 %endif
   205     %{l_shtool} subst \
   206         -e "s;/usr/local/bin/mpg123;$mpg123;" \
   207         -e "s;/usr/bin/mpg123;$mpg123;" \
   208         res/res_musiconhold.c apps/app_mp3.c
   210     #   build program
   211     %{l_shtool} subst \
   212         -e 's;-llua5\.1;-llua;' \
   213         -e 's;lua5\.1/lua\.h;lua/lua.h;' \
   214         -e 's;ffmpeg/avcodec\.h;libavcodec/avcodec.h;' \
   215         configure
   216     ( echo "ac_cv_prog_CONFIG_GMIME=%{l_prefix}/bin/gmime-config"
   217     ) >config.cache
   218     cflags="%{l_cflags -O}"
   219     cppflags="%{l_cppflags ncurses lua .}"
   220     ldflags="%{l_ldflags}"
   221     libs=""
   222     cppflags="$cppflags `pkg-config gmime-2.0 --cflags-only-I`"
   223     ldflags="$ldflags `pkg-config gmime-2.0 --libs-only-L`"
   224     libs="$libs `pkg-config gmime-2.0 --libs-only-l`"
   225 %if "%{with_ogg}" == "yes"
   226     libs="$libs -logg -lm"
   227 %endif
   228 %if "%{with_avcodec}" == "yes"
   229     libs="$libs -lavcodec -lavutil"
   230 %endif
   231 %if "%{with_ldap}" == "yes"
   232     libs="$libs -lldap -llber -lssl -lcrypto"
   233 %endif
   234 %if "%{with_dahdi}" == "yes"
   235     cppflags="$cppflags -I$dahdi_prefix/include"
   236     ldflags="$ldflags -L$dahdi_prefix/lib"
   237 %endif
   238     CC="%{l_cc}" \
   239     CFLAGS="$cflags" \
   240     CPPFLAGS="$cppflags" \
   241     LDFLAGS="$ldflags" \
   242     LIBS="$libs" \
   243     ./configure \
   244         --cache-file=./config.cache \
   245         --prefix=%{l_prefix} \
   246         --mandir=%{l_prefix}/man \
   247         --sysconfdir=%{l_prefix}/etc \
   248         --localstatedir=%{l_prefix}/var/asterisk \
   249         --with-curl=%{l_prefix} \
   250         --with-ncurses \
   251         --with-gsm="internal" \
   252         --with-popt=%{l_prefix} \
   253 %if "%{with_sqlite}" == "yes"
   254         --with-sqlite3=%{l_prefix} \
   255 %else
   256         --without-sqlite3 \
   257 %endif
   258         --with-speex=%{l_prefix} \
   259         --with-speexdsp=%{l_prefix} \
   260         --with-ssl=%{l_prefix} \
   261         --with-gmime=%{l_prefix} \
   262         --with-z=%{l_prefix} \
   263 %if "%{with_ogg}" == "yes"
   264         --with-ogg=%{l_prefix} \
   265         --with-vorbis=%{l_prefix} \
   266 %else
   267         --without-ogg \
   268         --without-vorbis \
   269 %endif
   270 %if "%{with_jabber}" == "yes"
   271         --with-iksemel=%{l_prefix} \
   272 %else
   273         --without-iksemel \
   274 %endif
   275 %if "%{with_lua}" == "yes"
   276         --with-lua=%{l_prefix} \
   277 %else
   278         --without-lua \
   279 %endif
   280 %if "%{with_dahdi}" == "yes"
   281         --with-dahdi=$dahdi_prefix \
   282         --with-tonezone=$dahdi_prefix \
   283 %else
   284         --without-dahdi \
   285         --without-tonezone \
   286 %endif
   287 %if "%{with_avcodec}" == "yes"
   288         --with-avcodec=%{l_prefix} \
   289 %else
   290         --without-avcodec \
   291 %endif
   292 %if "%{with_ldap}" == "yes"
   293         --with-ldap=%{l_prefix} \
   294 %else
   295         --without-ldap \
   296 %endif
   297 %if "%{with_radius}" == "yes"
   298         --with-radius=%{l_prefix} \
   299 %else
   300         --without-radius \
   301 %endif
   302 %if "%{with_imap}" == "yes"
   303         --with-imap=%{l_prefix} \
   304 %else
   305         --without-imap \
   306 %endif
   307 %if "%{with_odbc}" == "yes"
   308         --with-odbc=%{l_prefix} \
   309 %else
   310         --without-odbc \
   311 %endif
   312         --without-netsnmp \
   313         --without-isdnnet \
   314         --without-misdn \
   315         --without-kde \
   316         --without-nbs \
   317         --without-newt \
   318         --without-asound \
   319         --without-oss \
   320         --without-qt \
   321         --without-sqlite \
   322         --without-postgres \
   323         --without-tds \
   324         --without-osptk \
   325         --without-pri \
   326         --without-suppserv \
   327         --without-vpb \
   328         --without-sdl \
   329         --without-x11 \
   330         --without-gtk \
   331         --without-gtk2
   332     %{l_make} %{l_mflags} \
   333         CC="%{l_cc} $cflags -I. -I./include -I../include -I../../include $cppflags"
   335     #   build addon modules
   336     ( cd asterisk-addons-*
   337       ASTERISK_DIR="`pwd`/.." \
   338       CC="%{l_cc}" \
   339       CFLAGS="%{l_cflags -O}" \
   340       CPPFLAGS="%{l_cppflags ncurses tiff .}" \
   341       LDFLAGS="%{l_ldflags}" \
   342 %if "%{with_fax}" == "yes"
   343       LIBS="-ltiff -ljpeg -lz -lm" \
   344 %else
   345       LIBS="-lm" \
   346 %endif
   347       ./configure \
   348           --prefix=%{l_prefix} \
   349           --mandir=%{l_prefix}/man \
   350           --sysconfdir=%{l_prefix}/etc \
   351           --localstatedir=%{l_prefix}/var/asterisk \
   352           --with-ncurses \
   353           --with-asterisk \
   354           --without-mysqlclient \
   355 %if "%{with_fax}" == "yes"
   356           --with-spandsp=%{l_prefix}
   357 %else
   358           --without-spandsp
   359 %endif
   360       %{l_make} %{l_mflags} \
   361           CC="%{l_cc} %{l_cflags -O} -I. %{l_cppflags ncurses tiff .}"
   362     ) || exit $?
   363 %if "%{with_capi}" == "yes"
   364     ( cd chan_capi-*
   365       ln -s ../include/asterisk .
   366       ln -s ../include/asterisk.h .
   367       %{l_make} %{l_mflags} \
   368           INSTALL_PREFIX=%{l_prefix} \
   369           ASTERISK_HEADER_DIR="`pwd`"
   370     ) || exit $?
   371 %endif
   373 %install
   374     #   install program
   375     %{l_make} %{l_mflags} install \
   376         DESTDIR=$RPM_BUILD_ROOT \
   377         INSTALL_PREFIX=%{l_prefix}
   379     #   install addon modules
   380     ( cd asterisk-addons-*
   381       %{l_make} %{l_mflags} install \
   382           DESTDIR=$RPM_BUILD_ROOT \
   383           INSTALL_PREFIX=%{l_prefix}
   384     ) || exit $?
   385 %if "%{with_capi}" == "yes"
   386     ( cd chan_capi-*
   387       %{l_make} %{l_mflags} install \
   388           INSTALL_PREFIX=$RPM_BUILD_ROOT%{l_prefix} \
   389           INSTALL="%{l_shtool} install -c" \
   390           MODULES_DIR='$(INSTALL_PREFIX)/lib/asterisk/modules'
   391     ) || exit $?
   392 %endif
   394     #   install addon sounds
   395     %{l_shtool} mkdir -f -p -m 755 \
   396         $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/de
   397     ( cd $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/de
   398       %{l_gzip} -d -c %{SOURCE4} | %{l_tar} xf -
   399     ) || exit $?
   401     #   strip down installation
   402     rm -f $RPM_BUILD_ROOT%{l_prefix}/sbin/autosupport >/dev/null 2>&1 || true
   403     rm -f $RPM_BUILD_ROOT%{l_prefix}/sbin/safe_asterisk >/dev/null 2>&1 || true
   404     rm -f $RPM_BUILD_ROOT%{l_prefix}/man/man8/autosupport.8 >/dev/null 2>&1 || true
   405     rm -f $RPM_BUILD_ROOT%{l_prefix}/man/man8/safe_asterisk.8 >/dev/null 2>&1 || true
   406     rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/firmware >/dev/null 2>&1 || true
   407     rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/images >/dev/null 2>&1 || true
   408     rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/.asterisk* >/dev/null 2>&1 || true
   409     rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/en/CREDIT* >/dev/null 2>&1 || true
   410     rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/en/CHANGES* >/dev/null 2>&1 || true
   411     rmdir $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/es >/dev/null 2>&1 || true
   412     rmdir $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/fr >/dev/null 2>&1 || true
   414     #   create additional directories
   415     %{l_shtool} mkdir -f -p -m 755 \
   416         $RPM_BUILD_ROOT%{l_prefix}/var/asterisk/db
   418     #   post-adjust installation
   419     strip $RPM_BUILD_ROOT%{l_prefix}/sbin/* >/dev/null 2>&1 || true
   420     mv  $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/agi-bin \
   421         $RPM_BUILD_ROOT%{l_prefix}/lib/asterisk/agi-bin
   422     for bin in $RPM_BUILD_ROOT%{l_prefix}/lib/asterisk/agi-bin/*.*; do
   423         mv $bin `echo $bin | sed -e 's;\.[^.]*$;;'`
   424     done
   426     #   install default configuration
   427     for name in `grep "^<file" %{SOURCE asterisk.txt} | sed -e 's;^.*name=";;' -e 's;".*$;;'`; do
   428 %if "%{with_dahdi}" == "no"
   429         [ ".$name" = ".chan_dahdi.conf" ] && continue
   430 %endif
   431 %if "%{with_capi}" == "no"
   432         [ ".$name" = ".capi.conf" ] && continue
   433 %endif
   434 %if "%{with_sqlite}" == "no"
   435         [ ".$name" = ".cdr_sqlite3_custom.conf" ] && continue
   436 %endif
   437 %if "%{with_odbc}" == "no"
   438         [ ".$name" = ".res_odbc.conf" ] && continue
   439         [ ".$name" = ".func_odbc.conf" ] && continue
   440 %endif
   441         (echo ""; cat %{SOURCE asterisk.txt}; echo "") |\
   442             sed -e "1,/^<file name=\"$name\">/d" -e "/<\/file>/,\$d" >$name
   443         %{l_shtool} install -c -m 644 %{l_value -s -a} \
   444             $name $RPM_BUILD_ROOT%{l_prefix}/etc/asterisk/
   445     done
   447     #   install run-command script
   448     %{l_shtool} mkdir -f -p -m 755 \
   449         $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
   450     %{l_shtool} install -c -m 755 %{l_value -s -a} \
   451         %{SOURCE rc.asterisk} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
   453     #   determine installation files
   454     %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
   455         %{l_files_std} \
   456         '%config %attr(640,%{l_mgrp},%{l_rgrp}) %{l_prefix}/etc/asterisk/*' \
   457         '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/asterisk'
   459 %files -f files
   461 %clean
   463 %post
   464 %if "%{with_dahdi}" == "yes"
   465     if [ $1 -eq 1 ]; then
   466         case "%{l_platform -t}" in
   467             *-freebsd* )
   468                 ( echo "To allow Asterisk to use the DAHDI /dev/dahdi/pseudo device(s)"
   469                   echo "you have add the following entry to /etc/devfs.rules:"
   470                   echo ""
   471                   echo "[openpkg_asterisk=10]"
   472                   echo "add path 'dahdi/pseudo*' mode 0664 user %{l_rusr} group %{l_rgrp}"
   473                   echo ""
   474                 ) | %{l_rpmtool} msg -b -t notice
   475                 ;;
   476         esac
   477     fi
   478 %endif
   479 %if "%{with_odbc}" == "yes"
   480     #   after install, optionally link into ODBC and create database
   481     if $RPM_INSTALL_PREFIX/bin/odbcinst -q -s -n "asterisk-sqlite" >/dev/null 2>&1; then
   482         :
   483     else
   484         ( echo "[asterisk-sqlite]"
   485           echo "Description = Asterisk SQLite Database"
   486           echo "Driver      = SQLite3"
   487           echo "Database    = $RPM_INSTALL_PREFIX/var/asterisk/db/asterisk.sqlite"
   488           echo "Timeout     = 2000"
   489         ) | $RPM_INSTALL_PREFIX/bin/odbcinst -i -s -l -n "asterisk-sqlite" -r >/dev/null 2>&1 || true
   490     fi
   491     if [ ! -f $RPM_INSTALL_PREFIX/var/asterisk/run/asterisk.db ]; then
   492         ( umask 007
   493           echo "CREATE TABLE map (key TEXT, val TEXT);" | $RPM_INSTALL_PREFIX/bin/isql "asterisk-sqlite" -b
   494           chown %{l_rusr}:%{l_rgrp} $RPM_INSTALL_PREFIX/var/asterisk/db/asterisk.sqlite >/dev/null 2>&1 || true
   495         ) || exit $?
   496     fi
   497 %endif
   498     #   after upgrade, restart service
   499     [ $1 -eq 2 ] || exit 0
   500     eval `%{l_rc} asterisk status 2>/dev/null`
   501     [ ".$asterisk_active" = .yes ] && %{l_rc} asterisk restart
   502     exit 0
   504 %preun
   505     #   before erase, stop service and remove log files
   506     [ $1 -eq 0 ] || exit 0
   507     %{l_rc} asterisk stop 2>/dev/null
   508     rm -f $RPM_INSTALL_PREFIX/var/asterisk/log/*       >/dev/null 2>&1 || true
   509     rm -f $RPM_INSTALL_PREFIX/var/asterisk/log/cdr-*/* >/dev/null 2>&1 || true
   510     rm -f $RPM_INSTALL_PREFIX/var/asterisk/run/*       >/dev/null 2>&1 || true
   511     rm -f $RPM_INSTALL_PREFIX/var/asterisk/spool/*/*   >/dev/null 2>&1 || true
   512     rm -f $RPM_INSTALL_PREFIX/var/asterisk/db/*        >/dev/null 2>&1 || true
   513 %if "%{with_odbc}" == "yes"
   514     #   before erase, optionally unlink from ODBC and destroy database
   515     $RPM_INSTALL_PREFIX/bin/odbcinst -u -s -l -n "asterisk-sqlite" >/dev/null 2>&1 || true
   516 %endif
   517     exit 0

mercurial