asterisk/asterisk.spec

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

mercurial