asterisk/asterisk.spec

Thu, 22 Mar 2012 21:33:42 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Mar 2012 21:33:42 +0100
changeset 411
e4385d1fd937
parent 405
375c04ff28ba
child 414
fd611cde817f
permissions
-rw-r--r--

Correct nasty intermediate cert open flaw and make requirements consistent.

     1 ##
     2 ##  asterisk.spec -- OpenPKG RPM Package Specification
     3 ##  Copyright (c) 2000-2009 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.8.10.1
    26 %define       V_asterisk                 1.8.10.1
    27 %define       V_asterisk_fax_subdir      1.8.4
    28 %define       V_asterisk_fax_digium      1.8.4_1.3.0
    29 %define       V_asterisk_sounds_core     1.4.22
    30 %define       V_asterisk_sounds_extra    1.4.11
    31 %define       V_asterisk_sounds_amoogab  1.4
    32 %define       V_asterisk_sounds_amootts  current
    33 %define       V_asterisk_sounds_custom   1.0
    34 %define       V_asterisk_sounds_mohop    2.03
    35 %define       V_asterisk_addons_mp3dec   1
    36 %define       V_fswitch_sounds_en        1.0.16
    37 %define       V_fswitch_sounds_fr        1.0.14
    38 %define       V_fswitch_sounds_ru        1.0.13
    39 %define       V_fswitch_music            1.0.8
    40 %define       V_asterisk_codecs_ilbc     20110104
    41 %define       V_chan_capi                1.1.5.20110914
    43 #   package information
    44 Name:         asterisk
    45 Summary:      Private Branch Exchange (PBX)
    46 URL:          http://www.asterisk.org/
    47 Vendor:       Mark Spencer et al.
    48 Packager:     OpenPKG Foundation e.V.
    49 Distribution: OpenPKG Community
    50 Class:        BASE
    51 Group:        VoIP
    52 License:      GPL
    53 Version:      %{V_opkg}
    54 Release:      20120320
    56 #   package options
    57 %option       with_dahdi   no
    58 %option       with_capi    no
    59 %option       with_ogg     no
    60 %option       with_mp3     no
    61 %option       with_fax     no
    62 %option       with_avcodec no
    63 %option       with_ldap    no
    64 %option       with_radius  no
    65 %option       with_sqlite  no
    66 %option       with_srtp    no
    67 %option       with_pgsql   no
    68 %option       with_lua     no
    69 %option       with_gtalk   no
    70 %option       with_jabber  no
    71 %option       with_imap    no
    72 %option       with_odbc    no
    73 %option       with_libpri  no
    74 %option       with_esounds no
    75 %option       with_xfersips yes
    76 %option       with_proxymwi yes
    77 %option       with_smdipoll 10
    79 #   list of sources
    80 Source0:      http://downloads.asterisk.org/pub/telephony/asterisk/releases/asterisk-%{V_asterisk}.tar.gz
    81 Source1:      ftp://ftp.chan-capi.org/chan-capi/chan_capi-%{V_chan_capi}.tar.gz
    82 Source2:      ftp://ftp.europalab.com/pub/sfw/machsnds/asterisk-moh-freeplay-sln16.tar.gz
    84 Source3:      http://downloads.asterisk.org/pub/telephony/sounds/releases/asterisk-moh-opsound-sln16-%{V_asterisk_sounds_mohop}.tar.gz
    85 Source4:      http://downloads.asterisk.org/pub/telephony/sounds/releases/asterisk-core-sounds-en-sln16-%{V_asterisk_sounds_core}.tar.gz
    86 Source5:      http://downloads.asterisk.org/pub/telephony/sounds/releases/asterisk-core-sounds-es-sln16-%{V_asterisk_sounds_core}.tar.gz
    87 Source6:      http://downloads.asterisk.org/pub/telephony/sounds/releases/asterisk-core-sounds-en_AU-sln16-%{V_asterisk_sounds_core}.tar.gz
    88 Source7:      http://downloads.asterisk.org/pub/telephony/sounds/releases/asterisk-core-sounds-fr-sln16-%{V_asterisk_sounds_core}.tar.gz
    89 Source8:      http://downloads.asterisk.org/pub/telephony/sounds/releases/asterisk-core-sounds-ru-sln16-%{V_asterisk_sounds_core}.tar.gz
    90 Source9:      http://downloads.asterisk.org/pub/telephony/sounds/releases/asterisk-extra-sounds-en-sln16-%{V_asterisk_sounds_extra}.tar.gz
    91 Source10:     http://downloads.asterisk.org/pub/telephony/sounds/releases/asterisk-extra-sounds-fr-sln16-%{V_asterisk_sounds_extra}.tar.gz
    92 Source11:     http://www.amooma.de/asterisk/sprachbausteine/asterisk-%{V_asterisk_sounds_amoogab}-de-prompts.tar.gz
    93 Source12:     http://www.amooma.de/asterisk/sprachbausteine/asterisk-core-sounds-de-gsm-current.tar.gz
    94 Source13:     ftp://ftp.europalab.com/pub/sfw/machsnds/de-digits/de-digits-%{V_asterisk_sounds_custom}.tar.bz2
    95 Source14:     ftp://ftp.europalab.com/pub/sfw/machsnds/de-sounds/astmultisnds-de-sln16-%{V_asterisk_sounds_custom}.tar.bz2
    96 Source15:     ftp://ftp.europalab.com/pub/sfw/machsnds/msvbsnds-sln16-%{V_asterisk_sounds_custom}.tar.bz2
    97 Source16:     http://files.freeswitch.org/freeswitch-sounds-en-us-callie-48000-%{V_fswitch_sounds_en}.tar.gz
    98 Source17:     http://files.freeswitch.org/freeswitch-sounds-es-mx-maria-44100.tar.gz
    99 Source18:     http://files.freeswitch.org/freeswitch-sounds-fr-ca-june-48000-%{V_fswitch_sounds_fr}.tar.gz
   100 Source19:     http://files.freeswitch.org/freeswitch-sounds-ru-RU-elena-48000-%{V_fswitch_sounds_ru}.tar.gz
   101 Source20:     http://files.freeswitch.org/freeswitch-sounds-music-48000-%{V_fswitch_music}.tar.gz
   102 Source21:     http://svn.digium.com/svn/thirdparty/mp3/trunk/addons/mp3-%{V_asterisk_addons_mp3dec}.tar.gz
   103 Source22:     http://downloads.digium.com/pub/telephony/fax/res_fax_digium/asterisk-%{V_asterisk_fax_subdir}/x86-64/res_fax_digium-%{V_asterisk_fax_digium}-generic_64.tar.gz
   104 Source23:     http://downloads.digium.com/pub/telephony/fax/res_fax_digium/asterisk-%{V_asterisk_fax_subdir}/x86-32/res_fax_digium-%{V_asterisk_fax_digium}-generic_32.tar.gz
   105 Source24:     ilbc-20110104.tar.gz
   106 Source25:     asterisk.txt
   107 Source26:     rc.asterisk
   108 Source27:     wakeup.agi
   109 Patch0:       asterisk.patch
   110 Patch1:       asterisk.patch.xfersips
   111 Patch2:       asterisk.patch.proxymwi
   113 #   build information
   114 Prefix:       %{l_prefix}
   115 BuildRoot:    %{l_buildroot}
   116 BuildPreReq:  OpenPKG, openpkg >= 20060823, bison, gcc, make, grep, pkgconfig
   117 PreReq:       OpenPKG, openpkg >= 20060823, MTA
   118 BuildPreReq:  zlib, curl, openssl, ncurses, speex, sox, popt, gmime, libxml
   119 PreReq:       zlib, curl, openssl, ncurses, speex, sox, popt, gmime, libxml
   120 %if "%{with_ogg}" == "yes"
   121 BuildPreReq:  vorbis-libs
   122 PreReq:       vorbis-libs
   123 %endif
   124 %if "%{with_mp3}" == "yes"
   125 PreReq:       mpg123
   126 %endif
   127 %if "%{with_imap}" == "yes"
   128 BuildPreReq:  imap
   129 PreReq:       imap
   130 %endif
   131 %if "%{with_sqlite}" == "yes"
   132 BuildPreReq:  sqlite
   133 PreReq:       sqlite
   134 %endif
   135 %if "%{with_srtp}" == "yes"
   136 BuildPreReq:  srtp
   137 PreReq:       srtp
   138 %endif
   139 %if "%{with_pgsql}" == "yes"
   140 BuildPreReq:  postgresql
   141 PreReq:       postgresql
   142 %endif
   143 %if "%{with_lua}" == "yes"
   144 BuildPreReq:  lua
   145 PreReq:       lua
   146 %endif
   147 %if "%{with_avcodec}" == "yes"
   148 BuildPreReq:  ffmpeg
   149 PreReq:       ffmpeg
   150 %endif
   151 %if "%{with_ldap}" == "yes"
   152 BuildPreReq:  openldap
   153 PreReq:       openldap
   154 %endif
   155 %if "%{with_radius}" == "yes"
   156 BuildPreReq:  radiusclient
   157 PreReq:       radiusclient
   158 %endif
   159 %if "%{with_gtalk}" == "yes"
   160 %define       with_jabber yes
   161 %endif
   162 %if "%{with_jabber}" == "yes"
   163 BuildPreReq:  iksemel
   164 PreReq:       iksemel
   165 %endif
   166 %if "%{with_odbc}" == "yes"
   167 BuildPreReq:  unixodbc, sqlite, sqlite::with_odbc = yes
   168 PreReq:       unixodbc, sqlite, sqlite::with_odbc = yes
   169 %endif
   170 %if "%{with_libpri}" == "yes"
   171 BuildPreReq:  libpri > 1.4.11.5
   172 PreReq:       libpri > 1.4.11.5
   173 %endif
   174 %if "%{with_esounds}" == "yes"
   175 BuildPreReq:  sox
   176 %endif
   177 AutoReq:      no
   178 AutoReqProv:  no
   180 %description
   181     Asterisk is a complete Private Branch Exchange (PBX) in software.
   182     It provides more than the features normally expected from a PBX,
   183     and can transceive Voice over IP (VoIP) in many protocols. Asterisk
   184     provides voicemail services with directory, call conferencing,
   185     interactive voice response and call queuing as well. It has support
   186     for three way calling, caller ID, ADSI, and SIP, and requires no
   187     additional hardware for VoIP applications.
   189     This copy of Asterisk is optionally patched to allow the asterisk
   190     server to respond to SIP/TLS transfer requests using the Transfer()
   191     application. Should this option be chosen, the asterisk server
   192     successfully dispatches all transfer destinations using 'SIPS'
   193     technology by means of the standard SIP/2.0 302 Moved Temporarily
   194     message, with a URI resembling <sips:extension@hostname.tld:port>.
   196     This copy of Asterisk is optionally patched as well to enclose the
   197     correct user name in NOTIFY messages when MWI logic detects changes
   198     in the state of Messages-Waiting. Asterisk will send NOTIFY messages
   199     with the URI 'user@hostname' instead of simply 'hostname'. This can
   200     be used by a external SIP proxy to route the MWI to the correct phone.
   202 %track
   203     prog asterisk = {
   204         version   = %{V_asterisk}
   205         url       = http://downloads.asterisk.org/pub/telephony/asterisk/releases/
   206         regex     = asterisk-(\d+\.\d+(\.\d+)+)\.tar\.gz
   207     }
   208     prog asterisk:fax_digium_32 = {
   209         version   = %{V_asterisk_fax_digium}
   210         url       = http://downloads.digium.com/pub/telephony/fax/res_fax_digium/asterisk-1.8.0/x86-32/
   211         regex     = res_fax_digium-(__VER__)-generic_32.tar.gz\.tar\.gz
   212     }
   213     prog asterisk:fax_digium_64 = {
   214         version   = %{V_asterisk_fax_digium}
   215         url       = http://downloads.digium.com/pub/telephony/fax/res_fax_digium/asterisk-1.8.0/x86-64/
   216         regex     = res_fax_digium-(__VER__)-generic_64.tar.gz\.tar\.gz
   217     }
   218     prog asterisk:sounds_core = {
   219         version   = %{V_asterisk_sounds_core}
   220         url       = http://downloads.asterisk.org/pub/telephony/sounds/releases/
   221         regex     = asterisk-core-sounds-en-sln16-(\d+\.\d+(\.\d+)+)\.tar\.gz
   222     }
   223     prog asterisk:sounds_extra = {
   224         version   = %{V_asterisk_sounds_extra}
   225         url       = http://downloads.asterisk.org/pub/telephony/sounds/releases/
   226         regex     = asterisk-extra-sounds-en-sln16-(\d+\.\d+(\.\d+)+)\.tar\.gz
   227     }
   228     prog asterisk:sounds_amootts = {
   229         version   = %{V_asterisk_sounds_amootts}
   230         url       = http://www.amooma.de/asterisk/sprachbausteine/
   231         regex     = asterisk-core-sounds-de-gsm-(__VER__)\.tar\.gz
   232     }
   233     prog asterisk:sounds_amoogab = {
   234         version   = %{V_asterisk_sounds_amoogab}
   235         url       = http://www.amooma.de/asterisk/sprachbausteine/
   236         regex     = asterisk-(__VER__)-de-prompts\.tar\.gz
   237     }
   238     prog asterisk:sounds_digits = {
   239         version   = %{V_asterisk_sounds_custom}
   240         url       = ftp://ftp.europalab.com/pub/sfw/machsnds/de-digits/
   241         regex     = de-digits-(__VER__)\.tar\.bz2
   242     }
   243     prog asterisk:sounds_custom = {
   244         version   = %{V_asterisk_sounds_custom}
   245         url       = ftp://ftp.europalab.com/pub/sfw/machsnds/de-sounds/
   246         regex     = astmultisnds-de-sln16-(__VER__)\.tar\.bz2
   247     }
   248     prog asterisk:sounds_mohop = {
   249         version   = %{V_asterisk_sounds_mohop}
   250         url       = http://downloads.asterisk.org/pub/telephony/sounds/releases/
   251         regex     = asterisk-moh-opsound-sln16-(__VER__)\.tar\.gz
   252     }
   253     prog asterisk:chan_capi = {
   254         version   = %{V_chan_capi}
   255         url       = ftp://ftp.chan-capi.org/chan-capi/
   256         regex     = chan_capi-(__VER__)\.tar\.gz
   257     }
   259 %prep
   260 %if "%{with_capi}" == "yes"
   261     ( echo "Note that the system header files capi20.h, capicmd.h, and capiutils.h might"
   262       echo "need adjusting in accordance withthe CAPI hardware vendor's kernel driver."
   263     ) | %{l_rpmtool} msg -b -t warn
   264 %endif
   265     %setup -q -n asterisk-%{V_asterisk}
   266     %setup -q -n asterisk-%{V_asterisk} -D -T -a 1
   267     %setup -q -n asterisk-%{V_asterisk} -D -T -a 2
   268 %if "%{with_fax}" == "yes"
   269     %setup -q -n asterisk-%{V_asterisk} -D -T -a 22
   270     %setup -q -n asterisk-%{V_asterisk} -D -T -a 23
   271 %endif
   272     ( cd addons
   273       %{l_tar} zxf %{_sourcedir}/mp3-%{V_asterisk_addons_mp3dec}.tar.gz
   274     ) || exit $?
   275     ( cd codecs
   276       %{l_tar} zxf %{_sourcedir}/ilbc-%{V_asterisk_codecs_ilbc}.tar.gz
   277       mv ilbc-%{V_asterisk_codecs_ilbc}/* ilbc/
   278       rmdir ilbc-%{V_asterisk_codecs_ilbc}
   279     ) || exit $?
   280     %patch -p0
   281 %if "%{with_xfersips}" == "yes"
   282     %patch -p0 -P 1
   283 %endif
   284 %if "%{with_proxymwi}" == "yes"
   285     %patch -p0 -P 2
   286 %endif
   287     %{l_shtool} subst \
   288         -e 's;\(astdatadir=.*\)\${astvarlibdir};\1${datadir};' \
   289         -e 's;\(astvarlibdir=.*\)/lib/asterisk;\1/asterisk/lib;' \
   290         -e 's;\(astdbdir=.*\)\${astvarlibdir};\1${localstatedir}/asterisk/db;' \
   291         -e 's;\(dir=.*{localstatedir}\)/\([^/][^/]*\)/asterisk;\1/asterisk/\2;g' \
   292         configure
   293     %{l_shtool} subst \
   294         -e 's;ffmpeg/avcodec\.h;libavcodec/avcodec.h;' \
   295         -e 's;\(sqlite\)\(_exec\);\13\2;g' \
   296         -e 's;-lradiusclient-ng;-lradiusclient;g' \
   297         -e 's;radiusclient-ng\.h;radiusclient.h;g' \
   298         -e 's;lua5\.1;lua;g' \
   299         -e 's;-I${IMAP_TK_DIR}/c-client;-DUSE_SYSTEM_IMAP -I${IMAP_TK_DIR}/include/imap;g' \
   300         -e 's;${IMAP_TK_DIR}/c-client/c-client\.a;-limap -lssl -lcrypto -lcrypt;g' \
   301         configure
   302     %{l_shtool} subst \
   303         -e 's;\(sh\) \(bash\) ksh sh5;\2 \1;' \
   304         configure
   305     %{l_shtool} subst \
   306         -e 's;^\(#define DEFAULT_DB .*\${ASTDBDIR}\)/astdb;\1/asterisk.db;' \
   307         build_tools/make_defaults_h
   308     %{l_shtool} subst \
   309         -e 's;^\(_all:.* *\)cleantest *;\1;' \
   310         -e 's; *-I/usr/local/ssl/include;;g' \
   311         -e 's;/opt/ssl/include;%{l_prefix}/include;g' \
   312         -e 's;/usr/local;%{l_prefix};g' \
   313         Makefile
   314     %{l_shtool} subst \
   315         -e 's;\$(SUBMAKE);$(MAKE);g' \
   316         -e 's;\$(SILENTMAKE);$(MAKE) --quiet --no-print-directory;g' \
   317         -e 's;\$(MAKE_MENUSELECT); $(MAKE) -C menuselect;g' \
   318         Makefile
   319     %{l_shtool} subst \
   320         -e 's; *-L/usr/local/ssl/lib;;g' \
   321         -e 's;/opt/ssl/lib;%{l_prefix}/lib;g' \
   322         -e 's;/usr/local;%{l_prefix};g' \
   323         -e 's;\(ASTLINK=\)$;\1-Wl,--export-dynamic;g' \
   324         -e 's;\( CFLAGS=\)"[^"]+";"%{l_cflags -O}";g' \
   325         main/Makefile
   326     %{l_shtool} subst \
   327         -e 's;\(<defaultenabled>\)no\(</defaultenabled>\);\1yes\2;g' \
   328         apps/app_ivrdemo.c \
   329         apps/app_saycounted.c \
   330         apps/app_rpt.c \
   331         utils/utils.xml \
   332         agi/agi.xml
   333     %{l_shtool} subst \
   334         -e 's;\(-DSOLARIS\);\1 -D__EXTENSIONS__=1;g' \
   335         main/editline/Makefile.in \
   336         main/db1-ast/Makefile
   337     %{l_shtool} subst \
   338         -e 's;%s/astdb;%s/asterisk.db;g' \
   339         main/asterisk.c
   340     %{l_shtool} subst \
   341         -e 's;u_int\([0-9]*\)_t;uint\1_t;g' \
   342         main/db1-ast/hash/hash.h
   343     %{l_shtool} subst \
   344         -e 's;if \(((tmp = strchr(name\);while \1;g' \
   345         main/abstract_jb.c
   346     %{l_shtool} subst \
   347         -e 's;\(/etc/radiusclient-ng/radiusclient.conf\);%{l_prefix}\1;g' \
   348         -e 's;\(radiusclient\)-ng;\1;g' \
   349         cdr/cdr_radius.c \
   350         cel/cel_radius.c
   351     %{l_shtool} subst \
   352         -e 's;\(sqlite\)\(\.h\);\13\2;g' \
   353         cdr/cdr_sqlite.c
   354     %{l_shtool} subst \
   355         -e 's;\(#define DEFAULT_POLLING_INTERVAL\) .*;\1 %{with_smdipoll};' \
   356         res/res_smdi.c
   357     %{l_shtool} subst \
   358         -e 's;\(ASTERISK_HEADER_DIR=\).*;\1%{l_prefix}/include;g' \
   359         -e 's;\(MODULES_DIR=\).*;\1%{l_prefix}/lib/asterisk/modules;g' \
   360         -e 's;\(CONFIG_DIR=\).*;\1%{l_prefix}/etc/asterisk;g' \
   361         -e 's;\(\$(MODULES_DIR)\);$(DESTDIR)\1;g' \
   362         -e 's;\${CONFIG_DIR};$(DESTDIR)$(CONFIG_DIR);g' \
   363         -e 's;^\(USE_OWN_LIBCAPI\)=yes;\1=no;' \
   364         chan_capi-%{V_chan_capi}/Makefile
   365     %{l_shtool} subst \
   366         -e 's;if.*SSL_CTX_use_certificate_file.*;if (SSL_CTX_use_certificate_chain_file(cfg->ssl_ctx, cfg->certfile) == 0) {;' \
   367         main/tcptls.c
   369 %build
   370     #   sanity check operating system
   371 %if "%{with_dahdi}" == "yes"
   372     dahdi_prefix=""
   373     case "%{l_platform -t}" in
   374         *-linux* )
   375             if [ ! -f /usr/include/dahdi/user.h ]; then
   376                 echo "option \"with_dahdi\" requires DAHDI Linux drivers installed" 1>&2; exit 1
   377             fi
   378             dahdi_prefix=/usr
   379             ;;
   380         *-freebsd* )
   381             if [ ! -f /usr/local/include/dahdi/user.h ]; then
   382                 echo "option \"with_dahdi\" requires DAHDI FreeBSD drivers installed" 1>&2; exit 1
   383             fi
   384             dahdi_prefix=/usr/local
   385             ;;
   386         * ) echo "option \"with_dahdi\" supported under Linux and FreeBSD only" 1>&2; exit 1 ;;
   387     esac
   388 %endif
   389     #   correct platform dependent build configuration
   390     extflg=
   391     case "%{l_platform -t}" in
   392         *-linux* )
   393             pthlibflg='-lpthread'
   394             ;;
   395     esac
   397     #   adapt buildconf to find mpg123 (for music on hold)
   398 %if "%{with_mp3}" == "yes"
   399     mpg123="%{l_prefix}/bin/mpg123"
   400 %else
   401     mpg123="`which false`"
   402 %endif
   403     %{l_shtool} subst \
   404         -e "s;/usr/local/bin/mpg123;$mpg123;" \
   405         -e "s;/usr/bin/mpg123;$mpg123;" \
   406         res/res_musiconhold.c apps/app_mp3.c
   408     #   configure program
   409     ( echo "ac_cv_prog_CONFIG_GMIME=%{l_prefix}/bin/gmime-config"
   410     ) >config.cache
   411     cflags="%{l_cflags -O}"
   412     cppflags="%{l_cppflags ncurses lua}"
   413     ldflags="%{l_ldflags}"
   414     libs=""
   415     cppflags="$cppflags `pkg-config gmime-2.4 --cflags-only-I`"
   416     ldflags="$ldflags `pkg-config gmime-2.4 --libs-only-L`"
   417     libs="$libs `pkg-config gmime-2.4 --libs-only-l` -lssl -lcrypto"
   418 %if "%{with_ogg}" == "yes"
   419     libs="$libs -logg -lm"
   420 %endif
   421 %if "%{with_avcodec}" == "yes"
   422     libs="$libs -lavcodec -lavutil"
   423 %endif
   424 %if "%{with_ldap}" == "yes"
   425     libs="$libs -lldap -llber"
   426 %endif
   427 %if "%{with_dahdi}" == "yes"
   428     cppflags="$cppflags -I$dahdi_prefix/include"
   429     ldflags="$ldflags -L$dahdi_prefix/lib"
   430 %endif
   431     CC="%{l_cc}" \
   432     CFLAGS="$cflags" \
   433     CPPFLAGS="$cppflags" \
   434     LDFLAGS="$ldflags" \
   435     LIBS="$libs" \
   436     INSTALL="%{l_shtool} install -c" \
   437     PTHREAD_LIBS="$pthlibflg" \
   438     ./configure \
   439         --cache-file=./config.cache \
   440         --prefix=%{l_prefix} \
   441         --mandir=%{l_prefix}/man \
   442         --sysconfdir=%{l_prefix}/etc \
   443         --localstatedir=%{l_prefix}/var \
   444         --datarootdir=%{l_prefix}/share/asterisk \
   445         --with-crypto=%{l_prefix} \
   446         --with-libcurl=%{l_prefix} \
   447         --with-ncurses=%{l_prefix} \
   448         --with-gsm="internal" \
   449         --with-popt=%{l_prefix} \
   450 %if "%{with_sqlite}" == "yes"
   451         --with-sqlite3=%{l_prefix} \
   452 %else
   453         --without-sqlite3 \
   454 %endif
   455 %if "%{with_srtp}" == "yes"
   456         --with-srtp=%{l_prefix} \
   457 %else
   458         --without-srtp \
   459 %endif
   460 %if "%{with_pgsql}" == "yes"
   461         --with-postgres=%{l_prefix} \
   462 %else
   463         --with-postgres=no \
   464 %endif
   465         --with-speex=%{l_prefix} \
   466         --with-speexdsp=%{l_prefix} \
   467         --with-ssl=%{l_prefix} \
   468         --with-gmime=%{l_prefix} \
   469         --with-z=%{l_prefix} \
   470 %if "%{with_ogg}" == "yes"
   471         --with-ogg=%{l_prefix} \
   472         --with-vorbis=%{l_prefix} \
   473 %else
   474         --without-ogg \
   475         --without-vorbis \
   476 %endif
   477 %if "%{with_jabber}" == "yes"
   478         --with-iksemel=%{l_prefix} \
   479 %else
   480         --without-iksemel \
   481 %endif
   482 %if "%{with_lua}" == "yes"
   483         --with-lua=%{l_prefix} \
   484 %else
   485         --without-lua \
   486 %endif
   487 %if "%{with_dahdi}" == "yes"
   488         --with-dahdi=$dahdi_prefix \
   489         --with-tonezone=$dahdi_prefix \
   490 %else
   491         --without-dahdi \
   492         --without-tonezone \
   493 %endif
   494 %if "%{with_avcodec}" == "yes"
   495         --with-avcodec=%{l_prefix} \
   496 %else
   497         --without-avcodec \
   498 %endif
   499 %if "%{with_ldap}" == "yes"
   500         --with-ldap=%{l_prefix} \
   501 %else
   502         --without-ldap \
   503 %endif
   504 %if "%{with_radius}" == "yes"
   505         --with-radius=%{l_prefix} \
   506 %else
   507         --without-radius \
   508 %endif
   509 %if "%{with_imap}" == "yes"
   510         --with-imap=%{l_prefix} \
   511         --disable-largefile \
   512 %else
   513         --without-imap \
   514 %endif
   515         --without-iodbc \
   516 %if "%{with_odbc}" == "yes"
   517         --with-unixodbc=%{l_prefix} \
   518 %else
   519         --without-unixodbc \
   520 %endif
   521 %if "%{with_libpri}" == "yes"
   522         --with-pri=%{l_prefix} \
   523 %else
   524         --without-pri \
   525 %endif
   526         --with-sounds-cache=%_sourcedir \
   527         --without-netsnmp \
   528         --without-isdnnet \
   529         --without-misdn \
   530         --without-nbs \
   531         --without-newt \
   532         --without-asound \
   533         --without-oss \
   534         --without-sqlite \
   535         --without-tds \
   536         --without-osptk \
   537         --without-suppserv \
   538         --without-vpb \
   539         --without-sdl \
   540         --without-x11 \
   541         --without-gtk2
   543     #   build menuselect
   544     %{l_make} %{l_mflags -O} menuselect.makeopts
   545     menuselect/menuselect \
   546         --enable format_mp3 --enable app_fax --enable codec_ilbc \
   547         --enable RADIO_RELAX --enable G711_NEW_ALGORITHM \
   548         --enable G711_REDUCED_BRANCHING --enable CORE-SOUNDS-EN-SLN16 \
   549         --enable CORE-SOUNDS-ES-SLN16 --enable CORE-SOUNDS-FR-SLN16 \
   550         --enable CORE-SOUNDS-EN_AU-SLN16 --enable CORE-SOUNDS-RU-SLN16 \
   551         --enable MOH-OPSOUND-SLN16 --enable EXTRA-SOUNDS-EN-SLN16 \
   552         --enable EXTRA-SOUNDS-FR-SLN16 \
   553         menuselect.makeopts
   554     menuselect/menuselect \
   555         --disable CORE-SOUNDS-EN-GSM \
   556         --disable MOH-OPSOUND-WAV \
   557         menuselect.makeopts
   558 %if "%{with_imap}" == "yes"
   559     menuselect/menuselect --enable IMAP_STORAGE menuselect.makeopts
   560 %endif
   562     #   build program
   563     %{l_make} %{l_mflags -O} \
   564         CC="%{l_cc} $cflags -I../include -I../../include $cppflags" NOISY_BUILD=yes
   566 %if "%{with_capi}" == "yes"
   567     #   build capi channel
   568     ( cd chan_capi-*
   569       ln -s ../include/asterisk .
   570       ln -s ../include/asterisk.h .
   571       %{l_make} %{l_mflags -O} V=1 \
   572           INSTALL_PREFIX=%{l_prefix} \
   573           ASTERISK_HEADER_DIR="`pwd`" \
   574     ) || exit $?
   575 %endif
   577 %install
   578     #   install program
   579     rm -rf $RPM_BUILD_ROOT
   580     %{l_make} %{l_mflags} install \
   581         DESTDIR=$RPM_BUILD_ROOT \
   582         INSTALL_PREFIX=%{l_prefix}
   584 %if "%{with_capi}" == "yes"
   585     #   install capi channel
   586     ( cd chan_capi-*
   587       %{l_make} %{l_mflags} install \
   588           INSTALL_PREFIX=$RPM_BUILD_ROOT%{l_prefix} \
   589           INSTALL="%{l_shtool} install -c" \
   590           MODULES_DIR='$(INSTALL_PREFIX)/lib/asterisk/modules'
   591     ) || exit $?
   592 %endif
   594 %if "%{with_fax}" == "yes"
   595     #   install fax support
   596     case "%{l_platform -t}" in
   597         amd64*-* )
   598             %{l_shtool} install -c -m 755 \
   599                 res_fax_digium-%{V_asterisk_fax_digium}-generic_64/res_*.so \
   600                 $RPM_BUILD_ROOT%{l_prefix}/lib/asterisk/modules/
   601             %{l_shtool} install -c -m 640 \
   602                 res_fax_digium-%{V_asterisk_fax_digium}-generic_64/*.conf \
   603                 $RPM_BUILD_ROOT%{l_prefix}/etc/asterisk/
   604             ;;
   605         i?86-* )
   606             %{l_shtool} install -c -m 755 \
   607                 res_fax_digium-%{V_asterisk_fax_digium}-generic_32/res_*.so \
   608                 $RPM_BUILD_ROOT%{l_prefix}/lib/asterisk/modules/
   609             %{l_shtool} install -c -m 640 \
   610                 res_fax_digium-%{V_asterisk_fax_digium}-generic_32/*.conf \
   611                 $RPM_BUILD_ROOT%{l_prefix}/etc/asterisk/
   612             ;;
   613         *-* )
   614             echo "Error determining hardware architecture." \
   615                 | %{l_rpmtool} msg -b -t warn
   616             exit 1;
   617             ;;
   618     esac
   619 %endif
   621     ( echo 'Start of sound installation block (RPM)'
   622 %if "%{with_esounds}" == "yes"
   623       #   install freeswitch sound prompt files, expecting
   624       #   identical sound filenames to be overwritten later
   625       cd $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/en
   626       %{l_tar} zxf %{_sourcedir}/freeswitch-sounds-en-us-callie-48000-%{V_fswitch_sounds_en}.tar.gz
   627       subs=`( cd en/us/callie && find * -type d -prune )`
   628       for subdir in $subs; do
   629           mkdir $subdir
   630           mv -f en/us/callie/$subdir/*/* ${subdir}/
   631       done
   632       rm -rf en
   633       cd $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/es
   634       %{l_tar} zxf %{_sourcedir}/freeswitch-sounds-es-mx-maria-44100.tar.gz
   635       subs=`( cd es/mx/maria && find * -type d -prune )`
   636       for subdir in $subs; do
   637           mkdir $subdir
   638           mv -f es/mx/maria/$subdir/*/* ${subdir}/
   639       done
   640       rm -rf es
   641       %{l_shtool} mkdir -f -p -m 755 \
   642           $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/ru
   643       cd $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/ru
   644       %{l_tar} zxf %{_sourcedir}/freeswitch-sounds-ru-RU-elena-48000-%{V_fswitch_sounds_ru}.tar.gz
   645       subs=`( cd ru/RU/elena && find * -type d -prune )`
   646       for subdir in $subs; do
   647           mkdir $subdir
   648           mv -f ru/RU/elena/$subdir/*/* ${subdir}/
   649       done
   650       rm -rf ru
   652       #   install freeswitch music on hold files
   653       cd $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/moh
   654       %{l_tar} zxf %{_sourcedir}/freeswitch-sounds-music-48000-%{V_fswitch_music}.tar.gz
   655       mv -f music/48000/* . && rm -rf music
   657       #   convert freeswitch 48000 and 441000 KHz to 8000 Khz
   658       #   ffmpeg -i <in> -ar 8000 -ac 1 -acodec pcm_s16le -f s16le <out>
   659       cd $RPM_BUILD_ROOT%{l_prefix}/share/asterisk
   660       for highfile in `find . -name '*.wav'`; do
   661           lowfile=`echo $highfile | sed -e 's;\(.*\)\.wav;\1.sln16;'`
   662           %{l_prefix}/bin/sox $highfile -t raw -r 16000 -s -2 -c 1 $lowfile
   663           rm $highfile
   664       done
   665 %endif
   667       #   install australian nonversioned sound prompt files
   668       cd $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/en_AU
   669       %{l_tar} zxf %%{_sourcedir}/asterisk-core-sounds-en_AU-sln16-%{V_asterisk_sounds_core}.tar.gz
   671       #   install main sound prompt files
   672       #for codec in alaw ulaw g722 g729 gsm; do
   673       for lang in en es fr; do
   674           cd $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/${lang}
   675           %{l_tar} zxf %{_sourcedir}/asterisk-core-sounds-${lang}-sln16-%{V_asterisk_sounds_core}.tar.gz
   676       done
   677       for lang in en fr; do
   678           cd $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/${lang}
   679           %{l_tar} zxf %{_sourcedir}/asterisk-extra-sounds-${lang}-sln16-%{V_asterisk_sounds_extra}.tar.gz
   680       done
   682       #   install special case sound files
   683       cd $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds
   684       #%{l_tar} jxf %{SOURCE de-digits-%{V_asterisk_sounds_custom}.tar.bz2}
   685       #( cd de && %{l_tar} zxf %{SOURCE asterisk-core-sounds-de-gsm-%{V_asterisk_sounds_amootts}.tar.gz} ) || exit $?
   686       #%{l_tar} zxf %{SOURCE asterisk-%{V_asterisk_sounds_amoogab}-de-prompts.tar.gz}
   687       #mv -f dictate/de/* de/dictate/ && rm -rf dictate/de
   688       #mv -f digits/de/* de/digits/ && rm -rf digits/de
   689       #mv -f letters/de/* de/letters/ && rm -rf letters/de
   690       #mv -f phonetic/de/* de/phonetic/ && rm -rf phonetic/de
   691       %{l_tar} jxf %{SOURCE astmultisnds-de-sln16-%{V_asterisk_sounds_custom}.tar.bz2}
   692       %{l_tar} jxf %{SOURCE msvbsnds-sln16-%{V_asterisk_sounds_custom}.tar.bz2}
   693       mv msvbsnds-sln16-%{V_asterisk_sounds_custom} msvb
   695       #   install additional asterisk music on hold
   696       cd $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/moh
   697       %{l_tar} zxf %{_sourcedir}/asterisk-moh-freeplay-sln16.tar.gz
   698       %{l_tar} zxf %{_sourcedir}/asterisk-moh-opsound-sln16-%{V_asterisk_sounds_mohop}.tar.gz
   700       #   correct sound permissions
   701       find $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/ -type f \
   702           | xargs chmod 644
   703       find $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/ -type d \
   704           | xargs chmod 755
   706       #   apply provisional workaround for bug 0016104
   707       #   https://issues.asterisk.org/view.php?id=16104
   708       cd $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds
   709       cd en && ln -s vm-INBOX.sln16 vm-Voicemail.sln16
   710       cd ../es && ln -s vm-INBOX.sln16 vm-Voicemail.sln16
   711       cd ../de && ln -s vm-INBOX.sln16 vm-Voicemail.sln16
   712       cd ../fr && ln -s vm-INBOX.sln16 vm-Voicemail.sln16
   714 #      #   install nonstandard voicemail prompts
   715 #      %{l_shtool} mkdir -f -p -m 755 \
   716 #          $RPM_BUILD_ROOT%{l_prefix}/var/asterisk/spool/voicemail/default/%{exten}/unavail
   717 #      %{l_shtool} install -c -m 660 \
   718 #          %{_sourcedir}/ansage-%{V_ansage}.wav} \
   719 #          $RPM_BUILD_ROOT%{l_prefix}/var/asterisk/spool/voicemail/default/%{exten}/unavail.wav
   720     ) || exit $?  # End of sound installation block (RPM)
   722     #   strip down installation
   723     rm -f $RPM_BUILD_ROOT%{l_prefix}/sbin/autosupport >/dev/null 2>&1 || true
   724     rm -f $RPM_BUILD_ROOT%{l_prefix}/sbin/safe_asterisk >/dev/null 2>&1 || true
   725     rm -f $RPM_BUILD_ROOT%{l_prefix}/man/man8/autosupport.8 >/dev/null 2>&1 || true
   726     rm -f $RPM_BUILD_ROOT%{l_prefix}/man/man8/safe_asterisk.8 >/dev/null 2>&1 || true
   727     rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/images >/dev/null 2>&1 || true
   728     rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/moh/.asterisk* >/dev/null 2>&1 || true
   729     rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/moh/CREDIT* >/dev/null 2>&1 || true
   730     rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/moh/CHANGES* >/dev/null 2>&1 || true
   731     rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/moh/LICENSE* >/dev/null 2>&1 || true
   732     rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/*/CREDIT* >/dev/null 2>&1 || true
   733     rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/*/CHANGES* >/dev/null 2>&1 || true
   734     rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/*/.asterisk* >/dev/null 2>&1 || true
   736     #   create additional directories
   737     %{l_shtool} mkdir -f -p -m 755 \
   738         $RPM_BUILD_ROOT%{l_prefix}/var/asterisk/db \
   739         $RPM_BUILD_ROOT%{l_prefix}/var/asterisk/spool/facsimile/rx \
   740         $RPM_BUILD_ROOT%{l_prefix}/var/asterisk/spool/facsimile/tx \
   741         $RPM_BUILD_ROOT%{l_prefix}/var/asterisk/spool/outgoing \
   742         $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/licenses
   744     #   postadjust installation
   745     strip $RPM_BUILD_ROOT%{l_prefix}/sbin/* \
   746           $RPM_BUILD_ROOT%{l_prefix}/lib/asterisk/modules/* \
   747           $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/agi-bin/* \
   748           >/dev/null 2>&1 || true
   749     mv  $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/agi-bin \
   750         $RPM_BUILD_ROOT%{l_prefix}/lib/asterisk/agi-bin
   752     #   install AGI progs
   753     ( cd agi
   754       %{l_shtool} install -c -m 755 %{l_value -s -a} \
   755           DialAnMp3.agi fastagi-test numeralize %{SOURCE wakeup.agi} \
   756           $RPM_BUILD_ROOT%{l_prefix}/lib/asterisk/agi-bin/
   757     ) || exit $?
   758     for bin in $RPM_BUILD_ROOT%{l_prefix}/lib/asterisk/agi-bin/*.*; do
   759         mv $bin `echo $bin | sed -e 's;\.[^.]*$;;'`
   760     done
   762     #   install default configuration
   763     for name in `grep "^<file" %{SOURCE asterisk.txt} | sed -e 's;^.*name=";;' -e 's;".*$;;'`; do
   764 %if "%{with_dahdi}" == "no"
   765         [ ".$name" = ".chan_dahdi.conf" ] && continue
   766 %endif
   767 %if "%{with_capi}" == "no"
   768         [ ".$name" = ".capi.conf" ] && continue
   769 %endif
   770 %if "%{with_gtalk}" == "no"
   771         [ ".$name" = ".gtalk.conf" ] && continue
   772 %endif
   773 %if "%{with_jabber}" == "no"
   774         [ ".$name" = ".jabber.conf" ] && continue
   775 %endif
   776 %if "%{with_sqlite}" == "no"
   777         [ ".$name" = ".cdr_sqlite3_custom.conf" ] && continue
   778 %endif
   779 %if "%{with_odbc}" == "no"
   780         [ ".$name" = ".res_odbc.conf" ] && continue
   781         [ ".$name" = ".func_odbc.conf" ] && continue
   782 %endif
   783         (echo ""; cat %{SOURCE asterisk.txt}; echo "") |\
   784             sed -e "1,/^<file name=\"$name\">/d" -e "/<\/file>/,\$d" >$name
   785         %{l_shtool} install -c -m 644 %{l_value -s -a} \
   786             $name $RPM_BUILD_ROOT%{l_prefix}/etc/asterisk/
   787     done
   789     #   install runcommand script
   790     %{l_shtool} mkdir -f -p -m 755 \
   791         $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
   792     %{l_shtool} install -c -m 755 %{l_value -s -a} \
   793         %{SOURCE rc.asterisk} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
   795     #   determine installation files
   796     %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
   797         %{l_files_std} \
   798         '%config %attr(640,%{l_mgrp},%{l_rgrp}) %{l_prefix}/etc/asterisk/*' \
   799         '%config %attr(-,%{l_mgrp},%{l_mgrp}) %{l_prefix}/share/asterisk/licenses' \
   800         '%attr(750,%{l_rgrp},%{l_rgrp}) %{l_prefix}/var/asterisk/spool/facsimile' \
   801         '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/asterisk'
   803 #        '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/share/asterisk/sounds/es/vm-Voicemail.sln16' \
   804 #        '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/share/asterisk/sounds/de/vm-Voicemail.sln16' \
   805 #        '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/share/asterisk/sounds/fr/vm-Voicemail.sln16' \
   807 %files -f files
   809 %clean
   810     rm -rf $RPM_BUILD_ROOT
   812 %post
   813 %if "%{with_dahdi}" == "yes"
   814     if [ $1 -eq 1 ]; then
   815         case "%{l_platform -t}" in
   816             *-freebsd* )
   817                 ( echo "To allow Asterisk to use the DAHDI /dev/dahdi/pseudo device(s)"
   818                   echo "you have add the following entry to /etc/devfs.rules:"
   819                   echo ""
   820                   echo "[openpkg_asterisk=10]"
   821                   echo "add path 'dahdi/pseudo*' mode 0664 user %{l_rusr} group %{l_rgrp}"
   822                   echo ""
   823                 ) | %{l_rpmtool} msg -b -t notice
   824                 ;;
   825         esac
   826     fi
   827 %endif
   828 %if "%{with_odbc}" == "yes"
   829     #   after install, optionally link into ODBC and create database
   830     if $RPM_INSTALL_PREFIX/bin/odbcinst -q -s -n "asterisk-sqlite" >/dev/null 2>&1; then
   831         :
   832     else
   833         ( echo "[asterisk-sqlite]"
   834           echo "Description = Asterisk SQLite Database"
   835           echo "Driver      = SQLite3"
   836           echo "Database    = $RPM_INSTALL_PREFIX/var/asterisk/db/asterisk.sqlite"
   837           echo "Timeout     = 2000"
   838         ) | $RPM_INSTALL_PREFIX/bin/odbcinst -i -s -l -n "asterisk-sqlite" -r >/dev/null 2>&1 || true
   839     fi
   840     if [ ! -f $RPM_INSTALL_PREFIX/var/asterisk/run/asterisk.db ]; then
   841         ( umask 007
   842           echo "CREATE TABLE map (key TEXT, val TEXT);" | $RPM_INSTALL_PREFIX/bin/isql "asterisk-sqlite" -b
   843           chown %{l_rusr}:%{l_rgrp} $RPM_INSTALL_PREFIX/var/asterisk/db/asterisk.sqlite >/dev/null 2>&1 || true
   844         ) || exit $?
   845     fi
   846 %endif
   847 %if "%{with_fax}" == "yes"
   848     ( echo "Asterisk has been installed with proprietary Digium fax support."
   849       echo "The responsible module is called res_fax_digium and requires a"
   850       echo "valid license. The license must be found in the directory"
   851       echo "'licenses' which in turn must be found in %{l_prefix}/share/asterisk"
   852       echo "or wherever astvarlibdir has been configured in 'asterisk.conf'."
   853       echo ""
   854       echo "Please see http://downloads.digium.com/pub/telephony/fax/ for information."
   855     ) | %{l_rpmtool} msg -b -t notice
   856 %endif
   857     #   after upgrade, restart service
   858     [ $1 -eq 2 ] || exit 0
   859     eval `%{l_rc} asterisk status 2>/dev/null`
   860     [ ".$asterisk_active" = .yes ] && %{l_rc} asterisk restart
   861     exit 0
   863 %preun
   864     #   before erase, stop service and remove log files
   865     [ $1 -eq 0 ] || exit 0
   866     %{l_rc} asterisk stop 2>/dev/null
   867     rm -f $RPM_INSTALL_PREFIX/var/asterisk/log/*       >/dev/null 2>&1 || true
   868     rm -f $RPM_INSTALL_PREFIX/var/asterisk/log/cdr-*/* >/dev/null 2>&1 || true
   869     rm -f $RPM_INSTALL_PREFIX/var/asterisk/run/*       >/dev/null 2>&1 || true
   870     rm -f $RPM_INSTALL_PREFIX/var/asterisk/spool/*/*   >/dev/null 2>&1 || true
   871     rm -f $RPM_INSTALL_PREFIX/var/asterisk/lib/*       >/dev/null 2>&1 || true
   872     rm -f $RPM_INSTALL_PREFIX/var/asterisk/db/*        >/dev/null 2>&1 || true
   873 %if "%{with_odbc}" == "yes"
   874     #   before erase, optionally unlink from ODBC and destroy database
   875     $RPM_INSTALL_PREFIX/bin/odbcinst -u -s -l -n "asterisk-sqlite" >/dev/null 2>&1 || true
   876 %endif
   877     exit 0

mercurial