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.

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

mercurial