Mon, 27 Apr 2009 12:19:05 +0200
Import new package spec for introduction into repository.
1 ##
2 ## asterisk.spec -- OpenPKG RPM Package Specification
3 ## Copyright (c) 2000-2007 OpenPKG Foundation e.V. <http://openpkg.net/>
4 ## Copyright (c) 2000-2007 Ralf S. Engelschall <http://engelschall.com/>
5 ##
6 ## Permission to use, copy, modify, and distribute this software for
7 ## any purpose with or without fee is hereby granted, provided that
8 ## the above copyright notice and this permission notice appear in all
9 ## copies.
10 ##
11 ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
12 ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
13 ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
14 ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
15 ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
16 ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
17 ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
18 ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
19 ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
20 ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
21 ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
22 ## SUCH DAMAGE.
23 ##
25 # package component versions
26 %define V_langsounds 1.4.12
27 %define V_extrasounds 1.4.9
28 %define V_amoomasounds 1.4
29 %define V_customsounds 1.0
30 %define V_chan_capi 1.1.2
32 # package information
33 Name: asterisk
34 Summary: Private Branch Exchange (PBX) for VoIP
35 URL: http://www.asterisk.org/
36 Vendor: Mark Spencer et al.
37 Packager: Michael Schloh von Bennewitz
38 Distribution: Michael Schloh von Bennewitz
39 Class: EVAL
40 Group: VoIP
41 License: GPL
42 Version: 1.4.24.1
43 Release: 20090422
45 # package options
46 %option with_libpri yes
47 %option with_xfersips yes
48 %option with_proxymwi yes
49 %option with_parseavp yes
50 %option with_radius no
51 %option with_sqlite no
52 %option with_pgsql no
53 %option with_curl no
54 %option with_imap no
55 %option with_astman no
56 %option with_capi no
57 %option with_zaptel no
58 %option with_smdipoll 10
60 # list of sources
61 Source0: http://downloads.digium.com/pub/asterisk/releases/asterisk-%{version}.tar.gz
62 Source1: ftp://ftp.chan-capi.org/chan-capi/chan_capi-%{V_chan_capi}.tar.gz
63 Source2: http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-moh-freeplay-alaw.tar.gz
64 Source3: http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-moh-freeplay-g722.tar.gz
65 Source4: http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-moh-freeplay-g729.tar.gz
66 Source5: http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-moh-freeplay-gsm.tar.gz
67 Source6: http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-moh-freeplay-ulaw.tar.gz
68 Source7: http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-extra-sounds-en-alaw-%{V_extrasounds}.tar.gz
69 Source8: http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-extra-sounds-en-g722-%{V_extrasounds}.tar.gz
70 Source9: http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-extra-sounds-en-g729-%{V_extrasounds}.tar.gz
71 Source10: http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-extra-sounds-en-gsm-%{V_extrasounds}.tar.gz
72 Source11: http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-extra-sounds-en-ulaw-%{V_extrasounds}.tar.gz
73 Source12: http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-core-sounds-en-alaw-%{V_langsounds}.tar.gz
74 Source13: http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-core-sounds-en-g722-%{V_langsounds}.tar.gz
75 Source14: http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-core-sounds-en-g729-%{V_langsounds}.tar.gz
76 Source15: http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-core-sounds-en-gsm-%{V_langsounds}.tar.gz
77 Source16: http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-core-sounds-en-ulaw-%{V_langsounds}.tar.gz
78 Source17: http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-core-sounds-es-alaw-%{V_langsounds}.tar.gz
79 Source18: http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-core-sounds-es-g722-%{V_langsounds}.tar.gz
80 Source19: http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-core-sounds-es-g729-%{V_langsounds}.tar.gz
81 Source20: http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-core-sounds-es-gsm-%{V_langsounds}.tar.gz
82 Source21: http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-core-sounds-es-ulaw-%{V_langsounds}.tar.gz
83 Source22: http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-core-sounds-fr-alaw-%{V_langsounds}.tar.gz
84 Source23: http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-core-sounds-fr-g722-%{V_langsounds}.tar.gz
85 Source24: http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-core-sounds-fr-g729-%{V_langsounds}.tar.gz
86 Source25: http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-core-sounds-fr-gsm-%{V_langsounds}.tar.gz
87 Source26: http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-core-sounds-fr-ulaw-%{V_langsounds}.tar.gz
88 Source27: http://www.amooma.de/asterisk/sprachbausteine/asterisk-%{V_amoomasounds}-de-prompts.tar.gz
89 Source28: http://www.amooma.de/asterisk/sprachbausteine/asterisk-core-sounds-de-gsm-current.tar.gz
90 Source29: ftp://ftp.europalab.com/pub/sfw/machsnds/de-digits/de-digits-%{V_customsounds}.tar.bz2
91 Source30: asterisk.conf
92 Source31: amd.conf
93 Source32: capi.conf
94 Source33: cdr.conf
95 Source34: cdr_custom.conf
96 Source35: codecs.conf
97 Source36: dundi.conf
98 Source37: enum.conf
99 Source38: extensions.conf
100 Source39: features.conf
101 Source40: festival.conf
102 Source41: followme.conf
103 Source42: indications.conf
104 Source33: logger.conf
105 Source34: manager.conf
106 Source45: meetme.conf
107 Source46: misdn.conf
108 Source47: modules.conf
109 Source48: musiconhold.conf
110 Source49: privacy.conf
111 Source50: rpt.conf
112 Source51: rtp.conf
113 Source52: say.conf
114 Source53: sip.conf
115 Source54: sip_notify.conf
116 Source55: sla.conf
117 Source56: voicemail.conf
118 Source57: zapata.conf
119 Source58: rc.asterisk
120 Source59: wakeup.agi
121 Patch0: asterisk.patch
122 Patch1: asterisk.patch.xfersips
123 Patch2: asterisk.patch.proxymwi
124 Patch3: asterisk.patch.parseavp
126 # build information
127 Prefix: %{l_prefix}
128 BuildRoot: %{l_buildroot}
129 BuildPreReq: OpenPKG, openpkg >= 20040130, pkgconfig, awk, grep
130 PreReq: OpenPKG, openpkg >= 20040130
131 BuildPreReq: ncurses, openssl, zlib
132 PreReq: ncurses, openssl, zlib
133 BuildPreReq: speex, vorbis-libs, sox
134 PreReq: speex, vorbis-libs, sox
135 %if "%{with_libpri}" == "yes"
136 BuildPreReq: libpri
137 PreReq: libpri
138 %endif
139 %if "%{with_radius}" == "yes"
140 BuildPreReq: radiusclient
141 PreReq: radiusclient
142 %endif
143 %if "%{with_sqlite}" == "yes"
144 BuildPreReq: sqlite
145 PreReq: sqlite
146 %endif
147 %if "%{with_pgsql}" == "yes"
148 BuildPreReq: postgresql
149 PreReq: postgresql
150 %endif
151 %if "%{with_curl}" == "yes"
152 BuildPreReq: curl
153 PreReq: curl
154 %endif
155 %if "%{with_imap}" == "yes"
156 BuildPreReq: imap
157 PreReq: imap
158 %endif
159 %if "%{with_astman}" == "yes"
160 BuildPreReq: newt
161 PreReq: newt
162 %endif
163 AutoReq: no
164 AutoReqProv: no
166 %description
167 Asterisk is a complete Private Branch Exchange (PBX) in software.
168 It provides all of the features you would expect from a PBX and
169 more. Asterisk does Voice over IP (VoIP) in many protocols. Asterisk
170 provides Voicemail services with Directory, Call Conferencing,
171 Interactive Voice Response and Call Queuing. It has support for
172 three-way calling, caller ID services, ADSI, SIP, etc. Asterisk
173 needs no additional hardware for VoIP.
175 This copy of Asterisk is optionally patched to allow the asterisk
176 server to respond to SIP/TLS transfer requests using the Transfer()
177 application. Should this option be chosen, the asterisk server
178 successfully dispatches all transfer destinations using 'SIPS'
179 technology by means of the standard SIP/2.0 302 Moved Temporarily
180 message, with a URI resembling <sips:extension@hostname.tld:port>.
182 This copy of Asterisk is optionally patched as well to enclose the
183 correct user name in NOTIFY messages when MWI logic detects changes
184 in the state of Messages-Waiting. Asterisk will send NOTIFY messages
185 with the URI 'user@hostname' instead of simply 'hostname'. This can
186 be used by a external SIP proxy to route the MWI to the correct phone.
188 %track
189 prog asterisk = {
190 version = %{version}
191 url = http://downloads.digium.com/pub/asterisk/releases/
192 regex = asterisk-(__VER__)\.tar\.gz
193 }
195 %prep
196 %setup -q -n asterisk-%{version}
197 %setup -q -n asterisk-%{version} -D -T -a 1
198 %patch -p0
199 %if "%{with_xfersips}" == "yes"
200 %patch -p0 -P 1
201 %endif
202 %if "%{with_proxymwi}" == "yes"
203 %patch -p0 -P 2
204 %endif
205 %if "%{with_parseavp}" == "yes"
206 %patch -p0 -P 3
207 %endif
209 # link install-sh to where Makefiles expect it
210 for dir in agi utils res channels pbx apps codecs formats cdr funcs main; do
211 ( cd $dir && ln -s ../install-sh ) || exit $?
212 done
214 # apply corrections
215 case "%{l_platform -t}" in
216 *-sunos* )
217 %{l_shtool} subst \
218 -e 's|\(tmp->tm_gmtoff = ttisp->tt_gmtoff;\)|/*\1*/|' \
219 main/stdtime/localtime.c
220 ;;
221 esac
222 %{l_shtool} subst \
223 -e 's;sysconfdir=/etc;true;' \
224 -e 's;mandir=/usr/share/man;true;' \
225 -e 's;localstatedir=/var;true;' \
226 -e 's;\(radiusclient\)-ng;\1;g' \
227 -e 's;\(\-lsqlite\);\13;g' \
228 -e 's;\(sqlite\)\(\.h\);\13\2;g' \
229 -e 's;\(sqlite\)\(_exec\);\13\2;g' \
230 -e 's;^\(LIBS="-lvorbis\);\1 ${OGG_LIB};' \
231 -e 's;\(#include <\${NCURSES_DIR}/include\);\1/ncurses;' \
232 -e 's;-I${IMAP_TK_DIR}/c-client;-I${IMAP_TK_DIR}/include/imap;g' \
233 -e 's;${IMAP_TK_DIR}/c-client/c-client\.a;-limap -lssl -lcrypto -lcrypt;g' \
234 configure
235 %{l_shtool} subst \
236 -e 's; *-I/usr/local/ssl/include;;g' \
237 -e 's;/opt/ssl/include;%{l_prefix}/include;g' \
238 -e 's;/usr/local;%{l_prefix};g' \
239 -e 's;^\(MOD_SUBDIR_CFLAGS=.*\ *\)$;\1 -I%{l_prefix}/include;' \
240 -e 's;^\( *ASTETCDIR\)=.*;\1=$(sysconfdir)/asterisk;g' \
241 -e 's;^\( *ASTLIBDIR\)=.*;\1=$(libdir)/asterisk;g' \
242 -e 's;^\( *ASTHEADERDIR\)=.*;\1=$(includedir)/asterisk;g' \
243 -e 's;^\( *ASTBINDIR\)=.*;\1=$(bindir);g' \
244 -e 's;^\( *ASTSBINDIR\)=.*;\1=$(sbindir);g' \
245 -e 's;^\( *ASTSPOOLDIR\)=.*;\1=$(localstatedir)/asterisk/spool;g' \
246 -e 's;^\( *ASTLOGDIR\)=.*;\1=$(localstatedir)/asterisk/log;g' \
247 -e 's;^\( *ASTVARRUNDIR\)=.*;\1=$(localstatedir)/asterisk/run;g' \
248 -e 's;^\( *ASTMANDIR\)=.*;\1=$(mandir);g' \
249 -e 's;^\( *ASTVARLIBDIR\)=.*;\1=$(localstatedir)/asterisk/lib;g' \
250 -e 's;^\( *ASTVARRUNDIR\)=.*;\1=$(localstatedir)/asterisk/run;g' \
251 -e 's;^\( *ASTDATADIR\):*=.*;\1=$(datadir)/asterisk;g' \
252 -e 's/\(for f in\) \(\$(OLDMODS); do \\\)$/\1 "warning:" \2/' \
253 Makefile
254 #-e 's;\(ASTSPOOLDIR=\$(localstatedir)\)\(/spool\)\(/asterisk\);\1\3\2;' \
255 #-e 's;\(ASTLOGDIR=\$(localstatedir)\)\(/log\)\(/asterisk\);\1\3\2;' \
256 #-e 's;\(ASTVARRUNDIR=\$(localstatedir)\)\(/run\);\1/asterisk\2;' \
257 #-e 's;\(ASTVARRUNDIR=\$(localstatedir)\)\(/run\)\(/asterisk\);\1\3\2;' \
258 #-e 's;\(ASTVARLIBDIR=\$(localstatedir)\)\(/lib\)\(/asterisk\);\1\3\2;' \
259 #-e 's;\(ASTDATADIR:=\)\$(ASTVARLIBDIR);\1$(prefix)/share/asterisk;' \
260 #Makefile
261 %{l_shtool} subst \
262 -e 's; *-L/usr/local/ssl/lib;;g' \
263 -e 's;/opt/ssl/lib;%{l_prefix}/lib;g' \
264 -e 's;/usr/local;%{l_prefix};g' \
265 -e 's;\(ASTLINK=\)$;\1-Wl,--export-dynamic;g' \
266 main/Makefile
267 %{l_shtool} subst \
268 -e 's;LOG_WARNING\(, "Failed to perform seek\);LOG_DEBUG\1;g' \
269 main/channel.c
270 %{l_shtool} subst \
271 -e 's;LOG_WARNING\(, "[^ ][^ ]* is not supported\);LOG_DEBUG\1;g' \
272 formats/format_ogg_vorbis.c
273 %{l_shtool} subst \
274 -e 's;\(/etc/radiusclient-ng/radiusclient.conf\);%{l_prefix}\1;g' \
275 -e 's;\(radiusclient\)-ng;\1;g' \
276 cdr/cdr_radius.c
277 %{l_shtool} subst \
278 -e 's;\(sqlite\)\(\.h\);\13\2;g' \
279 cdr/cdr_sqlite.c
280 %{l_shtool} subst \
281 -e 's;\(#define DEFAULT_POLLING_INTERVAL\) *.*;\1 %{with_smdipoll};' \
282 res/res_smdi.c
283 %{l_shtool} subst \
284 -e 's;\(ASTERISK_HEADER_DIR=\).*;\1%{l_prefix}/include;g' \
285 -e 's;\(MODULES_DIR=\).*;\1%{l_prefix}/lib/asterisk/modules;g' \
286 -e 's;\(CONFIG_DIR=\).*;\1%{l_prefix}/etc/asterisk;g' \
287 -e 's;\(\$(MODULES_DIR)\);$(DESTDIR)\1;g' \
288 -e 's;\${CONFIG_DIR};$(DESTDIR)$(CONFIG_DIR);g' \
289 chan_capi-%{V_chan_capi}/Makefile
291 # # optionally specify CPU
292 # %{l_shtool} subst \
293 # -e 's;build_cpu=\$1;build_cpu=i586;' \
294 # -e 's;host_cpu=\$1;host_cpu=i586;' \
295 # configure
297 %build
298 # apply platform build rules
299 libs="`pkg-config openssl speex --libs-only-l`"
300 %if "%{with_curl}" == "yes"
301 libs="$libs `pkg-config libcurl --libs-only-l`"
302 %endif
303 %if "%{with_sqlite}" == "yes"
304 libs="$libs `pkg-config sqlite3 --libs-only-l`"
305 %endif
306 %if "%{with_pgsql}" == "yes"
307 libs="-lpq $libs"
308 %endif
309 %if "%{with_radius}" == "yes"
310 libs="$libs -lradiusclient"
311 %endif
312 %if "%{with_libpri}" == "yes"
313 libs="$libs -lpri"
314 %endif
315 case "%{l_platform -t}" in
316 *-linux* ) libs="$libs -lrt" ;;
317 *-sunos* ) libs="$libs -lrt" ;;
318 esac
320 # configure package
321 CC="%{l_cc}" \
322 CFLAGS="%{l_cflags -O}" \
323 %if "%{with_imap}" == "yes"
324 CPPFLAGS="%{l_cppflags imap ncurses}" \
325 %else
326 CPPFLAGS="%{l_cppflags ncurses}" \
327 %endif
328 LDFLAGS="%{l_ldflags}" \
329 LIBS="$libs" \
330 ./configure \
331 --prefix=%{l_prefix} \
332 --mandir=%{l_prefix}/man \
333 --with-ncurses=%{l_prefix} \
334 %if "%{with_libpri}" == "yes"
335 --with-pri=%{l_prefix} \
336 %else
337 --with-pri=no \
338 %endif
339 --with-ssl=%{l_prefix} \
340 %if "%{with_radius}" == "yes"
341 --with-radius=%{l_prefix} \
342 %else
343 --with-radius=no \
344 %endif
345 %if "%{with_sqlite}" == "yes"
346 --with-sqlite=%{l_prefix} \
347 %else
348 --with-sqlite=no \
349 %endif
350 %if "%{with_postgresql}" == "yes"
351 --with-postgres=%{l_prefix} \
352 %else
353 --with-postgres=no \
354 %endif
355 %if "%{with_curl}" == "yes"
356 --with-curl=%{l_prefix} \
357 %else
358 --with-curl=no \
359 %endif
360 %if "%{with_imap}" == "yes"
361 --with-imap=%{l_prefix} \
362 --disable-largefile \
363 %else
364 --with-imap=no \
365 %endif
366 %if "%{with_astman}" == "yes"
367 --with-newt=%{l_prefix} \
368 %else
369 --with-newt=no \
370 %endif
371 --with-speex=%{l_prefix} \
372 --with-speexdsp=%{l_prefix} \
373 --with-ogg=%{l_prefix} \
374 --with-vorbis=%{l_prefix} \
375 --with-z=%{l_prefix}
377 # build package
378 %{l_make} %{l_mflags -O} menuselect/menuselect menuselect-tree
379 menuselect/menuselect --check-deps menuselect.makeopts
380 %{l_shtool} subst \
381 -e 's;\(MENUSELECT_MOH=\).*;\1;' \
382 -e 's;\(MENUSELECT_CORE_SOUNDS=\).*;\1;' \
383 -e 's;\(MENUSELECT_EXTRA_SOUNDS=\).*;\1;' \
384 menuselect.makeopts
385 %if "%{with_imap}" == "yes"
386 %{l_shtool} subst \
387 -e 's;\(MENUSELECT_OPTS_app_voicemail=\)$;\1IMAP_STORAGE;' \
388 menuselect.makeopts
389 %endif
390 %{l_make} %{l_mflags -O} EXTLIBS="$libs" NOISY_BUILD=yes
391 %if "%{with_capi}" == "yes"
392 ( cd chan_capi-%{V_chan_capi}
393 %{l_make} %{l_mflags -O}
394 ) || exit $?
395 %endif
397 %install
398 rm -rf $RPM_BUILD_ROOT
400 # install package
401 %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT
402 %if "%{with_capi}" == "yes"
403 ( cd chan_capi-%{V_chan_capi}
404 %{l_make} %{l_mflags} install samples DESTDIR=$RPM_BUILD_ROOT
405 ) || exit $?
406 %endif
408 # install all sound prompt files
409 for codec in alaw ulaw g722 g729 gsm; do
410 for lang in es fr; do
411 ( cd $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/${lang}
412 %{l_tar} zxf %{_sourcedir}/asterisk-core-sounds-${lang}-${codec}-%{V_langsounds}.tar.gz
413 ) || exit $?
414 done
415 ( cd $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds
416 %{l_tar} zxf %{_sourcedir}/asterisk-extra-sounds-en-${codec}-%{V_extrasounds}.tar.gz
417 %{l_tar} zxf %{_sourcedir}/asterisk-core-sounds-en-${codec}-%{V_langsounds}.tar.gz
418 ) || exit $?
419 done
421 # install special case sound files
422 ( cd $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds
423 %{l_tar} jxf %{SOURCE de-digits-%{V_customsounds}.tar.bz2}
424 %{l_tar} zxf %{SOURCE asterisk-core-sounds-de-gsm-current.tar.gz}
425 cd de
426 %{l_tar} zxf %{_sourcedir}/asterisk-%{V_amoomasounds}-de-prompts.tar.gz
427 mv -f de/* . && rm -rf de
428 mv -f dictate/de/* letters/ && rm -rf dictate/de
429 mv -f digits/de/* letters/ && rm -rf digits/de
430 mv -f letters/de/* letters/ && rm -rf letters/de
431 mv -f phonetic/de/* letters/ && rm -rf phonetic/de
432 ) || exit $?
434 # install additional music on hold files
435 ( cd $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/moh
436 for codec in alaw ulaw g722 g729 gsm; do
437 %{l_tar} zxf %{_sourcedir}/asterisk-moh-freeplay-${codec}.tar.gz
438 done
439 ) || exit $?
441 # # install nonstandard voicemail prompts
442 # %{l_shtool} mkdir -f -p -m 755 \
443 # $RPM_BUILD_ROOT%{l_prefix}/var/asterisk/spool/voicemail/default/%{exten}/unavail
444 # %{l_shtool} install -c -m 660 \
445 # %{_sourcedir}/ansage-%{V_ansage}.wav} \
446 # $RPM_BUILD_ROOT%{l_prefix}/var/asterisk/spool/voicemail/default/%{exten}/unavail.wav
448 # install default configuration
449 %{l_shtool} install -c -m 660 %{l_value -s -a} \
450 %{SOURCE asterisk.conf} \
451 %{SOURCE amd.conf} \
452 %{SOURCE cdr.conf} \
453 %{SOURCE codecs.conf} \
454 %{SOURCE extensions.conf} \
455 %{SOURCE features.conf} \
456 %{SOURCE festival.conf} \
457 %{SOURCE followme.conf} \
458 %{SOURCE indications.conf} \
459 %{SOURCE logger.conf} \
460 %{SOURCE manager.conf} \
461 %{SOURCE meetme.conf} \
462 %{SOURCE modules.conf} \
463 %{SOURCE musiconhold.conf} \
464 %{SOURCE rtp.conf} \
465 %{SOURCE sip.conf} \
466 %{SOURCE sla.conf} \
467 %{SOURCE voicemail.conf} \
468 %{SOURCE zapata.conf} \
469 $RPM_BUILD_ROOT%{l_prefix}/etc/asterisk/
471 # install runcommand script
472 %{l_shtool} mkdir -f -p -m 755 \
473 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
474 %{l_shtool} install -c -m 755 %{l_value -s -a} \
475 %{SOURCE rc.asterisk} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
477 # install additional AGI scripts
478 %{l_shtool} install -c -m 755 %{l_value -s -a} \
479 %{SOURCE wakeup.agi} $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/agi-bin/
481 # correct installation hierarchy
482 %{l_shtool} mkdir -f -p -m 755 \
483 $RPM_BUILD_ROOT%{l_prefix}/var/asterisk/lib \
484 $RPM_BUILD_ROOT%{l_prefix}/var/asterisk/spool/outgoing
486 # remove unused components
487 rm -rf \
488 $RPM_BUILD_ROOT%{l_prefix}/bin \
489 $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/images \
490 $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/de/.DS_Store \
491 $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/de/autogen.sh \
492 >/dev/null 2>&1 || true
494 # adjust inconsistent names
495 for bin in $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/agi-bin/*.*; do
496 mv $bin `echo $bin | sed -e 's;\.[^.]*$;;'`
497 done
499 # strip down installation
500 strip $RPM_BUILD_ROOT%{l_prefix}/bin/* \
501 $RPM_BUILD_ROOT%{l_prefix}/sbin/* \
502 $RPM_BUILD_ROOT%{l_prefix}/lib/asterisk/modules/* \
503 $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/agi-bin/* \
504 >/dev/null 2>&1 || true
506 # determine installation files
507 %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std} \
508 '%config %attr(660,%{l_musr},%{l_rgrp}) %{l_prefix}/etc/asterisk/*' \
509 '%config %attr(644,%{l_musr},%{l_mgrp}) %{l_prefix}/share/asterisk/sounds/de/*' \
510 '%config %attr(755,%{l_musr},%{l_mgrp}) %{l_prefix}/share/asterisk/sounds/de/dictate' \
511 '%config %attr(755,%{l_musr},%{l_mgrp}) %{l_prefix}/share/asterisk/sounds/de/digits' \
512 '%config %attr(755,%{l_musr},%{l_mgrp}) %{l_prefix}/share/asterisk/sounds/de/followme' \
513 '%config %attr(755,%{l_musr},%{l_mgrp}) %{l_prefix}/share/asterisk/sounds/de/letters' \
514 '%config %attr(755,%{l_musr},%{l_mgrp}) %{l_prefix}/share/asterisk/sounds/de/phonetic' \
515 '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/asterisk/*' \
516 '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/asterisk/*/*'
518 %files -f files
520 %clean
521 rm -rf $RPM_BUILD_ROOT
523 %post
524 # after upgrade, restart service
525 [ $1 -eq 2 ] || exit 0
526 eval `%{l_rc} asterisk status 2>/dev/null`
527 [ ".$asterisk_active" = .yes ] && %{l_rc} asterisk restart
528 exit 0
530 %preun
531 # before erase, stop service and remove log files
532 [ $1 -eq 0 ] || exit 0
533 %{l_rc} asterisk stop 2>/dev/null
534 rm -f $RPM_INSTALL_PREFIX/var/asterisk/lib/* >/dev/null 2>&1 || true
535 rm -f $RPM_INSTALL_PREFIX/var/asterisk/log/* >/dev/null 2>&1 || true
536 rm -f $RPM_INSTALL_PREFIX/var/asterisk/log/cdr-*/* >/dev/null 2>&1 || true
537 rm -f $RPM_INSTALL_PREFIX/var/asterisk/run/* >/dev/null 2>&1 || true
538 for deldir in meetme outgoing system tmp; do
539 rm -rf \
540 $RPM_INSTALL_PREFIX/var/asterisk/spool/$deldir \
541 >/dev/null 2>&1 || true
542 done
543 exit 0