convert to systemd

This commit is contained in:
Tom "spot" Callaway 2011-09-08 14:45:31 -04:00
parent 89dc2a3d9c
commit a755be0e23
3 changed files with 45 additions and 37 deletions

1
freeradius-tmpfiles.conf Normal file
View File

@ -0,0 +1 @@
D /var/run/radiusd 0710 radiusd radiusd -

View File

@ -1,15 +1,16 @@
Summary: High-performance and highly configurable free RADIUS server Summary: High-performance and highly configurable free RADIUS server
Name: freeradius Name: freeradius
Version: 2.1.11 Version: 2.1.11
Release: 4%{?dist} Release: 5%{?dist}
License: GPLv2+ and LGPLv2+ License: GPLv2+ and LGPLv2+
Group: System Environment/Daemons Group: System Environment/Daemons
URL: http://www.freeradius.org/ URL: http://www.freeradius.org/
Source0: ftp://ftp.freeradius.org/pub/radius/freeradius-server-%{version}.tar.bz2 Source0: ftp://ftp.freeradius.org/pub/radius/freeradius-server-%{version}.tar.bz2
Source100: freeradius-radiusd-init Source100: radiusd.service
Source102: freeradius-logrotate Source102: freeradius-logrotate
Source103: freeradius-pam-conf Source103: freeradius-pam-conf
Source104: %{name}-tmpfiles.conf
Patch1: freeradius-cert-config.patch Patch1: freeradius-cert-config.patch
@ -19,8 +20,6 @@ Obsoletes: freeradius-libs
%define docdir %{_docdir}/freeradius-%{version} %define docdir %{_docdir}/freeradius-%{version}
%define initddir %{?_initddir:%{_initddir}}%{!?_initddir:%{_initrddir}} %define initddir %{?_initddir:%{_initddir}}%{!?_initddir:%{_initrddir}}
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: autoconf BuildRequires: autoconf
BuildRequires: gdbm-devel BuildRequires: gdbm-devel
BuildRequires: libtool BuildRequires: libtool
@ -32,10 +31,10 @@ BuildRequires: net-snmp-devel
BuildRequires: net-snmp-utils BuildRequires: net-snmp-utils
BuildRequires: readline-devel BuildRequires: readline-devel
BuildRequires: libpcap-devel BuildRequires: libpcap-devel
BuildRequires: systemd-units
Requires(pre): shadow-utils glibc-common Requires(pre): shadow-utils glibc-common
Requires(post): /sbin/chkconfig Requires(post): systemd-sysv
Requires(preun): /sbin/chkconfig
%description %description
The FreeRADIUS Server Project is a high performance and highly configurable The FreeRADIUS Server Project is a high performance and highly configurable
@ -181,8 +180,7 @@ perl -pi -e 's:sys_lib_search_path_spec=.*:sys_lib_search_path_spec="/lib64 /usr
make LINK_MODE=-pie make LINK_MODE=-pie
%install %install
rm -rf $RPM_BUILD_ROOT mkdir -p %{buildroot}%{_sysconfdir}/tmpfiles.d
mkdir -p $RPM_BUILD_ROOT/var/run/radiusd
mkdir -p $RPM_BUILD_ROOT/var/lib/radiusd mkdir -p $RPM_BUILD_ROOT/var/lib/radiusd
# fix for bad libtool bug - can not rebuild dependent libs and bins # fix for bad libtool bug - can not rebuild dependent libs and bins
#FIXME export LD_LIBRARY_PATH=$RPM_BUILD_ROOT/%{_libdir} #FIXME export LD_LIBRARY_PATH=$RPM_BUILD_ROOT/%{_libdir}
@ -195,10 +193,15 @@ perl -i -pe 's/^#group =.*$/group = radiusd/' $RADDB/radiusd.conf
mkdir -p $RPM_BUILD_ROOT/var/log/radius/radacct mkdir -p $RPM_BUILD_ROOT/var/log/radius/radacct
touch $RPM_BUILD_ROOT/var/log/radius/{radutmp,radius.log} touch $RPM_BUILD_ROOT/var/log/radius/{radutmp,radius.log}
install -D -m 755 %{SOURCE100} $RPM_BUILD_ROOT/%{initddir}/radiusd install -D -m 755 %{SOURCE100} $RPM_BUILD_ROOT/%{_unitdir}/radiusd.service
install -D -m 644 %{SOURCE102} $RPM_BUILD_ROOT/%{_sysconfdir}/logrotate.d/radiusd install -D -m 644 %{SOURCE102} $RPM_BUILD_ROOT/%{_sysconfdir}/logrotate.d/radiusd
install -D -m 644 %{SOURCE103} $RPM_BUILD_ROOT/%{_sysconfdir}/pam.d/radiusd install -D -m 644 %{SOURCE103} $RPM_BUILD_ROOT/%{_sysconfdir}/pam.d/radiusd
mkdir -p %{buildroot}%{_sysconfdir}/tmpfiles.d
mkdir -p %{buildroot}%{_localstatedir}/run/
install -d -m 0710 %{buildroot}%{_localstatedir}/run/radiusd/
install -m 0644 %{SOURCE104} %{buildroot}%{_sysconfdir}/tmpfiles.d/%{name}.conf
# remove unneeded stuff # remove unneeded stuff
rm -rf doc/00-OLD rm -rf doc/00-OLD
rm -f $RPM_BUILD_ROOT/usr/sbin/rc.radiusd rm -f $RPM_BUILD_ROOT/usr/sbin/rc.radiusd
@ -237,10 +240,6 @@ Please reference that document.
EOF EOF
%clean
rm -rf $RPM_BUILD_ROOT
# Make sure our user/group is present prior to any package or subpackage installation # Make sure our user/group is present prior to any package or subpackage installation
%pre %pre
@ -250,41 +249,40 @@ exit 0
%post %post
if [ $1 -eq 1 ]; then # install if [ $1 -eq 1 ]; then # install
/sbin/chkconfig --add radiusd
if [ ! -e /etc/raddb/certs/server.pem ]; then if [ ! -e /etc/raddb/certs/server.pem ]; then
/sbin/runuser -g radiusd -c 'umask 007; /etc/raddb/certs/bootstrap' > /dev/null 2>&1 /sbin/runuser -g radiusd -c 'umask 007; /etc/raddb/certs/bootstrap' > /dev/null 2>&1
fi fi
fi fi
exit 0 exit 0
%preun
if [ $1 -eq 0 ]; then # uninstall
/sbin/service radiusd stop > /dev/null 2>&1
/sbin/chkconfig --del radiusd
fi
exit 0
%postun %postun
if [ $1 -ge 1 ]; then # upgrade
/sbin/service radiusd condrestart >/dev/null 2>&1
fi
if [ $1 -eq 0 ]; then # uninstall if [ $1 -eq 0 ]; then # uninstall
getent passwd radiusd >/dev/null && /usr/sbin/userdel radiusd > /dev/null 2>&1 getent passwd radiusd >/dev/null && /usr/sbin/userdel radiusd > /dev/null 2>&1
getent group radiusd >/dev/null && /usr/sbin/groupdel radiusd > /dev/null 2>&1 getent group radiusd >/dev/null && /usr/sbin/groupdel radiusd > /dev/null 2>&1
fi fi
exit 0 exit 0
%triggerun -- freeradius < 2.1.11-5
# Save the current service runlevel info
# User must manually run systemd-sysv-convert --apply radiusd
# to migrate them to systemd targets
/usr/bin/systemd-sysv-convert --save radiusd >/dev/null 2>&1 ||:
# Run these because the SysV package being removed won't do them
/sbin/chkconfig --del radiusd >/dev/null 2>&1 || :
/bin/systemctl try-restart radiusd.service >/dev/null 2>&1 || :
%files %files
%defattr(-,root,root)
%doc %{docdir}/ %doc %{docdir}/
%config(noreplace) %{_sysconfdir}/pam.d/radiusd %config(noreplace) %{_sysconfdir}/pam.d/radiusd
%config(noreplace) %{_sysconfdir}/logrotate.d/radiusd %config(noreplace) %{_sysconfdir}/logrotate.d/radiusd
%{initddir}/radiusd %{_unitdir}/radiusd.service
%dir %{_localstatedir}/run/radiusd/
%config(noreplace) %{_sysconfdir}/tmpfiles.d/%{name}.conf
%dir %attr(755,radiusd,radiusd) /var/lib/radiusd %dir %attr(755,radiusd,radiusd) /var/lib/radiusd
# configs # configs
%dir %attr(755,root,radiusd) /etc/raddb %dir %attr(755,root,radiusd) /etc/raddb
%defattr(-,root,radiusd)
%attr(644,root,radiusd) %config(noreplace) /etc/raddb/dictionary %attr(644,root,radiusd) %config(noreplace) /etc/raddb/dictionary
%config(noreplace) /etc/raddb/acct_users %config(noreplace) /etc/raddb/acct_users
%config(noreplace) /etc/raddb/attrs %config(noreplace) /etc/raddb/attrs
@ -369,7 +367,6 @@ exit 0
%attr(640,root,radiusd) %config(noreplace) /etc/raddb/modules/wimax %attr(640,root,radiusd) %config(noreplace) /etc/raddb/modules/wimax
%dir %attr(755,radiusd,radiusd) /var/run/radiusd/ %dir %attr(755,radiusd,radiusd) /var/run/radiusd/
# binaries # binaries
%defattr(-,root,root)
/usr/sbin/checkrad /usr/sbin/checkrad
/usr/sbin/raddebug /usr/sbin/raddebug
/usr/sbin/radiusd /usr/sbin/radiusd
@ -516,7 +513,6 @@ exit 0
%{_libdir}/freeradius/rlm_wimax-%{version}.so %{_libdir}/freeradius/rlm_wimax-%{version}.so
%files utils %files utils
%defattr(-,root,root)
/usr/bin/* /usr/bin/*
# man-pages # man-pages
%doc %{_mandir}/man1/radclient.1.gz %doc %{_mandir}/man1/radclient.1.gz
@ -529,23 +525,19 @@ exit 0
%doc %{_mandir}/man8/rlm_ippool_tool.8.gz %doc %{_mandir}/man8/rlm_ippool_tool.8.gz
%files krb5 %files krb5
%defattr(-,root,root)
%{_libdir}/freeradius/rlm_krb5.so %{_libdir}/freeradius/rlm_krb5.so
%{_libdir}/freeradius/rlm_krb5-%{version}.so %{_libdir}/freeradius/rlm_krb5-%{version}.so
%attr(640,root,radiusd) %config(noreplace) /etc/raddb/modules/krb5 %attr(640,root,radiusd) %config(noreplace) /etc/raddb/modules/krb5
%files perl %files perl
%defattr(-,root,root)
%{_libdir}/freeradius/rlm_perl.so %{_libdir}/freeradius/rlm_perl.so
%{_libdir}/freeradius/rlm_perl-%{version}.so %{_libdir}/freeradius/rlm_perl-%{version}.so
%files python %files python
%defattr(-,root,root)
%{_libdir}/freeradius/rlm_python.so %{_libdir}/freeradius/rlm_python.so
%{_libdir}/freeradius/rlm_python-%{version}.so %{_libdir}/freeradius/rlm_python-%{version}.so
%files mysql %files mysql
%defattr(-,root,root)
%dir %attr(750,root,radiusd) /etc/raddb/sql/mysql %dir %attr(750,root,radiusd) /etc/raddb/sql/mysql
%attr(640,root,radiusd) %config(noreplace) /etc/raddb/sql/mysql/* %attr(640,root,radiusd) %config(noreplace) /etc/raddb/sql/mysql/*
%dir %attr(750,root,radiusd) /etc/raddb/sql/ndb %dir %attr(750,root,radiusd) /etc/raddb/sql/ndb
@ -554,25 +546,25 @@ exit 0
%{_libdir}/freeradius/rlm_sql_mysql-%{version}.so %{_libdir}/freeradius/rlm_sql_mysql-%{version}.so
%files postgresql %files postgresql
%defattr(-,root,root)
%dir %attr(750,root,radiusd) /etc/raddb/sql/postgresql %dir %attr(750,root,radiusd) /etc/raddb/sql/postgresql
%attr(640,root,radiusd) %config(noreplace) /etc/raddb/sql/postgresql/* %attr(640,root,radiusd) %config(noreplace) /etc/raddb/sql/postgresql/*
%{_libdir}/freeradius/rlm_sql_postgresql.so %{_libdir}/freeradius/rlm_sql_postgresql.so
%{_libdir}/freeradius/rlm_sql_postgresql-%{version}.so %{_libdir}/freeradius/rlm_sql_postgresql-%{version}.so
%files ldap %files ldap
%defattr(-,root,root)
%attr(640,root,radiusd) %config(noreplace) /etc/raddb/ldap.attrmap %attr(640,root,radiusd) %config(noreplace) /etc/raddb/ldap.attrmap
%{_libdir}/freeradius/rlm_ldap.so %{_libdir}/freeradius/rlm_ldap.so
%{_libdir}/freeradius/rlm_ldap-%{version}.so %{_libdir}/freeradius/rlm_ldap-%{version}.so
%attr(640,root,radiusd) %config(noreplace) /etc/raddb/modules/ldap %attr(640,root,radiusd) %config(noreplace) /etc/raddb/modules/ldap
%files unixODBC %files unixODBC
%defattr(-,root,root)
%{_libdir}/freeradius/rlm_sql_unixodbc.so %{_libdir}/freeradius/rlm_sql_unixodbc.so
%{_libdir}/freeradius/rlm_sql_unixodbc-%{version}.so %{_libdir}/freeradius/rlm_sql_unixodbc-%{version}.so
%changelog %changelog
* Thu Sep 8 2011 Tom Callaway <spot@fedoraproject.org> - 2.1.11-5
- convert to systemd
* Thu Jul 21 2011 Petr Sabata <contyk@redhat.com> - 2.1.11-4 * Thu Jul 21 2011 Petr Sabata <contyk@redhat.com> - 2.1.11-4
- Perl mass rebuild - Perl mass rebuild

15
radiusd.service Normal file
View File

@ -0,0 +1,15 @@
[Unit]
Description=FreeRADIUS high performance RADIUS server.
After=syslog.target network.target
[Service]
Type=forking
PIDFile=/var/run/radiusd/radiusd
ExecStartPre=-/bin/chown -R radiusd.radiusd /var/run/radiusd
ExecStartPre=/usr/sbin/radiusd -C
ExecStart=/usr/sbin/radiusd -d /etc/raddb
ExecReload=/usr/sbin/radiusd -C
ExecReload=/bin/kill -HUP $MAINPID
[Install]
WantedBy=multi-user.target