aur/asterisk to 11.4.0-4

This commit is contained in:
Mike Brown 2013-06-26 12:41:16 -04:00
parent 1e30cba123
commit aa2760106d
4 changed files with 61 additions and 136 deletions

View file

@ -1,66 +1,54 @@
# Maintainer: Xavier Devlamynck <magicrhesus@ouranos.be>
#ALARM: moonman
# -based on asterisk-ltr in aur
# -added makeflags =-j1, otherwise it fails
# -added asterisk.service for systemd
# -removed dahdi, libpri from deps
# -changed default pid file location to
# /var/run/asterisk (as in asterisk (non ltr) in aur)
# -asterisk.logrotated was forgotten to be included in package - fixed
# Maintainer : Xavier Devlamynck <magicrhesus@ouranos.be>
# Contributor: Alessio Biancalana <dottorblaster@gmail.com>
pkgname=asterisk
pkgver=11.4.0
pkgrel=1
pkgdesc="A complete PBX solution (Long Term Support)"
arch=('arm')
groups=()
pkgrel=4
pkgdesc="A complete PBX solution"
arch=('i686' 'x86_64')
backup=('etc/asterisk/acl.conf' 'etc/asterisk/adsi.conf' 'etc/asterisk/agents.conf' 'etc/asterisk/alarmreceiver.conf' 'etc/asterisk/alsa.conf' 'etc/asterisk/amd.conf' 'etc/asterisk/app_mysql.conf' 'etc/asterisk/app_skel.conf'
'etc/asterisk/asterisk.conf' 'etc/asterisk/calendar.conf' 'etc/asterisk/ccss.conf' 'etc/asterisk/cdr.conf' 'etc/asterisk/cdr_adaptive_odbc.conf' 'etc/asterisk/cdr_custom.conf' 'etc/asterisk/cdr_manager.conf' 'etc/asterisk/cdr_mysql.conf'
'etc/asterisk/cdr_odbc.conf' 'etc/asterisk/cdr_pgsql.conf' 'etc/asterisk/cdr_sqlite3_custom.conf' 'etc/asterisk/cdr_syslog.conf' 'etc/asterisk/cdr_tds.conf' 'etc/asterisk/cel.conf' 'etc/asterisk/cel_custom.conf' 'etc/asterisk/cel_odbc.conf'
'etc/asterisk/cel_pgsql.conf' 'etc/asterisk/cel_sqlite3_custom.conf' 'etc/asterisk/cel_tds.conf' 'etc/asterisk/chan_dahdi.conf' 'etc/asterisk/chan_mobile.conf' 'etc/asterisk/cli.conf' 'etc/asterisk/cli_aliases.conf' 'etc/asterisk/cli_permissions.conf'
'etc/asterisk/codecs.conf' 'etc/asterisk/confbridge.conf' 'etc/asterisk/config_test.conf' 'etc/asterisk/console.conf' 'etc/asterisk/dbsep.conf' 'etc/asterisk/dnsmgr.conf' 'etc/asterisk/dsp.conf' 'etc/asterisk/dundi.conf' 'etc/asterisk/enum.conf'
'etc/asterisk/extconfig.conf' 'etc/asterisk/extensions.conf' 'etc/asterisk/extensions_minivm.conf' 'etc/asterisk/features.conf' 'etc/asterisk/festival.conf' 'etc/asterisk/followme.conf' 'etc/asterisk/func_odbc.conf' 'etc/asterisk/gtalk.conf'
'etc/asterisk/h323.conf' 'etc/asterisk/http.conf' 'etc/asterisk/iax.conf' 'etc/asterisk/iaxprov.conf' 'etc/asterisk/indications.conf' 'etc/asterisk/jabber.conf' 'etc/asterisk/jingle.conf' 'etc/asterisk/logger.conf' 'etc/asterisk/manager.conf' 'etc/asterisk/meetme.conf'
'etc/asterisk/mgcp.conf' 'etc/asterisk/minivm.conf' 'etc/asterisk/misdn.conf' 'etc/asterisk/modules.conf' 'etc/asterisk/motif.conf' 'etc/asterisk/musiconhold.conf' 'etc/asterisk/muted.conf' 'etc/asterisk/ooh323.conf' 'etc/asterisk/osp.conf' 'etc/asterisk/oss.conf'
'etc/asterisk/phone.conf' 'etc/asterisk/phoneprov.conf' 'etc/asterisk/queuerules.conf' 'etc/asterisk/queues.conf' 'etc/asterisk/res_config_mysql.conf' 'etc/asterisk/res_config_sqlite.conf' 'etc/asterisk/res_config_sqlite3.conf'
'etc/asterisk/res_corosync.conf' 'etc/asterisk/res_curl.conf' 'etc/asterisk/res_fax.conf' 'etc/asterisk/res_ldap.conf' 'etc/asterisk/res_odbc.conf' 'etc/asterisk/res_pgsql.conf' 'etc/asterisk/res_pktccops.conf' 'etc/asterisk/res_snmp.conf'
'etc/asterisk/res_stun_monitor.conf' 'etc/asterisk/rtp.conf' 'etc/asterisk/say.conf' 'etc/asterisk/sip.conf' 'etc/asterisk/sip_notify.conf' 'etc/asterisk/skinny.conf' 'etc/asterisk/sla.conf' 'etc/asterisk/smdi.conf' 'etc/asterisk/udptl.conf' 'etc/asterisk/unistim.conf'
'etc/asterisk/users.conf' 'etc/asterisk/voicemail.conf' 'etc/asterisk/vpb.conf' 'etc/asterisk/xmpp.conf')
url="http://www.asterisk.org"
license=('GPL2')
depends=('libusb' 'libxml2' 'openssl' 'curl' 'gmime' 'iksemel' 'libldap' 'net-snmp' 'postgresql-libs' 'speex' 'sqlite' 'libcap' 'libvorbis' 'unixodbc' 'libnewt' 'libresample' 'alsa-lib' 'popt' 'lua' 'neon' 'jack' 'sdl' 'gsm')
optdepends=('radiusclient-ng' 'libpri' 'dahdi' 'dahdi-tools')
makedepends=('linux-headers')
conflicts=('asterisk' 'asterisk16' 'asterisk18' 'asterisk10' 'asterisk-svn')
provides=('asterisk')
options=(makeflags)
MAKEFLAGS="-j1"
license=('GPL')
depends=('alsa-lib' 'speex' 'popt' 'libvorbis' 'curl')
makedepends=('postgresql' 'unixodbc' 'sqlite3')
optdepends=('libpri' 'libss7' 'openr2' 'iksemel' 'radiusclient-ng' 'dahdi')
source=(http://downloads.asterisk.org/pub/telephony/asterisk/releases/asterisk-${pkgver}.tar.gz \
${pkgname}.service \
${pkgname}.logrotated)
install=${pkgname}.install
source=(http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-${pkgver}.tar.gz
asterisk
asterisk.logrotated
asterisk.service)
sha1sums=('8ec0d10834c87a2bff58f23d961c67f16a26d01a'
'19ca30d5dde7ba90e56c21abfe4fb9fcf2529e98'
'38a772e20c9a1987faf433ca38c8536012fbada0'
'159af010477153d08839c73830526fc32e554940')
sha256sums=('081ba8de5f349ff23de8e000d8cda38a2ca34858174e9379b2662a732557e9d4'
'74e0b278d553499f0c648a6e3d55c0dbb11b0c6dc93a85b020a21eafadb83783'
'caa24cfec5c6b4f8cea385269e39557362acad7e2a552994c3bc24080e3bdd4e')
build() {
cd $srcdir/asterisk-${pkgver}
msg "Configuring..."
./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var
msg "Building..."
cd ${srcdir}/${pkgname}-${pkgver}
./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var --sbindir=/usr/bin
make
}
package() {
cd ${srcdir}/asterisk-${pkgver}
package(){
cd ${srcdir}/${pkgname}-${pkgver}
make DESTDIR=${pkgdir} install
make DESTDIR=${pkgdir} samples
sed -i -e "s/\/var\/run/\/run/" ${pkgdir}/etc/asterisk/asterisk.conf
(cd ${pkgdir}/etc/asterisk
# for i in `ls`; do [ $i = "asterisk.conf" ] || mv $i $i.default; done
ls -I asterisk.conf | xargs -I '{}' mv '{}' '{}.default')
# cp ${srcdir}/modules.conf modules.conf
sed -i -e "s/\/var\/run/\/var\/run\/asterisk/" $pkgdir/etc/asterisk/asterisk.conf
mkdir -p "$pkgdir/etc/tmpfiles.d"
echo "d /run/asterisk 0775 root asterisk" > $pkgdir/etc/tmpfiles.d/asterisk.conf
install -D "$srcdir/asterisk" "$pkgdir/etc/rc.d/asterisk"
install -Dm644 "$srcdir/$pkgname.service" "$pkgdir/usr/lib/systemd/system/$pkgname.service"
install -Dm644 "$srcdir/asterisk.logrotated" "$pkgdir/etc/logrotate.d/asterisk"
}
# vim:set ts=2 sw=2 et:
mkdir -p ${pkgdir}/usr/share/doc/asterisk/examples
for i in ${pkgdir}/etc/asterisk/*; do install -D -m 644 $i ${pkgdir}/usr/share/doc/asterisk/examples/; done
mv ${pkgdir}/var/run ${pkgdir}
install -D -m 644 ${srcdir}/asterisk.logrotated ${pkgdir}/etc/logrotate.d/asterisk
install -D -m 644 ${srcdir}/asterisk.service ${pkgdir}/usr/lib/systemd/system/asterisk.service
}

View file

@ -1,38 +0,0 @@
#!/bin/bash
# general config
. /etc/rc.conf
. /etc/rc.d/functions
PID=`pidof -o %PPID /usr/sbin/asterisk`
case "$1" in
start)
stat_busy "Starting Asterisk"
[ -z "$PID" ] && cd /var/lib/asterisk && /usr/sbin/asterisk -G asterisk -U asterisk
if [ $? -gt 0 ]; then
stat_fail
else
add_daemon asterisk
stat_done
fi
;;
stop)
stat_busy "Stopping Asterisk"
[ ! -z "$PID" ] && kill $PID &> /dev/null
if [ $? -gt 0 ]; then
stat_fail
else
rm -f /var/run/asterisk/asterisk.pid &>/dev/null
rm_daemon asterisk
stat_done
fi
;;
restart)
$0 stop
sleep 2
$0 start
;;
*)
echo "usage: $0 {start|stop|restart}"
esac
exit 0

View file

@ -1,40 +1,15 @@
post_install() {
echo -n "adding asterisk system group... "
groupadd -g 5060 asterisk && echo "done."
echo -n "adding asterisk system user... "
useradd -c "Asterisk daemon" -u 5060 -d /var/lib/asterisk -g asterisk -s /bin/false asterisk \
&& echo "done."
passwd -l asterisk &>/dev/null
chown -R asterisk:asterisk /var/run/asterisk
chown -R asterisk:asterisk /var/log/asterisk
chown -R asterisk:asterisk /var/spool/asterisk
chown -R asterisk:asterisk /var/lib/asterisk
groupadd -r asterisk
useradd -MNr -s /bin/false -d /run/asterisk -g asterisk asterisk && passwd -l asterisk &>/dev/null
cat << EOF
>>>
>>> To get Music on Hold working do pacman -S mpg123
>>> To get the postgresql, unixodbc or sqlite modules working
>>> download the respective package and modify modules.conf to reflect
>>> your changes.
>>>
EOF
}
post_upgrade() {
if grep asterisk /etc/passwd &>/dev/null; then
/bin/true
else
post_install $1
fi
chown -R asterisk:asterisk /etc/asterisk
chown -R asterisk:asterisk /var/lib/asterisk
chown -R asterisk:asterisk /var/log/asterisk
chown -R asterisk:asterisk /run/asterisk
chown -R asterisk:asterisk /var/spool/asterisk
}
post_remove() {
echo -n -e "\nremoving asterisk system user... "
userdel asterisk && echo "done."
echo -n -e "\nremoving systemd tmpfiles... "
rm -f /etc/tmpfiles.d/asterisk.conf && echo "done."
userdel asterisk &>/dev/null
groupdel asterisk &>/dev/null
}
op=$1
shift
$op $*

View file

@ -1,20 +1,20 @@
[Unit]
Description=Asterisk PBX and telephony daemon.
Description=Asterisk PBX and telephony daemon
Documentation=man:asterisk(8)
Wants=network.target
After=network.target
[Service]
Type=simple
RemainAfterExit=yes
Environment=HOME=/var/lib/asterisk
WorkingDirectory=/var/lib/asterisk
User=asterisk
Group=asterisk
PIDFile=/run/asterisk/asterisk.pid
ExecStart=/usr/sbin/asterisk -C /etc/asterisk/asterisk.conf
ExecStop=/usr/sbin/asterisk -rx 'core stop now'
ExecReload=/usr/sbin/asterisk -rx 'core reload'
Group=asterisk
ExecStart=/usr/bin/asterisk -f -C /etc/asterisk/asterisk.conf
ExecStop=/usr/bin/asterisk -rx 'core stop now'
ExecReload=/usr/bin/asterisk -rx 'core reload'
PrivateTmp=true
# safe_asterisk emulation
Restart=always
RestartSec=10
[Install]
WantedBy=multi-user.target