1 |
commit: a66a68bc50f569a9f199820e6a826d3ca9865df3 |
2 |
Author: Jaco Kroon <jaco <AT> uls <DOT> co <DOT> za> |
3 |
AuthorDate: Wed May 13 17:49:52 2020 +0000 |
4 |
Commit: Aaron Bauman <bman <AT> gentoo <DOT> org> |
5 |
CommitDate: Thu May 14 22:12:13 2020 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a66a68bc |
7 |
|
8 |
net-misc/asterisk: cleanup |
9 |
|
10 |
Package-Manager: Portage-2.3.99, Repoman-2.3.22 |
11 |
Signed-off-by: Jaco Kroon <jaco <AT> uls.co.za> |
12 |
Bug: https://bugs.gentoo.org/720184 |
13 |
Closes: https://github.com/gentoo/gentoo/pull/15779 |
14 |
Signed-off-by: Aaron Bauman <bman <AT> gentoo.org> |
15 |
|
16 |
net-misc/asterisk/Manifest | 2 - |
17 |
net-misc/asterisk/asterisk-13.32.0-r1.ebuild | 323 ------------------ |
18 |
net-misc/asterisk/asterisk-16.9.0.ebuild | 315 ----------------- |
19 |
.../files/asterisk-13.32.0-binutils-2.34.patch | 18 - |
20 |
.../asterisk-historic-dahdiras-without-root.patch | 23 -- |
21 |
.../asterisk-historic-dundi-null-dereference.patch | 40 --- |
22 |
...terisk-historic-invert-gmine-search-order.patch | 12 - |
23 |
.../asterisk/files/asterisk-historic-uclibc.patch | 23 -- |
24 |
net-misc/asterisk/files/initd-13.32.0 | 380 --------------------- |
25 |
9 files changed, 1136 deletions(-) |
26 |
|
27 |
diff --git a/net-misc/asterisk/Manifest b/net-misc/asterisk/Manifest |
28 |
index 14846d5bc2c..890a5adc971 100644 |
29 |
--- a/net-misc/asterisk/Manifest |
30 |
+++ b/net-misc/asterisk/Manifest |
31 |
@@ -1,7 +1,5 @@ |
32 |
DIST asterisk-11.25.3.tar.gz 35134682 BLAKE2B 9da24d5d6a674ab660edb103e5fc56ddfbcc58cd86166cc08cceb0598a63b51eae36133565e09a30ad11ff6623ba8945437dfb561d2916f68341d398540dabce SHA512 9c0521d55e5b69663ea40066d52e397ba6c165a4b20cd0a1e5e375b9c0e5a6e4f37908e50b0b580e288dec9be252af9a8bce7bceb03ba029f902fb757e6311ed |
33 |
-DIST asterisk-13.32.0.tar.gz 33652378 BLAKE2B c6b0ca0895b25526c135332966f33761b74a88dec4a7b0ff0fe40263640ee2fb928eca29e716fba3cc8e96c6e395e7c70c36f41def6a0d055baac2a5c7b8637a SHA512 daafcd5d3544725e7a96bd467d998c4d74fd3c5d7e9d8fb4ce16e340ce09c502b1603e468e89c5a62b59282848b4ff0a43bdbcd75902cd11f6951d828511e841 |
34 |
DIST asterisk-13.33.0.tar.gz 33683712 BLAKE2B ecfc122628c08e93fc389f111e1ee8ddcf3d27895437df9da5b83a6440c2135f9223a5605e0ef436e8585f8b023abba5b74680cac97f1700e1bc153872c1ed87 SHA512 b866a63cce7c289d32333b4b3b0a605c413b48fc7518976aa0768dd5c68894348d0de1c9bc7c56b73eb86b69e0fd9847d7226fa0f9e449f8ebb8a7118329db56 |
35 |
DIST asterisk-16.10.0.tar.gz 27706766 BLAKE2B b8d7866fe3e8420ef5ce6ea5e016316f63e4f2e8904a79de69c4ddfb7aedcd00f09cfb414da43938af0771cdde387dcebfe716eb34e5ed1de3a30ff534459c7f SHA512 254c582593cf6ec691649d995a8d73260d2e340ad6ae65f0af62f6b8c3ef59c4da6ad9172bc04cc29a907d1e8d2ef105ae2ae20190b30115d5d402423c8c08cb |
36 |
-DIST asterisk-16.9.0.tar.gz 27674324 BLAKE2B 991fb0146f5dea338a8c6ad98007e2ac1b182ac2ed7dbabd4143aa7f968dc353563ac4aba18bb07e9b0a705dabd1446319b06f4be284922a804d5c2dbddf6f7b SHA512 b8101fa3cc6068230b6b9a28a558415e7104b9bc3a8c0c245af34e9839cf1eb287739a2142ad0227d2fef41e6d40a5c01128a0b44a7ecaae13a00767d0fa8ab9 |
37 |
DIST gentoo-asterisk-patchset-3.17.tar.bz2 5074 BLAKE2B 3c945e77b54b2449253acb9fcea8d289a7a3184729190622c14aff5557d36c93556efa83320fe4e7ae84021960c09f35ae9f997e8015706eef933aae2948309e SHA512 37f86f3c699b2643afd8080391e817a282571694bb56e00efd0734918dbc33d6c12a2463dbc24667597420863b4f506870140fbb8ef3f1700124ef790ae7252d |
38 |
DIST gentoo-asterisk-patchset-4.08.tar.bz2 2176 BLAKE2B 7f8c9b5fda855091e66b2534d2be23fb1616f565480459f71f766826e5deeeecb24899e2ee9eefe74323e892624d32ab954ec7e9be6a002431ff029fc13493ed SHA512 365c1b8628882c48c279e1fd77d982e6d0820ba7d7122e97bb4988f875d7010caa956798c833c3b01d389004fa08a63a9de2c1b452c9e5701c6106e29fd8e9e1 |
39 |
|
40 |
diff --git a/net-misc/asterisk/asterisk-13.32.0-r1.ebuild b/net-misc/asterisk/asterisk-13.32.0-r1.ebuild |
41 |
deleted file mode 100644 |
42 |
index 49dc718b5c0..00000000000 |
43 |
--- a/net-misc/asterisk/asterisk-13.32.0-r1.ebuild |
44 |
+++ /dev/null |
45 |
@@ -1,323 +0,0 @@ |
46 |
-# Copyright 1999-2020 Gentoo Authors |
47 |
-# Distributed under the terms of the GNU General Public License v2 |
48 |
- |
49 |
-EAPI=7 |
50 |
- |
51 |
-inherit autotools linux-info systemd |
52 |
- |
53 |
-MY_P="${PN}-${PV/_/-}" |
54 |
- |
55 |
-DESCRIPTION="Asterisk: A Modular Open Source PBX System" |
56 |
-HOMEPAGE="https://www.asterisk.org/" |
57 |
-SRC_URI="https://downloads.asterisk.org/pub/telephony/asterisk/releases/${MY_P}.tar.gz |
58 |
- https://downloads.uls.co.za/gentoo/asterisk/gentoo-asterisk-patchset-4.08.tar.bz2" |
59 |
-LICENSE="GPL-2" |
60 |
-SLOT="0" |
61 |
-KEYWORDS="amd64 ~ppc x86" |
62 |
- |
63 |
-IUSE_VOICEMAIL_STORAGE=" |
64 |
- +voicemail_storage_file |
65 |
- voicemail_storage_odbc |
66 |
- voicemail_storage_imap |
67 |
-" |
68 |
-IUSE="${IUSE_VOICEMAIL_STORAGE} alsa bluetooth calendar +caps cluster curl dahdi debug doc freetds gtalk http iconv ilbc ldap libedit libressl lua mysql newt +samples odbc osplookup oss pjproject portaudio postgres radius selinux snmp span speex srtp +ssl static statsd syslog vorbis xmpp" |
69 |
-IUSE_EXPAND="VOICEMAIL_STORAGE" |
70 |
-REQUIRED_USE="gtalk? ( xmpp ) |
71 |
- ^^ ( ${IUSE_VOICEMAIL_STORAGE/+/} ) |
72 |
- voicemail_storage_odbc? ( odbc ) |
73 |
-" |
74 |
- |
75 |
-PATCHES=( |
76 |
- "${FILESDIR}/asterisk-historic-uclibc.patch" |
77 |
- "${FILESDIR}/asterisk-historic-dahdiras-without-root.patch" |
78 |
- "${FILESDIR}/asterisk-historic-invert-gmine-search-order.patch" |
79 |
- "${FILESDIR}/asterisk-historic-dundi-null-dereference.patch" |
80 |
- "${FILESDIR}/asterisk-historic-no-var-run-install.patch" |
81 |
- "${FILESDIR}/asterisk-13.32.0-binutils-2.34.patch" |
82 |
-) |
83 |
- |
84 |
-DEPEND="acct-user/asterisk |
85 |
- acct-group/asterisk |
86 |
- dev-db/sqlite:3 |
87 |
- dev-libs/popt |
88 |
- dev-libs/jansson |
89 |
- dev-libs/libxml2:2 |
90 |
- dev-libs/libxslt |
91 |
- sys-libs/ncurses:0= |
92 |
- sys-libs/zlib |
93 |
- alsa? ( media-libs/alsa-lib ) |
94 |
- bluetooth? ( net-wireless/bluez:= ) |
95 |
- calendar? ( |
96 |
- net-libs/neon:= |
97 |
- dev-libs/libical:= |
98 |
- dev-libs/iksemel |
99 |
- ) |
100 |
- caps? ( sys-libs/libcap ) |
101 |
- cluster? ( sys-cluster/corosync ) |
102 |
- curl? ( net-misc/curl ) |
103 |
- dahdi? ( |
104 |
- net-libs/libpri |
105 |
- net-misc/dahdi-tools |
106 |
- ) |
107 |
- freetds? ( dev-db/freetds ) |
108 |
- gtalk? ( dev-libs/iksemel ) |
109 |
- http? ( dev-libs/gmime:2.6 ) |
110 |
- iconv? ( virtual/libiconv ) |
111 |
- ilbc? ( dev-libs/ilbc-rfc3951 ) |
112 |
- ldap? ( net-nds/openldap ) |
113 |
- libedit? ( dev-libs/libedit ) |
114 |
- lua? ( dev-lang/lua:* ) |
115 |
- mysql? ( dev-db/mysql-connector-c:= ) |
116 |
- newt? ( dev-libs/newt ) |
117 |
- odbc? ( dev-db/unixODBC ) |
118 |
- osplookup? ( net-libs/osptoolkit ) |
119 |
- pjproject? ( net-libs/pjproject ) |
120 |
- portaudio? ( media-libs/portaudio ) |
121 |
- postgres? ( dev-db/postgresql:* ) |
122 |
- radius? ( net-dialup/freeradius-client ) |
123 |
- snmp? ( net-analyzer/net-snmp:= ) |
124 |
- span? ( media-libs/spandsp ) |
125 |
- speex? ( |
126 |
- media-libs/speex |
127 |
- media-libs/speexdsp |
128 |
- ) |
129 |
- srtp? ( net-libs/libsrtp:0 ) |
130 |
- ssl? ( |
131 |
- !libressl? ( dev-libs/openssl:0= ) |
132 |
- libressl? ( dev-libs/libressl:0= ) |
133 |
- ) |
134 |
- vorbis? ( media-libs/libvorbis ) |
135 |
- voicemail_storage_imap? ( virtual/imap-c-client ) |
136 |
- xmpp? ( dev-libs/iksemel ) |
137 |
-" |
138 |
- |
139 |
-RDEPEND="${DEPEND} |
140 |
- net-misc/asterisk-core-sounds |
141 |
- net-misc/asterisk-extra-sounds |
142 |
- net-misc/asterisk-moh-opsound |
143 |
- selinux? ( sec-policy/selinux-asterisk ) |
144 |
- syslog? ( virtual/logger )" |
145 |
- |
146 |
-BDEPEND="virtual/pkgconfig" |
147 |
- |
148 |
-S="${WORKDIR}/${MY_P}" |
149 |
- |
150 |
-QA_DT_NEEDED="/usr/lib.*/libasteriskssl[.]so[.][0-9]\+" |
151 |
- |
152 |
-pkg_setup() { |
153 |
- CONFIG_CHECK="~!NF_CONNTRACK_SIP" |
154 |
- local WARNING_NF_CONNTRACK_SIP="SIP (NAT) connection tracking is enabled. Some users |
155 |
- have reported that this module dropped critical SIP packets in their deployments. You |
156 |
- may want to disable it if you see such problems." |
157 |
- check_extra_config |
158 |
-} |
159 |
- |
160 |
-src_prepare() { |
161 |
- default |
162 |
- AT_M4DIR="autoconf third-party third-party/pjproject third-party/jansson" eautoreconf |
163 |
-} |
164 |
- |
165 |
-function menuselect() { |
166 |
- menuselect/menuselect "$@" || die "menuselect $* failed." |
167 |
-} |
168 |
- |
169 |
-src_configure() { |
170 |
- local vmst |
171 |
- |
172 |
- econf \ |
173 |
- --libdir="/usr/$(get_libdir)" \ |
174 |
- --localstatedir="/var" \ |
175 |
- --with-crypto \ |
176 |
- --with-gsm=internal \ |
177 |
- --with-popt \ |
178 |
- --with-z \ |
179 |
- --without-libedit \ |
180 |
- $(use_with caps cap) \ |
181 |
- $(use_with http gmime) \ |
182 |
- $(use_with newt) \ |
183 |
- $(use_with pjproject) \ |
184 |
- $(use_with portaudio) \ |
185 |
- $(use_with ssl) |
186 |
- |
187 |
- # Blank out sounds/sounds.xml file to prevent |
188 |
- # asterisk from installing sounds files (we pull them in via |
189 |
- # asterisk-{core,extra}-sounds and asterisk-moh-opsound. |
190 |
- >"${S}"/sounds/sounds.xml |
191 |
- |
192 |
- # That NATIVE_ARCH chatter really is quite bothersome |
193 |
- sed -i 's/NATIVE_ARCH=/NATIVE_ARCH=0/' build_tools/menuselect-deps || die "Unable to squelch noisy build system" |
194 |
- |
195 |
- # Compile menuselect binary for optional components |
196 |
- emake NOISE_BUILD=yes menuselect.makeopts |
197 |
- |
198 |
- # Disable BUILD_NATIVE (bug #667498) |
199 |
- menuselect --disable build_native menuselect.makeopts |
200 |
- |
201 |
- # Broken functionality is forcibly disabled (bug #360143) |
202 |
- menuselect --disable chan_misdn menuselect.makeopts |
203 |
- menuselect --disable chan_ooh323 menuselect.makeopts |
204 |
- |
205 |
- # Utility set is forcibly enabled (bug #358001) |
206 |
- menuselect --enable smsq menuselect.makeopts |
207 |
- menuselect --enable streamplayer menuselect.makeopts |
208 |
- menuselect --enable aelparse menuselect.makeopts |
209 |
- menuselect --enable astman menuselect.makeopts |
210 |
- |
211 |
- # this is connected, otherwise it would not find |
212 |
- # ast_pktccops_gate_alloc symbol |
213 |
- menuselect --enable chan_mgcp menuselect.makeopts |
214 |
- menuselect --enable res_pktccops menuselect.makeopts |
215 |
- |
216 |
- # SSL is forcibly enabled, IAX2 & DUNDI are expected to be available |
217 |
- menuselect --enable pbx_dundi menuselect.makeopts |
218 |
- menuselect --enable func_aes menuselect.makeopts |
219 |
- menuselect --enable chan_iax2 menuselect.makeopts |
220 |
- |
221 |
- # SQlite3 is now the main database backend, enable related features |
222 |
- menuselect --enable cdr_sqlite3_custom menuselect.makeopts |
223 |
- menuselect --enable cel_sqlite3_custom menuselect.makeopts |
224 |
- |
225 |
- # The others are based on USE-flag settings |
226 |
- use_select() { |
227 |
- local state=$(use "$1" && echo enable || echo disable) |
228 |
- shift # remove use from parameters |
229 |
- |
230 |
- while [[ -n $1 ]]; do |
231 |
- menuselect --${state} "$1" menuselect.makeopts |
232 |
- shift |
233 |
- done |
234 |
- } |
235 |
- |
236 |
- use_select alsa chan_alsa |
237 |
- use_select bluetooth chan_mobile |
238 |
- use_select calendar res_calendar res_calendar_{caldav,ews,exchange,icalendar} |
239 |
- use_select cluster res_corosync |
240 |
- use_select curl func_curl res_config_curl res_curl |
241 |
- use_select dahdi app_dahdiras app_meetme chan_dahdi codec_dahdi res_timing_dahdi |
242 |
- use_select freetds {cdr,cel}_tds |
243 |
- use_select gtalk chan_motif |
244 |
- use_select http res_http_post |
245 |
- use_select iconv func_iconv |
246 |
- use_select ilbc codec_ilbc format_ilbc |
247 |
- use_select ldap res_config_ldap |
248 |
- use_select lua pbx_lua |
249 |
- use_select mysql app_mysql cdr_mysql res_config_mysql |
250 |
- use_select odbc cdr_adaptive_odbc res_config_odbc {cdr,cel,res,func}_odbc |
251 |
- use_select osplookup app_osplookup |
252 |
- use_select oss chan_oss |
253 |
- use_select postgres {cdr,cel}_pgsql res_config_pgsql |
254 |
- use_select radius {cdr,cel}_radius |
255 |
- use_select snmp res_snmp |
256 |
- use_select span res_fax_spandsp |
257 |
- use_select speex {codec,func}_speex |
258 |
- use_select srtp res_srtp |
259 |
- use_select statsd res_statsd res_{endpoint,chan}_stats |
260 |
- use_select syslog cdr_syslog |
261 |
- use_select vorbis format_ogg_vorbis |
262 |
- use_select xmpp res_xmpp |
263 |
- |
264 |
- # Voicemail storage ... |
265 |
- for vmst in ${IUSE_VOICEMAIL_STORAGE/+/}; do |
266 |
- if use ${vmst}; then |
267 |
- menuselect --enable $(echo ${vmst##*_} | tr '[:lower:]' '[:upper:]')_STORAGE menuselect.makeopts |
268 |
- fi |
269 |
- done |
270 |
- |
271 |
- if use debug; then |
272 |
- for o in DONT_OPTIMIZE DEBUG_THREADS BETTER_BACKTRACES; do |
273 |
- menuselect --enable $o menuselect.makeopts |
274 |
- done |
275 |
- fi |
276 |
-} |
277 |
- |
278 |
-src_compile() { |
279 |
- emake ASTCFLAGS="${CFLAGS}" ASTLDFLAGS="${LDFLAGS}" NOISY_BUILD=yes |
280 |
-} |
281 |
- |
282 |
-src_install() { |
283 |
- local d |
284 |
- |
285 |
- mkdir -p "${ED}/usr/$(get_libdir)/pkgconfig" || die |
286 |
- emake DESTDIR="${ED}" NOISY_BUILD=yes install |
287 |
- |
288 |
- if use radius; then |
289 |
- insinto /etc/radiusclient/ |
290 |
- doins contrib/dictionary.digium |
291 |
- fi |
292 |
- diropts -m 0750 -o root -g asterisk |
293 |
- keepdir /etc/asterisk |
294 |
- if use samples; then |
295 |
- emake NOISY_BUILD=yes DESTDIR="${ED}" CONFIG_SRC=configs/samples CONFIG_EXTEN=.sample install-configs |
296 |
- for conffile in "${ED}/etc/asterisk/"* |
297 |
- do |
298 |
- fowners root:root "${conffile#${ED}}" |
299 |
- fperms 0644 "${conffile#${ED}}" |
300 |
- done |
301 |
- fi |
302 |
- |
303 |
- # keep directories |
304 |
- diropts -m 0750 -o asterisk -g root |
305 |
- keepdir /var/lib/asterisk |
306 |
- keepdir /var/spool/asterisk |
307 |
- keepdir /var/spool/asterisk/{system,tmp,meetme,monitor,dictate,voicemail,recording} |
308 |
- diropts -m 0750 -o asterisk -g asterisk |
309 |
- keepdir /var/log/asterisk/{cdr-csv,cdr-custom} |
310 |
- |
311 |
- newinitd "${FILESDIR}"/initd-13.32.0-r1 asterisk |
312 |
- newconfd "${FILESDIR}"/confd-13.32.0 asterisk |
313 |
- |
314 |
- systemd_dounit "${FILESDIR}"/asterisk.service |
315 |
- systemd_newtmpfilesd "${FILESDIR}"/asterisk.tmpfiles.conf asterisk.conf |
316 |
- systemd_install_serviced "${FILESDIR}"/asterisk.service.conf |
317 |
- |
318 |
- # Reset diropts else dodoc uses it for doc installations. |
319 |
- diropts -m0755 |
320 |
- |
321 |
- # install the upgrade documentation |
322 |
- dodoc UPGRADE* BUGS CREDITS |
323 |
- |
324 |
- # install extra documentation |
325 |
- if use doc; then |
326 |
- dodoc doc/*.txt |
327 |
- dodoc doc/*.pdf |
328 |
- fi |
329 |
- |
330 |
- # install SIP scripts; bug #300832 |
331 |
- # |
332 |
- dodoc "${FILESDIR}/1.6.2/sip_calc_auth" |
333 |
- dodoc "${FILESDIR}/1.8.0/find_call_sip_trace.sh" |
334 |
- dodoc "${FILESDIR}/1.8.0/find_call_ids.sh" |
335 |
- dodoc "${FILESDIR}/1.6.2/call_data.txt" |
336 |
- |
337 |
- # install logrotate snippet; bug #329281 |
338 |
- # |
339 |
- insinto /etc/logrotate.d |
340 |
- newins "${FILESDIR}/1.6.2/asterisk.logrotate4" asterisk |
341 |
- |
342 |
- # Asterisk installs a few folders that's empty by design, |
343 |
- # but still required. This finds them, and marks them for |
344 |
- # portage. |
345 |
- for d in $(find "${ED}"/var -type d -empty || die "Find failed."); do |
346 |
- keepdir "${d#${ED}}" |
347 |
- done |
348 |
-} |
349 |
- |
350 |
-pkg_postinst() { |
351 |
- # |
352 |
- # Announcements, warnings, reminders... |
353 |
- # |
354 |
- einfo "Asterisk has been installed" |
355 |
- echo |
356 |
- elog "If you want to know more about asterisk, visit these sites:" |
357 |
- elog "http://www.asteriskdocs.org/" |
358 |
- elog "http://www.voip-info.org/wiki-Asterisk" |
359 |
- echo |
360 |
- elog "http://www.automated.it/guidetoasterisk.htm" |
361 |
- echo |
362 |
- elog "Gentoo VoIP IRC Channel:" |
363 |
- elog "#gentoo-voip @ irc.freenode.net" |
364 |
- echo |
365 |
- echo |
366 |
- elog "Please read the Asterisk 13 upgrade document:" |
367 |
- elog "https://wiki.asterisk.org/wiki/display/AST/Upgrading+to+Asterisk+13" |
368 |
-} |
369 |
|
370 |
diff --git a/net-misc/asterisk/asterisk-16.9.0.ebuild b/net-misc/asterisk/asterisk-16.9.0.ebuild |
371 |
deleted file mode 100644 |
372 |
index b7d72507ad5..00000000000 |
373 |
--- a/net-misc/asterisk/asterisk-16.9.0.ebuild |
374 |
+++ /dev/null |
375 |
@@ -1,315 +0,0 @@ |
376 |
-# Copyright 1999-2020 Gentoo Authors |
377 |
-# Distributed under the terms of the GNU General Public License v2 |
378 |
- |
379 |
-EAPI=7 |
380 |
- |
381 |
-inherit autotools linux-info systemd |
382 |
- |
383 |
-DESCRIPTION="Asterisk: A Modular Open Source PBX System" |
384 |
-HOMEPAGE="https://www.asterisk.org/" |
385 |
-SRC_URI="https://downloads.asterisk.org/pub/telephony/asterisk/releases/${P}.tar.gz |
386 |
- https://downloads.uls.co.za/gentoo/asterisk/gentoo-asterisk-patchset-4.08.tar.bz2" |
387 |
-LICENSE="GPL-2" |
388 |
-SLOT="0" |
389 |
-KEYWORDS="~amd64 ~ppc ~x86" |
390 |
- |
391 |
-IUSE_VOICEMAIL_STORAGE=" |
392 |
- +voicemail_storage_file |
393 |
- voicemail_storage_odbc |
394 |
- voicemail_storage_imap |
395 |
-" |
396 |
-IUSE="${IUSE_VOICEMAIL_STORAGE} alsa bluetooth calendar +caps cluster curl dahdi debug doc freetds gtalk http iconv ilbc ldap libressl lua mysql newt +samples odbc osplookup oss pjproject portaudio postgres radius selinux snmp span speex srtp +ssl static statsd syslog unbound vorbis xmpp" |
397 |
-IUSE_EXPAND="VOICEMAIL_STORAGE" |
398 |
-REQUIRED_USE="gtalk? ( xmpp ) |
399 |
- ^^ ( ${IUSE_VOICEMAIL_STORAGE/+/} ) |
400 |
- voicemail_storage_odbc? ( odbc ) |
401 |
-" |
402 |
- |
403 |
-PATCHES=( |
404 |
- "${FILESDIR}/asterisk-historic-uclibc.patch" |
405 |
- "${FILESDIR}/asterisk-historic-dahdiras-without-root.patch" |
406 |
- "${FILESDIR}/asterisk-historic-invert-gmine-search-order.patch" |
407 |
- "${FILESDIR}/asterisk-historic-dundi-null-dereference.patch" |
408 |
- "${FILESDIR}/asterisk-historic-no-var-run-install.patch" |
409 |
- "${FILESDIR}/asterisk-13.32.0-binutils-2.34.patch" |
410 |
-) |
411 |
- |
412 |
-DEPEND="acct-user/asterisk |
413 |
- acct-group/asterisk |
414 |
- dev-db/sqlite:3 |
415 |
- dev-libs/popt |
416 |
- >=dev-libs/jansson-2.11 |
417 |
- dev-libs/libedit |
418 |
- dev-libs/libxml2:2 |
419 |
- dev-libs/libxslt |
420 |
- sys-apps/util-linux |
421 |
- sys-libs/ncurses:0= |
422 |
- sys-libs/zlib |
423 |
- alsa? ( media-libs/alsa-lib ) |
424 |
- bluetooth? ( net-wireless/bluez:= ) |
425 |
- calendar? ( |
426 |
- net-libs/neon:= |
427 |
- dev-libs/libical:= |
428 |
- dev-libs/iksemel |
429 |
- ) |
430 |
- caps? ( sys-libs/libcap ) |
431 |
- cluster? ( sys-cluster/corosync ) |
432 |
- curl? ( net-misc/curl ) |
433 |
- dahdi? ( |
434 |
- net-libs/libpri |
435 |
- net-misc/dahdi-tools |
436 |
- ) |
437 |
- freetds? ( dev-db/freetds ) |
438 |
- gtalk? ( dev-libs/iksemel ) |
439 |
- http? ( dev-libs/gmime:2.6 ) |
440 |
- iconv? ( virtual/libiconv ) |
441 |
- ilbc? ( dev-libs/ilbc-rfc3951 ) |
442 |
- ldap? ( net-nds/openldap ) |
443 |
- lua? ( dev-lang/lua:* ) |
444 |
- mysql? ( dev-db/mysql-connector-c:= ) |
445 |
- newt? ( dev-libs/newt ) |
446 |
- odbc? ( dev-db/unixODBC ) |
447 |
- osplookup? ( net-libs/osptoolkit ) |
448 |
- pjproject? ( >=net-libs/pjproject-2.9 ) |
449 |
- portaudio? ( media-libs/portaudio ) |
450 |
- postgres? ( dev-db/postgresql:* ) |
451 |
- radius? ( net-dialup/freeradius-client ) |
452 |
- snmp? ( net-analyzer/net-snmp:= ) |
453 |
- span? ( media-libs/spandsp ) |
454 |
- speex? ( |
455 |
- media-libs/speex |
456 |
- media-libs/speexdsp |
457 |
- ) |
458 |
- srtp? ( net-libs/libsrtp:0 ) |
459 |
- ssl? ( |
460 |
- !libressl? ( dev-libs/openssl:0= ) |
461 |
- libressl? ( dev-libs/libressl:0= ) |
462 |
- ) |
463 |
- unbound? ( net-dns/unbound ) |
464 |
- vorbis? ( media-libs/libvorbis ) |
465 |
- voicemail_storage_imap? ( virtual/imap-c-client ) |
466 |
- xmpp? ( dev-libs/iksemel ) |
467 |
-" |
468 |
- |
469 |
-RDEPEND="${DEPEND} |
470 |
- net-misc/asterisk-core-sounds |
471 |
- net-misc/asterisk-extra-sounds |
472 |
- net-misc/asterisk-moh-opsound |
473 |
- selinux? ( sec-policy/selinux-asterisk ) |
474 |
- syslog? ( virtual/logger )" |
475 |
- |
476 |
-BDEPEND="virtual/pkgconfig" |
477 |
- |
478 |
-QA_DT_NEEDED="/usr/lib.*/libasteriskssl[.]so[.][0-9]\+" |
479 |
- |
480 |
-pkg_setup() { |
481 |
- CONFIG_CHECK="~!NF_CONNTRACK_SIP" |
482 |
- local WARNING_NF_CONNTRACK_SIP="SIP (NAT) connection tracking is enabled. Some users |
483 |
- have reported that this module dropped critical SIP packets in their deployments. You |
484 |
- may want to disable it if you see such problems." |
485 |
- check_extra_config |
486 |
-} |
487 |
- |
488 |
-src_prepare() { |
489 |
- default |
490 |
- AT_M4DIR="autoconf third-party third-party/pjproject third-party/jansson" eautoreconf |
491 |
-} |
492 |
- |
493 |
-function menuselect() { |
494 |
- menuselect/menuselect "$@" || die "menuselect $* failed." |
495 |
-} |
496 |
- |
497 |
-src_configure() { |
498 |
- local vmst |
499 |
- |
500 |
- econf \ |
501 |
- --libdir="/usr/$(get_libdir)" \ |
502 |
- --localstatedir="/var" \ |
503 |
- --with-crypto \ |
504 |
- --with-gsm=internal \ |
505 |
- --with-popt \ |
506 |
- --with-z \ |
507 |
- --with-libedit \ |
508 |
- --without-jansson-bundled \ |
509 |
- --without-pjproject-bundled \ |
510 |
- $(use_with caps cap) \ |
511 |
- $(use_with http gmime) \ |
512 |
- $(use_with newt) \ |
513 |
- $(use_with pjproject) \ |
514 |
- $(use_with portaudio) \ |
515 |
- $(use_with ssl) \ |
516 |
- $(use_with unbound) |
517 |
- |
518 |
- # Blank out sounds/sounds.xml file to prevent |
519 |
- # asterisk from installing sounds files (we pull them in via |
520 |
- # asterisk-{core,extra}-sounds and asterisk-moh-opsound. |
521 |
- >"${S}"/sounds/sounds.xml |
522 |
- |
523 |
- # That NATIVE_ARCH chatter really is quite bothersome |
524 |
- sed -i 's/NATIVE_ARCH=/NATIVE_ARCH=0/' build_tools/menuselect-deps || die "Unable to squelch noisy build system" |
525 |
- |
526 |
- # Compile menuselect binary for optional components |
527 |
- emake NOISY_BUILD=yes menuselect.makeopts |
528 |
- |
529 |
- # Disable BUILD_NATIVE (bug #667498) |
530 |
- menuselect --disable build_native menuselect.makeopts |
531 |
- |
532 |
- # Broken functionality is forcibly disabled (bug #360143) |
533 |
- menuselect --disable chan_misdn menuselect.makeopts |
534 |
- menuselect --disable chan_ooh323 menuselect.makeopts |
535 |
- |
536 |
- # Utility set is forcibly enabled (bug #358001) |
537 |
- menuselect --enable smsq menuselect.makeopts |
538 |
- menuselect --enable streamplayer menuselect.makeopts |
539 |
- menuselect --enable aelparse menuselect.makeopts |
540 |
- menuselect --enable astman menuselect.makeopts |
541 |
- |
542 |
- # this is connected, otherwise it would not find |
543 |
- # ast_pktccops_gate_alloc symbol |
544 |
- menuselect --enable chan_mgcp menuselect.makeopts |
545 |
- menuselect --enable res_pktccops menuselect.makeopts |
546 |
- |
547 |
- # SSL is forcibly enabled, IAX2 & DUNDI are expected to be available |
548 |
- menuselect --enable pbx_dundi menuselect.makeopts |
549 |
- menuselect --enable func_aes menuselect.makeopts |
550 |
- menuselect --enable chan_iax2 menuselect.makeopts |
551 |
- |
552 |
- # SQlite3 is now the main database backend, enable related features |
553 |
- menuselect --enable cdr_sqlite3_custom menuselect.makeopts |
554 |
- menuselect --enable cel_sqlite3_custom menuselect.makeopts |
555 |
- |
556 |
- # The others are based on USE-flag settings |
557 |
- use_select() { |
558 |
- local state=$(use "$1" && echo enable || echo disable) |
559 |
- shift # remove use from parameters |
560 |
- |
561 |
- while [[ -n $1 ]]; do |
562 |
- menuselect --${state} "$1" menuselect.makeopts |
563 |
- shift |
564 |
- done |
565 |
- } |
566 |
- |
567 |
- use_select alsa chan_alsa |
568 |
- use_select bluetooth chan_mobile |
569 |
- use_select calendar res_calendar res_calendar_{caldav,ews,exchange,icalendar} |
570 |
- use_select cluster res_corosync |
571 |
- use_select curl func_curl res_config_curl res_curl |
572 |
- use_select dahdi app_dahdiras app_meetme chan_dahdi codec_dahdi res_timing_dahdi |
573 |
- use_select freetds {cdr,cel}_tds |
574 |
- use_select gtalk chan_motif |
575 |
- use_select http res_http_post |
576 |
- use_select iconv func_iconv |
577 |
- use_select ilbc codec_ilbc format_ilbc |
578 |
- use_select ldap res_config_ldap |
579 |
- use_select lua pbx_lua |
580 |
- use_select mysql app_mysql cdr_mysql res_config_mysql |
581 |
- use_select odbc cdr_adaptive_odbc res_config_odbc {cdr,cel,res,func}_odbc |
582 |
- use_select osplookup app_osplookup |
583 |
- use_select oss chan_oss |
584 |
- use_select postgres {cdr,cel}_pgsql res_config_pgsql |
585 |
- use_select radius {cdr,cel}_radius |
586 |
- use_select snmp res_snmp |
587 |
- use_select span res_fax_spandsp |
588 |
- use_select speex {codec,func}_speex |
589 |
- use_select srtp res_srtp |
590 |
- use_select statsd res_statsd res_{endpoint,chan}_stats |
591 |
- use_select syslog cdr_syslog |
592 |
- use_select vorbis format_ogg_vorbis |
593 |
- use_select xmpp res_xmpp |
594 |
- |
595 |
- # Voicemail storage ... |
596 |
- for vmst in ${IUSE_VOICEMAIL_STORAGE/+/}; do |
597 |
- if use ${vmst}; then |
598 |
- menuselect --enable $(echo ${vmst##*_} | tr '[:lower:]' '[:upper:]')_STORAGE menuselect.makeopts |
599 |
- fi |
600 |
- done |
601 |
- |
602 |
- if use debug; then |
603 |
- for o in DONT_OPTIMIZE DEBUG_THREADS BETTER_BACKTRACES; do |
604 |
- menuselect --enable "${o}" menuselect.makeopts |
605 |
- done |
606 |
- fi |
607 |
-} |
608 |
- |
609 |
-src_compile() { |
610 |
- emake ASTCFLAGS="${CFLAGS}" ASTLDFLAGS="${LDFLAGS}" NOISY_BUILD=yes |
611 |
-} |
612 |
- |
613 |
-src_install() { |
614 |
- local d |
615 |
- |
616 |
- mkdir -p "${ED}/usr/$(get_libdir)/pkgconfig" || die |
617 |
- emake DESTDIR="${ED}" NOISY_BUILD=yes install |
618 |
- |
619 |
- if use radius; then |
620 |
- insinto /etc/radiusclient/ |
621 |
- doins contrib/dictionary.digium |
622 |
- fi |
623 |
- diropts -m 0750 -o root -g asterisk |
624 |
- keepdir /etc/asterisk |
625 |
- if use samples; then |
626 |
- emake NOISY_BUILD=yes DESTDIR="${ED}" CONFIG_SRC=configs/samples CONFIG_EXTEN=.sample install-configs |
627 |
- for conffile in "${ED}/etc/asterisk/"* |
628 |
- do |
629 |
- fowners root:root "${conffile#${ED}}" |
630 |
- fperms 0644 "${conffile#${ED}}" |
631 |
- done |
632 |
- fi |
633 |
- |
634 |
- # keep directories |
635 |
- diropts -m 0750 -o asterisk -g root |
636 |
- keepdir /var/lib/asterisk |
637 |
- keepdir /var/spool/asterisk |
638 |
- keepdir /var/spool/asterisk/{system,tmp,meetme,monitor,dictate,voicemail,recording} |
639 |
- diropts -m 0750 -o asterisk -g asterisk |
640 |
- keepdir /var/log/asterisk/{cdr-csv,cdr-custom} |
641 |
- |
642 |
- newinitd "${FILESDIR}"/initd-13.32.0-r1 asterisk |
643 |
- newconfd "${FILESDIR}"/confd-13.32.0 asterisk |
644 |
- |
645 |
- systemd_dounit "${FILESDIR}"/asterisk.service |
646 |
- systemd_newtmpfilesd "${FILESDIR}"/asterisk.tmpfiles.conf asterisk.conf |
647 |
- systemd_install_serviced "${FILESDIR}"/asterisk.service.conf |
648 |
- |
649 |
- # Reset diropts else dodoc uses it for doc installations. |
650 |
- diropts -m0755 |
651 |
- |
652 |
- # install the upgrade documentation |
653 |
- dodoc UPGRADE* BUGS CREDITS |
654 |
- |
655 |
- # install extra documentation |
656 |
- if use doc; then |
657 |
- dodoc doc/*.txt |
658 |
- dodoc doc/*.pdf |
659 |
- fi |
660 |
- |
661 |
- # install SIP scripts; bug #300832 |
662 |
- # |
663 |
- dodoc "${FILESDIR}/1.6.2/sip_calc_auth" |
664 |
- dodoc "${FILESDIR}/1.8.0/find_call_sip_trace.sh" |
665 |
- dodoc "${FILESDIR}/1.8.0/find_call_ids.sh" |
666 |
- dodoc "${FILESDIR}/1.6.2/call_data.txt" |
667 |
- |
668 |
- # install logrotate snippet; bug #329281 |
669 |
- # |
670 |
- insinto /etc/logrotate.d |
671 |
- newins "${FILESDIR}/1.6.2/asterisk.logrotate4" asterisk |
672 |
- |
673 |
- # Asterisk installs a few folders that's empty by design, |
674 |
- # but still required. This finds them, and marks them for |
675 |
- # portage. |
676 |
- for d in $(find "${ED}"/var -type d -empty || die "Find failed."); do |
677 |
- keepdir "${d#${ED}}" |
678 |
- done |
679 |
-} |
680 |
- |
681 |
-pkg_postinst() { |
682 |
- if [ -z "${REPLACING_VERSIONS}" ]; then |
683 |
- elog "Asterisk Wiki: https://wiki.asterisk.org/wiki/" |
684 |
- elog "Gentoo VoIP IRC Channel: #gentoo-voip @ irc.freenode.net" |
685 |
- elif [ "$(ver_cut 1 "${REPLACING_VERSIONS}")" != "$(ver_cut 1)" ]; then |
686 |
- elog "You are updating from Asterisk $(ver_cut 1 "${REPLACING_VERSIONS}") upgrade document:" |
687 |
- elog "https://wiki.asterisk.org/wiki/display/AST/Upgrading+to+Asterisk+$(ver_cut 1)" |
688 |
- elog "Gentoo VoIP IRC Channel: #gentoo-voip @ irc.freenode.net" |
689 |
- fi |
690 |
-} |
691 |
|
692 |
diff --git a/net-misc/asterisk/files/asterisk-13.32.0-binutils-2.34.patch b/net-misc/asterisk/files/asterisk-13.32.0-binutils-2.34.patch |
693 |
deleted file mode 100644 |
694 |
index 6ce797ca4f2..00000000000 |
695 |
--- a/net-misc/asterisk/files/asterisk-13.32.0-binutils-2.34.patch |
696 |
+++ /dev/null |
697 |
@@ -1,18 +0,0 @@ |
698 |
---- a/main/backtrace.c 2020-03-12 07:37:03.000000000 -0700 |
699 |
-+++ b/main/backtrace.c 2020-03-31 23:22:18.272691980 -0700 |
700 |
-@@ -64,6 +64,15 @@ |
701 |
- #if defined(HAVE_DLADDR) && defined(HAVE_BFD) && defined(BETTER_BACKTRACES) |
702 |
- #include <dlfcn.h> |
703 |
- #include <bfd.h> |
704 |
-+#ifndef bfd_get_section_size |
705 |
-+#define bfd_get_section_size(x) bfd_section_size(x) |
706 |
-+#endif |
707 |
-+#ifndef bfd_get_section_vma |
708 |
-+#define bfd_get_section_vma(x, y) bfd_section_vma(y) |
709 |
-+#endif |
710 |
-+#ifndef bfd_get_section_flags |
711 |
-+#define bfd_get_section_flags(bfd, ptr) ((void) bfd, (ptr)->flags) |
712 |
-+#endif |
713 |
- #endif |
714 |
- |
715 |
- #include <pthread.h> |
716 |
|
717 |
diff --git a/net-misc/asterisk/files/asterisk-historic-dahdiras-without-root.patch b/net-misc/asterisk/files/asterisk-historic-dahdiras-without-root.patch |
718 |
deleted file mode 100644 |
719 |
index 1fdf033b722..00000000000 |
720 |
--- a/net-misc/asterisk/files/asterisk-historic-dahdiras-without-root.patch |
721 |
+++ /dev/null |
722 |
@@ -1,23 +0,0 @@ |
723 |
-Gentoo bug 337297 |
724 |
-Link: http://bugs.gentoo.org/show_bug.cgi?id=337297 |
725 |
-Patch-By: Jaco Kroon |
726 |
-Committed-Date: 2010-09-16 |
727 |
-Ebuild-Version: 1.6.2.13-r1 |
728 |
- |
729 |
-Upstream bug 17991 |
730 |
-Link: https://issues.asterisk.org/view.php?id=17991 |
731 |
-Patch-By: Jaco Kroon |
732 |
-Committed-Date: none |
733 |
- |
734 |
-diff -uNr asterisk-1.8.0.ORIG/apps/app_dahdiras.c asterisk-1.8.0/apps/app_dahdiras.c |
735 |
---- asterisk-1.8.0.ORIG/apps/app_dahdiras.c 2010-10-27 00:41:40.000000000 +0100 |
736 |
-+++ asterisk-1.8.0/apps/app_dahdiras.c 2010-10-27 00:50:00.000000000 +0100 |
737 |
-@@ -119,8 +119,6 @@ |
738 |
- c = strsep(&stringp, ","); |
739 |
- } |
740 |
- |
741 |
-- argv[argc++] = "plugin"; |
742 |
-- argv[argc++] = "dahdi.so"; |
743 |
- argv[argc++] = "stdin"; |
744 |
- |
745 |
- /* Finally launch PPP */ |
746 |
|
747 |
diff --git a/net-misc/asterisk/files/asterisk-historic-dundi-null-dereference.patch b/net-misc/asterisk/files/asterisk-historic-dundi-null-dereference.patch |
748 |
deleted file mode 100644 |
749 |
index 8fb53193798..00000000000 |
750 |
--- a/net-misc/asterisk/files/asterisk-historic-dundi-null-dereference.patch |
751 |
+++ /dev/null |
752 |
@@ -1,40 +0,0 @@ |
753 |
-Upstream issue 21205 |
754 |
-Link: https://issues.asterisk.org/jira/browse/ASTERISK-21205 |
755 |
- |
756 |
-Submitted upstream: 2013-03-05 07:06 |
757 |
-For Asterisk version: 11.2.1 |
758 |
-Patch by: Jaco Kroon |
759 |
- |
760 |
-If a negative (error) return is received from dundi_lookup_internal, this is not handled |
761 |
-correctly when assigning the result to the buffer. As such, use a signed integer in the |
762 |
-assignment and do a proper comparison. |
763 |
- |
764 |
---- a/pbx/pbx_dundi.c 2013-03-05 15:07:00.523387892 +0200 |
765 |
-+++ b/pbx/pbx_dundi.c 2013-03-05 15:18:49.512625981 +0200 |
766 |
-@@ -4123,7 +4123,7 @@ |
767 |
- |
768 |
- struct dundi_result_datastore { |
769 |
- struct dundi_result results[MAX_RESULTS]; |
770 |
-- unsigned int num_results; |
771 |
-+ int num_results; |
772 |
- unsigned int id; |
773 |
- }; |
774 |
- |
775 |
-@@ -4255,7 +4255,7 @@ |
776 |
- drds = datastore->data; |
777 |
- |
778 |
- if (!strcasecmp(args.resultnum, "getnum")) { |
779 |
-- snprintf(buf, len, "%u", drds->num_results); |
780 |
-+ snprintf(buf, len, "%u", drds->num_results < 0 ? 0 : drds->num_results); |
781 |
- res = 0; |
782 |
- goto finish; |
783 |
- } |
784 |
-@@ -4266,7 +4266,7 @@ |
785 |
- goto finish; |
786 |
- } |
787 |
- |
788 |
-- if (num && num <= drds->num_results) { |
789 |
-+ if (num && drds->num_results > 0 && num <= drds->num_results) { |
790 |
- snprintf(buf, len, "%s/%s", drds->results[num - 1].tech, drds->results[num - 1].dest); |
791 |
- res = 0; |
792 |
- } else |
793 |
|
794 |
diff --git a/net-misc/asterisk/files/asterisk-historic-invert-gmine-search-order.patch b/net-misc/asterisk/files/asterisk-historic-invert-gmine-search-order.patch |
795 |
deleted file mode 100644 |
796 |
index 99e76d947fb..00000000000 |
797 |
--- a/net-misc/asterisk/files/asterisk-historic-invert-gmine-search-order.patch |
798 |
+++ /dev/null |
799 |
@@ -1,12 +0,0 @@ |
800 |
-diff -uNr asterisk-13.18.2.ORIG/configure.ac asterisk-13.18.2/configure.ac |
801 |
---- asterisk-13.18.2.ORIG/configure.ac 2017-11-14 11:26:06.179850146 +0000 |
802 |
-+++ asterisk-13.18.2/configure.ac 2017-11-14 11:27:46.256844611 +0000 |
803 |
-@@ -2503,7 +2503,7 @@ |
804 |
- fi |
805 |
- fi |
806 |
- |
807 |
--for ver in 2.0 2.2 2.4 2.6 3.0; do |
808 |
-+for ver in 3.0 2.6 2.4 2.2 2.0; do |
809 |
- AST_PKG_CONFIG_CHECK([GMIME], gmime-$ver) |
810 |
- if test "$PBX_GMIME" = 1; then |
811 |
- break; |
812 |
|
813 |
diff --git a/net-misc/asterisk/files/asterisk-historic-uclibc.patch b/net-misc/asterisk/files/asterisk-historic-uclibc.patch |
814 |
deleted file mode 100644 |
815 |
index 167ae080b19..00000000000 |
816 |
--- a/net-misc/asterisk/files/asterisk-historic-uclibc.patch |
817 |
+++ /dev/null |
818 |
@@ -1,23 +0,0 @@ |
819 |
-Gentoo bug 66557 |
820 |
-Link: http://bugs.gentoo.org/show_bug.cgi?id=66557 |
821 |
-Patch-By: REdOG |
822 |
- |
823 |
-Submitted upstream: No |
824 |
- |
825 |
-The uclibc environment, as opposed to the glibc environment, needs explicit |
826 |
-linking with the pthread & dl libraries. Without these, name resolution is |
827 |
-not functional. |
828 |
- |
829 |
---- asterisk-1.8.7.0-rc2.orig/Makefile 2011-08-25 21:00:55.000000000 +0200 |
830 |
-+++ asterisk-1.8.7.0-rc2.orig/Makefile 2011-09-21 14:13:12.823076046 +0200 |
831 |
-@@ -247,6 +247,10 @@ |
832 |
- _ASTCFLAGS+=-pthread -ftrampolines |
833 |
- endif |
834 |
- |
835 |
-+ifeq ($(OSARCH),linux-uclibc) |
836 |
-+ AST_LIBS+=-lpthread -ldl |
837 |
-+endif |
838 |
-+ |
839 |
- ifeq ($(OSARCH),SunOS) |
840 |
- _ASTCFLAGS+=-Wcast-align -DSOLARIS -I../include/solaris-compat -I/opt/ssl/include -I/usr/local/ssl/include -D_XPG4_2 -D__EXTENSIONS__ |
841 |
- endif |
842 |
|
843 |
diff --git a/net-misc/asterisk/files/initd-13.32.0 b/net-misc/asterisk/files/initd-13.32.0 |
844 |
deleted file mode 100644 |
845 |
index 6d1f77e51b9..00000000000 |
846 |
--- a/net-misc/asterisk/files/initd-13.32.0 |
847 |
+++ /dev/null |
848 |
@@ -1,380 +0,0 @@ |
849 |
-#!/sbin/openrc-run |
850 |
-# Copyright 1999-2020 Gentoo Authors |
851 |
-# Distributed under the terms of the GNU General Public License v2 |
852 |
- |
853 |
-extra_started_commands="forcestop reload" |
854 |
-extra_commands="checkperms" |
855 |
- |
856 |
-depend() { |
857 |
- need net |
858 |
- use nscd dns dahdi mysql postgresql slapd capi |
859 |
-} |
860 |
- |
861 |
-is_running() { |
862 |
- [ -r "${ast_rundir}/asterisk.pid" ] || return 1 |
863 |
- PID="$(cat "${ast_rundir}/asterisk.pid")" |
864 |
- [ -d "/proc/${PID}" ] || return 1 |
865 |
- EXE="$(readlink -f /proc/${PID}/exe)" |
866 |
- EXE="${EXE% (deleted)}" # in case asterisk got upgraded and we're still looking at an old one. |
867 |
- [ "${EXE}" = /usr/sbin/asterisk ] || return 1 # pid got re-used for another process. |
868 |
- |
869 |
- # PID reported in pidfile is active, and is still an asterisk instance. |
870 |
- return 0 |
871 |
-} |
872 |
- |
873 |
-# Sets up a few variables for us for use |
874 |
-# ast_instancename: eg, asterisk when RC_SVCNAME=asterisk, or asterisk(foo) when asterisk.foo. |
875 |
-# ast_rundir: directory to be used as run folder (pid and ctl files). |
876 |
-# ast_spooldir: |
877 |
-setup_svc_variables() |
878 |
-{ |
879 |
- local t |
880 |
- |
881 |
- ast_instancename=asterisk |
882 |
- ast_rundir=/var/run/${RC_SVCNAME} |
883 |
- ast_logdir=/var/log/${RC_SVCNAME} |
884 |
- ast_spooldir=/var/spool/${RC_SVCNAME} |
885 |
- ast_confdir=/etc/${RC_SVCNAME/.//} |
886 |
- ast_stop_timeout=120 |
887 |
- ast_stop_method="gracefully" |
888 |
- |
889 |
- if [ "${RC_SVCNAME}" != "asterisk" ]; then |
890 |
- t="${RC_SVCNAME#asterisk.}" |
891 |
- if [ "${RC_SVCNAME}" = "${t}" ]; then |
892 |
- eerror "Invalid SVCNAME of ${RC_SVCNAME}, must be of the format asterisk.name." |
893 |
- return 1 |
894 |
- fi |
895 |
- ast_instancename+="(${t})" |
896 |
- fi |
897 |
- |
898 |
- [ -n "${ASTERISK_RUNDIR}" ] && ast_rundir="${ASTERISK_RUNDIR}" |
899 |
- [ -n "${ASTERISK_LOGDIR}" ] && ast_logdir="${ASTERISK_LOGDIR}" |
900 |
- [ -n "${ASTERISK_SPOOLDIR}" ] && ast_spooldir="${ASTERISK_SPOOLDIR}" |
901 |
- [ -n "${ASTERISK_CONFDIR}" ] && ast_confdir="${ASTERISK_CONFDIR}" |
902 |
- [ -n "${ASTERISK_STOP_TIMEOUT}" ] && ast_stop_timeout="${ASTERISK_STOP_TIMEOUT}" |
903 |
- case "${ASTERISK_STOP_METHOD}" in |
904 |
- grasefully|when\ convenient|now) |
905 |
- ast_stop_method="${ASTERISK_STOP_METHOD}" |
906 |
- ;; |
907 |
- esac |
908 |
- ast_group= |
909 |
- if [ -n "${ASTERISK_USER}" ]; then |
910 |
- ast_user="${ASTERISK_USER%%:*}" |
911 |
- if [ "${ast_user}" != "${ASTERISK_USER}" ]; then |
912 |
- ast_group="${ASTERISK_USER#*:}" |
913 |
- ast_group="${ast_group%%:*}" |
914 |
- fi |
915 |
- fi |
916 |
- |
917 |
- [ -z "${ast_user}" ] && ast_user=asterisk |
918 |
- |
919 |
- ast_pgroup="$(getent group $(getent passwd "${ast_user}" | awk -F: '{ print $4 }') | sed -re 's/:.*//')" |
920 |
- |
921 |
- return 0 |
922 |
-} |
923 |
- |
924 |
-checkperms() { |
925 |
- setup_svc_variables |
926 |
- |
927 |
- local path |
928 |
- checkpath -d -m 0755 -o ${ast_user}:${ast_group:-${ast_pgroup}} "${ast_logdir}" "${ast_rundir}" "${ast_spooldir}" |
929 |
- for path in "${ast_rundir}" "${ast_spooldir}" "${ast_logdir}"; do |
930 |
- ebegin "Checking ${path}" |
931 |
- find "${path}" ! -user "${ast_user}" | while read element; do |
932 |
- [[ "${element}" = *.gz ]] && continue # Skip logrotated files. |
933 |
- ewarn "${ast_user} is not the owner of ${element}, or permissions are insufficient, fixing." |
934 |
- chown ${ast_user} "${element}" |
935 |
- chmod u+rwX "${element}" |
936 |
- done; |
937 |
- eend 0 |
938 |
- done |
939 |
-} |
940 |
- |
941 |
-asterisk_run_loop() { |
942 |
- local result=0 signal=0 |
943 |
- |
944 |
- echo "Initializing ${ast_instancename} wrapper" |
945 |
- OPTS="$*" |
946 |
- |
947 |
- trap "rm -f '${ast_rundir}/wrapper_loop.running'" EXIT |
948 |
- touch "${ast_rundir}/wrapper_loop.running" |
949 |
- |
950 |
- while [ -r "${ast_rundir}/wrapper_loop.running" ]; do |
951 |
- if [ -n "${TTY}" ]; then |
952 |
- /usr/bin/stty -F "${TTY}" sane |
953 |
- ${NICE} /usr/sbin/asterisk -C "${ast_confdir}/asterisk.conf" ${OPTS} >"${TTY}" 2>&1 <"${TTY}" |
954 |
- result=$? |
955 |
- else |
956 |
- ${NICE} /usr/sbin/asterisk -C "${ast_confdir}/asterisk.conf" ${OPTS} >/dev/null 2>&1 |
957 |
- result=$? |
958 |
- fi |
959 |
- |
960 |
- if [ "$result" -eq 0 ]; then |
961 |
- echo "Asterisk terminated normally" |
962 |
- break |
963 |
- else |
964 |
- if [ "$result" -gt 128 ]; then |
965 |
- signal="$(expr "$result" - 128)" |
966 |
- MSG="Asterisk terminated with Signal: $signal" |
967 |
- |
968 |
- CORE_TARGET="core-" |
969 |
- yesno "${ASTERISK_CORE_USEHOSTNAME}" && CORE_TARGET+="$(hostname)-" |
970 |
- CORE_TARGET+="$(date "+%Y%m%d-%H%M%S")" |
971 |
- |
972 |
- local CORE_DUMPED=0 |
973 |
- if [ -f "${ASTERISK_CORE_DIR}/core" ]; then |
974 |
- mv "${ASTERISK_CORE_DIR}/core" \ |
975 |
- "${ASTERISK_CORE_DIR}/${CORE_TARGET}" |
976 |
- CORE_DUMPED=1 |
977 |
- |
978 |
- elif [ -f "${ASTERISK_CORE_DIR}/core.${PID}" ]; then |
979 |
- mv "${ASTERISK_CORE_DIR}/core.${PID}" \ |
980 |
- "${ASTERISK_CORE_DIR}/${CORE_TARGET}" |
981 |
- CORE_DUMPED=1 |
982 |
- |
983 |
- fi |
984 |
- |
985 |
- [ $CORE_DUMPED -eq 1 ] && \ |
986 |
- MSG="${MSG}\n\rCore dumped: ${ASTERISK_CORE_DIR}/${CORE_TARGET}" |
987 |
- else |
988 |
- MSG="Asterisk terminated with return code: $result" |
989 |
- fi |
990 |
- |
991 |
- # kill left-over tasks |
992 |
- for X in ${ASTERISK_CLEANUP_ON_CRASH}; do |
993 |
- kill -9 "$(pidof "${X}")"; |
994 |
- done |
995 |
- fi |
996 |
- |
997 |
- [ -n "${TTY}" ] \ |
998 |
- && echo "${MSG}" >"${TTY}" \ |
999 |
- || echo "${MSG}" |
1000 |
- |
1001 |
- |
1002 |
- if [ -n "${ASTERISK_NOTIFY_EMAIL}" ] && \ |
1003 |
- [ -x /usr/sbin/sendmail ]; then |
1004 |
- echo -e -n "Subject: Asterisk crashed\r\n${MSG}\r\n" |\ |
1005 |
- /usr/sbin/sendmail "${ASTERISK_NOTIFY_EMAIL}" |
1006 |
- fi |
1007 |
- sleep "${ASTERISK_RESTART_DELAY}" |
1008 |
- echo "Restarting Asterisk..." |
1009 |
- done |
1010 |
- |
1011 |
- echo "Terminating wrapper loop." |
1012 |
- return 0 |
1013 |
-} |
1014 |
- |
1015 |
-start() { |
1016 |
- local OPTS PID |
1017 |
- local tmp x |
1018 |
- |
1019 |
- local OPTS ARGS |
1020 |
- |
1021 |
- setup_svc_variables || return $? |
1022 |
- |
1023 |
- ebegin "Starting ${ast_instancename} PBX" |
1024 |
- |
1025 |
- eindent |
1026 |
- |
1027 |
- # filter (redundant) arguments |
1028 |
- OPTS="$(echo "${ASTERISK_OPTS}" | sed -re "s:-[cfF]::g")" |
1029 |
- |
1030 |
- # default options |
1031 |
- OPTS="${OPTS} -f" # don't fork / detach breaks wrapper script... |
1032 |
- |
1033 |
- # ensure that ASTERISK_RESTART_DELAY is integer. |
1034 |
- ASTERISK_RESTART_DELAY="$(echo "${ASTERISK_RESTART_DELAY}" | sed -re 's/^([0-9]*).*/\1/')" |
1035 |
- [ -z "${ASTERISK_RESTART_DELAY}" ] && ASTERISK_RESTART_DELAY=5 |
1036 |
- |
1037 |
- if [ -n "${ASTERISK_CORE_SIZE}" ] && |
1038 |
- [ "${ASTERISK_CORE_SIZE}" != "0" ]; then |
1039 |
- ulimit -c ${ASTERISK_CORE_SIZE} |
1040 |
- |
1041 |
- if [ -n "${ASTERISK_CORE_DIR}" ] && \ |
1042 |
- [ ! -d "${ASTERISK_CORE_DIR}" ] |
1043 |
- then |
1044 |
- checkpath -d -m 0755 -o ${ast_user}:${ast_group} "${ASTERISK_CORE_DIR}" |
1045 |
- fi |
1046 |
- ASTERISK_CORE_DIR="${ASTERISK_CORE_DIR:-/tmp}" |
1047 |
- |
1048 |
- cd "${ASTERISK_CORE_DIR}" |
1049 |
- einfo "Core dump size : ${ASTERISK_CORE_SIZE}" |
1050 |
- einfo "Core dump location : ${ASTERISK_CORE_DIR}" |
1051 |
- |
1052 |
- OPTS="${OPTS} -g" |
1053 |
- fi |
1054 |
- |
1055 |
- if [ -n "${ASTERISK_MAX_FD}" ]; then |
1056 |
- ulimit -n ${ASTERISK_MAX_FD} |
1057 |
- einfo "Max open filedescriptors : ${ASTERISK_MAX_FD}" |
1058 |
- fi |
1059 |
- |
1060 |
- if [ -n "${ASTERISK_NICE}" ]; then |
1061 |
- if [ ${ASTERISK_NICE} -ge -20 ] && \ |
1062 |
- [ ${ASTERISK_NICE} -le 19 ]; then |
1063 |
- einfo "Nice level : ${ASTERISK_NICE}" |
1064 |
- NICE="nice -n ${ASTERISK_NICE} --" |
1065 |
- else |
1066 |
- eerror "Nice value must be between -20 and 19" |
1067 |
- return 1 |
1068 |
- fi |
1069 |
- else |
1070 |
- NICE="" |
1071 |
- fi |
1072 |
- |
1073 |
- if [ -n "${ASTERISK_NOTIFY_EMAIL}" ]; then |
1074 |
- if [ -x /usr/sbin/sendmail ]; then |
1075 |
- einfo "Email notifications go to : ${ASTERISK_NOTIFY_EMAIL}" |
1076 |
- else |
1077 |
- ewarn "Notifications disabled, /usr/sbin/sendmail doesn't exist or is not executable!" |
1078 |
- unset ASTERISK_NOTIFY_EMAIL |
1079 |
- fi |
1080 |
- fi |
1081 |
- |
1082 |
- if [ -n "${ASTERISK_TTY}" ]; then |
1083 |
- for x in "${ASTERISK_TTY}" \ |
1084 |
- "/dev/tty${ASTERISK_TTY}" \ |
1085 |
- "/dev/vc/${ASTERISK_TTY}" |
1086 |
- do |
1087 |
- if [ -c "${x}" ]; then |
1088 |
- TTY="${x}" |
1089 |
- fi |
1090 |
- done |
1091 |
- [ -n "${TTY}" ] && \ |
1092 |
- einfo "Messages are sent to : ${TTY}" |
1093 |
- fi |
1094 |
- |
1095 |
- if yesno "${ASTERISK_CONSOLE}" && [ -n "${TTY}" ]; then |
1096 |
- einfo "Starting Asterisk console : Yes" |
1097 |
- OPTS="${OPTS} -c" |
1098 |
- fi |
1099 |
- |
1100 |
- if ! getent passwd "${ast_user}" &>/dev/null; then |
1101 |
- eerror "Requested to run asterisk as ${ast_user}, which doesn't exist." |
1102 |
- return 1 |
1103 |
- fi |
1104 |
- OPTS="${OPTS} -U ${ast_user}" |
1105 |
- |
1106 |
- if [ -n "${ast_group}" ] && ! getent group "${ast_group}" &>/dev/null; then |
1107 |
- eerror "Requested to run ${ast_instancename} with group ${ast_group}, which doesn't exist." |
1108 |
- return 1 |
1109 |
- fi |
1110 |
- [ -n "${ast_group}" ] && OPTS="${OPTS} -G ${ast_group}" |
1111 |
- |
1112 |
- if [ "${ast_user}" = root ]; then |
1113 |
- ewarn "Starting asterisk as root is not recommended (SERIOUS SECURITY CONSIDERATIONS)." |
1114 |
- elif [ "${ast_group}" = root ]; then |
1115 |
- ewarn "Starting asterisk with group root is not recommended (SERIOUS SECURITY CONSIDERATIONS)." |
1116 |
- fi |
1117 |
- |
1118 |
- checkpath -d -m 0755 -o "${ast_user}:${ast_group}" "${ast_logdir}" "${ast_rundir}" |
1119 |
- einfo "Starting asterisk as : ${ast_user}:${ast_group:-${ast_pgroup} (+supplementaries)}" |
1120 |
- asterisk_run_loop ${OPTS} 2>&1 | logger -t "wrapper:${ast_instancename}" &>/dev/null & |
1121 |
- result=$? |
1122 |
- |
1123 |
- if [ $result -eq 0 ]; then |
1124 |
- # 2 seconds should be enough for asterisk to start |
1125 |
- sleep 2 |
1126 |
- is_running |
1127 |
- result=$? |
1128 |
- |
1129 |
- [ $result -eq 0 ] || wrapperstop |
1130 |
- fi |
1131 |
- |
1132 |
- eoutdent |
1133 |
- eend $result |
1134 |
- |
1135 |
- if [ $result -eq 0 ] && yesno "${ASTERISK_WAITBOOTED}"; then |
1136 |
- if [ ! -r "${ast_rundir}/asterisk.ctl" ]; then |
1137 |
- # asterisk can crash during startup ... |
1138 |
- ebegin "Waiting for ctl file to appear" |
1139 |
- while is_running && [ ! -r "${ast_rundir}/asterisk.ctl" ]; do |
1140 |
- sleep 1 |
1141 |
- done |
1142 |
- is_running |
1143 |
- result=$? |
1144 |
- eend $result |
1145 |
- fi |
1146 |
- if [ $result -eq 0 ]; then |
1147 |
- ebegin "Waiting for ${ast_instancename} to fully boot" |
1148 |
- /usr/sbin/asterisk -C "${ast_confdir}/asterisk.conf" -r -x "core waitfullybooted" &>/dev/null |
1149 |
- eend $? |
1150 |
- fi |
1151 |
- fi |
1152 |
- |
1153 |
- return $result |
1154 |
-} |
1155 |
- |
1156 |
-wrapperstop() { |
1157 |
- # Accomodate system upgrades (so a previous version of the wrapper script that still uses a pid file may be running). |
1158 |
- if [ -r "${ast_rundir}/wrapper_loop.pid" ]; then |
1159 |
- ebegin "Killing ${ast_instancename} wrapper script" |
1160 |
- kill "$(cat /var/run/asterisk/wrapper_loop.pid)" |
1161 |
- eend $? |
1162 |
- fi |
1163 |
- |
1164 |
- # The new one (due to "hardened" requirements) uses a simpler |
1165 |
- # flag to indicate running or shutting down. |
1166 |
- if [ -r "${ast_rundir}/wrapper_loop.running" ]; then |
1167 |
- ebegin "Signalling ${ast_instancename} wrapper script to terminate" |
1168 |
- rm "${ast_rundir}/wrapper_loop.running" |
1169 |
- eend $? |
1170 |
- fi |
1171 |
- |
1172 |
- return 0 |
1173 |
-} |
1174 |
- |
1175 |
-forcestop() { |
1176 |
- setup_svc_variables || return $? |
1177 |
- |
1178 |
- # Just to be sure - when we want to forcestop we should make it all tear down. |
1179 |
- wrapperstop |
1180 |
- |
1181 |
- ebegin "Stopping ${ast_instancename} PBX" |
1182 |
- start-stop-daemon --stop --pidfile /var/run/asterisk/asterisk.pid |
1183 |
- eend $? |
1184 |
-} |
1185 |
- |
1186 |
-stop() { |
1187 |
- setup_svc_variables || return $? |
1188 |
- |
1189 |
- wrapperstop |
1190 |
- |
1191 |
- if ! is_running; then |
1192 |
- eerror "${ast_instancename} is not running!" |
1193 |
- return 0 |
1194 |
- fi |
1195 |
- |
1196 |
- ebegin "Stopping ${ast_instancename} PBX ${ast_stop_method}" |
1197 |
- /usr/sbin/asterisk -C "${ast_confdir}/asterisk.conf" -r -x "core stop ${ast_stop_method}" &>/dev/null |
1198 |
- # Now we have to wait until asterisk has _really_ stopped. |
1199 |
- sleep 1 |
1200 |
- if is_running; then |
1201 |
- einfon "Waiting for ${ast_instancename} to shutdown ." |
1202 |
- local cnt=0 |
1203 |
- while is_running; do |
1204 |
- cnt="$(expr $cnt + 2)" |
1205 |
- if [ ${ast_stop_timeout} -gt 0 -a $cnt -gt ${ast_stop_timeout} ] ; then |
1206 |
- echo |
1207 |
- eend 1 "Failed waiting for ${ast_instancename} to stop." |
1208 |
- return 1 |
1209 |
- fi |
1210 |
- sleep 2 |
1211 |
- echo -n "." |
1212 |
- done |
1213 |
- echo |
1214 |
- fi |
1215 |
- eend 0 |
1216 |
-} |
1217 |
- |
1218 |
-reload() { |
1219 |
- setup_svc_variables || return $? |
1220 |
- |
1221 |
- if is_running; then |
1222 |
- ebegin "Forcing ${ast_instancename} to reload configuration" |
1223 |
- /usr/sbin/asterisk -C "${ast_confdir}/asterisk.conf" -r -x "module reload" &>/dev/null |
1224 |
- eend $? |
1225 |
- else |
1226 |
- eerror "${ast_instancename} is not running!" |
1227 |
- fi |
1228 |
-} |