port from sysv5 to systemd [release 20.2.1-2mamba;Mon Apr 24 2023]

This commit is contained in:
Silvan Calarco 2024-01-05 20:35:58 +01:00
parent add831f734
commit 47f9e693fb
4 changed files with 58 additions and 23 deletions

10
asterisk.logrotated Normal file
View File

@ -0,0 +1,10 @@
/var/log/asterisk/*_log /var/log/asterisk/messages.log {
create 640 asterisk asterisk
compress
missingok
notifempty
postrotate
/usr/sbin/asterisk -rx "logger reload" 1>/dev/null || true
endscript
}

View File

@ -1,6 +1,6 @@
Name: asterisk
Version: 20.2.1
Release: 1mamba
Release: 2mamba
Summary: Asterisk PBX
Group: System/Telephony
Vendor: openmamba
@ -8,6 +8,9 @@ Distribution: openmamba
Packager: Silvan Calarco <silvan.calarco@mambasoft.it>
URL: https://www.asterisk.org
Source: http://downloads.digium.com/pub/asterisk/releases/asterisk-%{version}.tar.gz
Source1: asterisk.logrotated
Source2: asterisk.sysusers
Source3: asterisk.tmpfiles
Patch0: %{name}-1.6.1.1-BOOL_typedef.patch
Patch1: %{name}-1.6.1.6-lua.patch
Patch2: %{name}-1.8.0-fix_build.patch
@ -93,20 +96,21 @@ This package contains static libraries and header files needed for development.
#./bootstrap.sh
%build
#:<< _EOF
%configure \
--with-misdn
%make
%make MENUSELECT_CFLAGS= OPTIMIZE= DEBUG= ASTVARRUNDIR=/run/asterisk NOISY_BUILD=1
%install
[ "%{buildroot}" != / ] && rm -rf "%{buildroot}"
%makeinstall
%makeinstall samples
##make install INSTALL_PREFIX=%{buildroot}
#make samples INSTALL_PREFIX=%{buildroot}
%makeinstall install-headers samples
# make progdocs INSTALL_PREFIX=%{buildroot}
install -D -m 755 contrib/init.d/rc.redhat.asterisk %{buildroot}%{_initrddir}/asterisk
install -Dm644 -t %{buildroot}%{_unitdir} contrib/systemd/asterisk*.{service,socket}
install -Dm644 %{SOURCE2} %{buildroot}%{_sysusersdir}/asterisk.conf
install -Dm644 %{SOURCE1} %{buildroot}%{_sysconfdir}/logrotate.d/asterisk
install -Dm644 %{SOURCE3} %{buildroot}%{_tmpfilesdir}/asterisk.conf
ln -sf /var/spool/asterisk/vm %{buildroot}/var/lib/asterisk/sounds/vm
ln -sf /var/spool/asterisk/voicemail %{buildroot}/var/lib/asterisk/sounds/voicemail
@ -117,27 +121,33 @@ ln -sf libasteriskssl.so.1 %{buildroot}%{_libdir}/libasteriskssl.so
%clean
[ "%{buildroot}" != / ] && rm -rf "%{buildroot}"
%postun
if [ $1 -eq 1 ]; then
#upgrade
[ -e /var/lock/subsys/asterisk ] && service asterisk restart
fi
exit 0
%pre
%sysusers_create_package asterisk %{SOURCE2}
%tmpfiles_create_package asterisk %{SOURCE3}
:
%post
%systemd_post asterisk.socket
:
%preun
if [ $1 -eq 0 ]; then
#erase
service asterisk stop
/sbin/chkconfig --del asterisk
fi
exit 0
%systemd_preun asterisk.socket
:
%postun
%systemd_postun asterisk.socket
:
%files
%defattr(-,root,root)
%{_initrddir}/asterisk
%dir %{_sysconfdir}/asterisk
%config(noreplace) %{_sysconfdir}/asterisk/*
%config(noreplace) %{_sysconfdir}/logrotate.d/asterisk
%{_sbindir}/*
%{_unitdir}/asterisk.service
%{_unitdir}/asterisk*.socket
%{_sysusersdir}/asterisk.conf
%{_tmpfilesdir}/asterisk.conf
%{_libdir}/libasteriskssl.so.*
%{_libdir}/libasteriskpj.so.*
%dir %{_libdir}/asterisk/
@ -159,12 +169,15 @@ exit 0
%defattr(-,root,root)
%{_libdir}/libasteriskssl.so
%{_libdir}/libasteriskpj.so
#%{_includedir}/asterisk.h
#%dir %{_includedir}/asterisk
#%{_includedir}/asterisk/*
%{_includedir}/asterisk.h
%dir %{_includedir}/asterisk
%{_includedir}/asterisk/*
%doc BUGS ChangeLog
%changelog
* Mon Apr 24 2023 Silvan Calarco <silvan.calarco@mambasoft.it> 20.2.1-2mamba
- port from sysv5 to systemd
* Tue Apr 04 2023 Automatic Build System <autodist@mambasoft.it> 20.2.1-1mamba
- automatic version update by autodist

1
asterisk.sysusers Normal file
View File

@ -0,0 +1 @@
u asterisk /usr/bin/asterisk "Asterisk PBX and telephony" /run/asterisk

11
asterisk.tmpfiles Normal file
View File

@ -0,0 +1,11 @@
Z /etc/asterisk - asterisk asterisk
d /etc/asterisk 0750 - - -
z /etc/asterisk/*.adsi 0640 - -
z /etc/asterisk/*.ael 0640 - -
z /etc/asterisk/*.conf 0640 - -
z /etc/asterisk/*.lua 0640 - -
z /etc/asterisk/*.timers 0640 - -
d /run/asterisk 0750 asterisk asterisk -
d /var/lib/asterisk 0750 asterisk asterisk -
d /var/log/asterisk 0750 asterisk asterisk -
d /var/spool/asterisk 0750 asterisk asterisk -