Added support to generate systemd based RPMs on systems that support it.

git-svn-id: http://yate.null.ro/svn/yate/trunk@5824 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
paulc 2014-04-17 15:35:21 +00:00
parent 11f9a6c4d2
commit 92ec1d54be
3 changed files with 37 additions and 1 deletions

View File

@ -9,9 +9,12 @@
# pidfile: /var/run/yate.pid
#
# Extra Yate command line options
# Extra Yate command line options, do not edit them here
OPTS="-F -s -r -l /var/log/yate -vvv -Df"
# To override create file /etc/sysconfig/yate and put OPTS=... in it
[ -r /etc/sysconfig/yate ] && . /etc/sysconfig/yate
# Source function library.
. /etc/rc.d/init.d/functions

20
packing/rpm/yate.service Normal file
View File

@ -0,0 +1,20 @@
[Unit]
Description=YATE Telephony Server
Documentation=man:yate(8)
After=network.target
After=mysql.service
After=postgresql.service
[Service]
Type=forking
ExecStart=/usr/bin/yate -d -p /var/run/yate.pid $OPTS
ExecReload=/bin/kill -HUP $MAINPID
PIDFile=/var/run/yate.pid
TimeoutSec=30
# Default Yate command line options, do not edit them here
Environment="OPTS=-F -s -r -l /var/log/yate -vvv -Df" "PWLIB_ASSERT_ACTION=C"
# To override create file /etc/sysconfig/yate and put OPTS=... in it
EnvironmentFile=-/etc/sysconfig/yate
[Install]
WantedBy=multi-user.target

View File

@ -1,3 +1,5 @@
# to force creation of a systemd service unit run rpmbuild --define 'systemd 1'
# to force creation of a System V init script run rpmbuild --define 'systemd 0'
# to add a distro release tag run rpmbuild --define 'dist value'
# to add a revision tag run rpmbuild --define 'revision value'
# to create a debug info package run rpmbuild --define 'debuginfo 1'
@ -9,6 +11,8 @@
# to disable only Zaptel support run rpmbuild --define 'nozap 1'
# to disable only TDMV support run rpmbuild --define 'notdm 1'
%{!?systemd:%define systemd %(test -x /usr/bin/systemd && echo 1 || echo 0)}
%{!?_unitdir:%define _unitdir /usr/lib/systemd/system}
%{!?dist:%define dist %{nil}}
%{!?revision:%define revision %{nil}}
%{?nodeps:%define no_auto_deps 1}
@ -90,7 +94,11 @@ for small to large scale projects.
%{_libdir}/libyatemgcp.so.*
%{_bindir}/yate
%{_mandir}/*/yate.*
%if "%{systemd}" != "0"
%{_unitdir}/yate.service
%else
%{_initrddir}/yate
%endif
%dir %{_datadir}/yate/data
%{_datadir}/yate/data/*
%dir %{_libdir}/yate
@ -594,8 +602,13 @@ make %{stripped}
%install
make install DESTDIR=%{buildroot}
rm %{buildroot}%{_sysconfdir}/yate/amrnbcodec.conf
%if "%{systemd}" != "0"
mkdir -p %{buildroot}%{_unitdir}
cp -p %{_builddir}/%{name}/packing/rpm/yate.service %{buildroot}%{_unitdir}/yate.service
%else
mkdir -p %{buildroot}%{_initrddir}
cp -p %{_builddir}/%{name}/packing/rpm/yate.init %{buildroot}%{_initrddir}/yate
%endif
mkdir -p %{buildroot}%{_sysconfdir}/logrotate.d
cp -p %{_builddir}/%{name}/packing/yate.logrotate %{buildroot}%{_sysconfdir}/logrotate.d/yate