asterisk/asterisk.spec

Fri, 02 Dec 2011 16:12:09 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Fri, 02 Dec 2011 16:12:09 +0100
changeset 398
08f5eb82b58f
parent 362
7c568c62ffb3
child 399
9360a38b5c9f
permissions
-rw-r--r--

Correct patch logic and update sound versions including russian.

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

mercurial