-# FIXME: find a way of getting rid of "-" on versions ... rpm will be happy
+#
+%include /usr/lib/rpm/macros.perl
+# FIXME: won't be good to include these contrib examples?
+# Source1: http://www.ping.de/~fdc/radius/radacct-replay
+# Source3: ftp://ftp.freeradius.org/pub/radius/contrib/radwho.cgi
Summary: High-performance and highly configurable RADIUS server
-Summary(pl): Szybki i wysoce konfigurowalny serwer RADIUS.
+Summary(pl): Szybki i wysoce konfigurowalny serwer RADIUS
Name: freeradius
-Version: 0.1
-Release: 0
-URL: http://www.freeradius.org/
+Version: 1.0.1
+Release: 2
License: GPL
Group: Networking/Daemons
-Group(de): Netzwerkwesen/Server
-Group(pl): Sieciowe/Serwery
-Prereq: /sbin/chkconfig
-# FIXME: snmpwalk, snmpget and rusers POSSIBLY needed by checkrad
-Requires: libtool
+Source0: ftp://ftp.freeradius.org/pub/radius/%{name}-%{version}.tar.gz
+# Source0-md5: abc30cb71367f859ceed4de6477cd59f
+Source1: %{name}.logrotate
+Source2: %{name}.init
+Source3: %{name}.pam
+Patch0: %{name}-autoconf_mysql.patch
+Patch1: %{name}-makefile.patch
+Patch2: %{name}-smbencrypt.patch
+Patch3: %{name}-linking.patch
+Patch4: %{name}-moduledir.patch
+Patch5: %{name}-rundir.patch
+Patch6: %{name}-config.patch
+URL: http://www.freeradius.org/
+Provides: user(radius)
+Provides: group(radius)
+BuildRequires: autoconf
+BuildRequires: automake
+BuildRequires: cyrus-sasl-devel
+BuildRequires: gdbm-devel
BuildRequires: libltdl-devel
-BuildRequires: openldap-devel
-#someone's help needed:split&test into %{name}-{mysql,pgsql,common,devel,static,ldap,pam?} hunter.
+BuildRequires: libtool
BuildRequires: mysql-devel
-BuildRequires: postgresql-devel
+BuildRequires: openldap-devel
+BuildRequires: openssl-devel >= 0.9.7d
BuildRequires: pam-devel
-Obsoletes: cistron-radius
-Source0: ftp://ftp.freeradius.org/pub/radius/%{name}-%{version}.tar.gz
-
-%define _localstatedir /var/radius
-
-# FIXME: won't be good to include these contrib examples?
-# Source1: http://www.ping.de/~fdc/radius/radacct-replay
-# Source2: http://www.ping.de/~fdc/radius/radlast-0.03
-# Source3: ftp://ftp.freeradius.org/pub/radius/contrib/radwho.cgi
-
+BuildRequires: perl-devel
+BuildRequires: postgresql-backend-devel
+BuildRequires: postgresql-devel
+BuildRequires: python-devel
+BuildRequires: net-snmp-devel
+BuildRequires: unixODBC-devel
+BuildRequires: rpm-perlprov
+BuildRequires: rpm-pythonprov
+PreReq: rc-scripts
+Requires(post,preun): /sbin/chkconfig
+Requires: libtool
+Requires: perl(DynaLoader) = %(%{__perl} -MDynaLoader -e 'print DynaLoader->VERSION')
BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
+Obsoletes: cistron-radius
%description
The FreeRADIUS Server Project is an attempt to create a
generally similar to the Livingston 2.0 RADIUS server, but has a lot
more features, and is much more configurable.
-%description(pl)
+%description -l pl
Projekt FreeRadius ma na celu stworzenie szybkiego i wysoce
konfigurowalnego serwera RADIUS na licencji GPL. Ten jest podobny do
Livingston 2.0 RADIUS server ale ma o wiele wiêcej ficzersów i jest
bardziej podatny na konfiguracjê.
-%prep
+%prep
%setup -q
+%patch0 -p1
+%patch1 -p1
+%patch2 -p1
+%patch3 -p1
+%patch4 -p1
+%patch5 -p1
+%patch6 -p1
-# FIXME: some folks prefer -dist files ... rename them or not?
-#cd raddb
-#chmod 640 clients naspasswd radiusd.conf.in
-#cd ..
+awk 'BEGIN { printit=0; } { if (printit) print $0; } /## end libtool.m4/ { printit=1;}' \
+ < aclocal.m4 > acinclude.m4
-%build
-CFLAGS="%{rpmcflags}"
-#libtoolize --copy --force
-#aclocal
-#autoconf
-#automake -a -c
+find . -type d -name CVS | xargs rm -r
-%configure --localstatedir=%{_localstatedir} \
+%build
+maindir="$(pwd)"
+for d in rlm_attr_rewrite rlm_checkval rlm_counter rlm_dbm \
+ rlm_eap/types/rlm_eap_{md5,mschapv2,peap,sim,tls,ttls} \
+ rlm_eap rlm_example rlm_ippool rlm_krb5 rlm_ldap rlm_pam rlm_perl rlm_python \
+ rlm_radutmp rlm_smb \
+ rlm_sql/drivers/rlm_sql_{db2,iodbc,mysql,oracle,postgresql,unixodbc} \
+ rlm_sql rlm_sqlcounter rlm_unix rlm_x99_token ; do
+
+ cd src/modules/${d}
+ %{__aclocal} -I ${maindir}
+ %{__autoconf}
+ if [ -f config.h.in ]; then
+ %{__autoheader}
+ fi
+ cd ${maindir}
+done
+%{__libtoolize}
+%{__aclocal}
+%{__autoconf}
+%{__autoheader}
+%configure \
+ SNMPGET="/usr/bin/snmpget" \
+ SNMPWALK="/usr/bin/snmpwalk" \
+ --enable-strict-dependencies \
+ --with-logdir=%{_var}/log/freeradius \
+ --with-experimental-modules \
--with-threads \
--with-thread-pool \
--with-gnu-ld \
- --disable-ltdl-install
-%{__make}
-
-libtool --finish %{_libdir}
+ --with-ltdl-include=%{_includedir}/none \
+ --with-ltdl-lib=%{_libdir} \
+ --disable-ltdl-install \
+ --without-rlm_krb5 \
+ --without-rlm_dbm
+%{__make} \
+ LIBTOOL="`pwd`/libtool --tag=CC"
%install
-# prepare $RPM_BUILD_ROOT
rm -rf $RPM_BUILD_ROOT
-install -d $RPM_BUILD_ROOT%{_sysconfdir}/{logrotate.d,pam.d,rc.d/init.d}
-
-# install files
-%{__make} install R=$RPM_BUILD_ROOT
-# done here & put noreplace in %files to avoid messing up existing installations
-for i in radutmp radwtmp radius.log radwatch.log checkrad.log
-do
- touch $RPM_BUILD_ROOT%{_localstatedir}/log/$i
- echo $RPM_BUILD_ROOT%{_localstatedir}/log/$i
- #who the hell should own logfiles/ and what sgid should have radiusd ?
-# do we need %{_sysconfdir}/shadow do be +r for wheel ? or better use PAM ?
- # Hunter
-done
+install -d $RPM_BUILD_ROOT{%{_sysconfdir}/raddb,%{_libdir}/%{name}} \
+ $RPM_BUILD_ROOT/etc/{logrotate.d,pam.d,rc.d/init.d} \
+ $RPM_BUILD_ROOT%{_var}/log/radius
+
+%{__make} install \
+ LIBTOOL="`pwd`/libtool --tag=CC" \
+ R=$RPM_BUILD_ROOT
+
+rm -f $RPM_BUILD_ROOT{%{_mandir}/man8/builddbm.8,%{_sbindir}/rc.radiusd}
+rm -f $RPM_BUILD_ROOT%{_sysconfdir}/raddb/{clients,*.pl}
+install %{SOURCE1} $RPM_BUILD_ROOT/etc/logrotate.d/%{name}
+install %{SOURCE2} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name}
+install %{SOURCE3} $RPM_BUILD_ROOT/etc/pam.d/radius
-# remove unneeded stuff
-%{__rm} -f $RPM_BUILD_ROOT%{_prefix}/{man/man8/builddbm.8,sbin/rc.radiusd}
+# remove useless static modules and library
+# rlm*.la are used (lt_dlopen)
+rm -f $RPM_BUILD_ROOT%{_libdir}/{*.a,libradius.la}
+rm -f $RPM_BUILD_ROOT%{_libdir}/%{name}/{*.a,libradius.la}
-cd redhat
-install -m 555 rc.radiusd-redhat $RPM_BUILD_ROOT/etc/rc.d/init.d/radiusd
-install radiusd-logrotate $RPM_BUILD_ROOT/etc/logrotate.d/radiusd
-install radiusd-pam $RPM_BUILD_ROOT/etc/pam.d/radius
-cd ..
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%pre
+if [ -n "`/usr/bin/getgid radius`" ]; then
+ if [ "`getgid radius`" != "29" ]; then
+ echo "Error: group radius doesn't have gid=29. Correct this before installing radius." 1>&2
+ exit 1
+ fi
+else
+ /usr/sbin/groupadd -g 29 -r -f radius
+ if [ -n "`id -u radius 2>/dev/null`" ]; then
+ # upgrade from previous versions of the package, where radius' gid was "nobody"
+ if [ "`id -g radius`" = "99" ]; then
+ usermod -g 29 radius
+ chown radius:radius /var/log/%{name}/*.log >/dev/null 2>&1 || :
+ chown radius:radius /var/log/%{name}/radacct/* >/dev/null 2>&1 || :
+ fi
+ fi
+fi
+if [ -n "`id -u radius 2>/dev/null`" ]; then
+ if [ "`id -u radius`" != "29" ]; then
+ echo "Error: user radius doesn't have uid=29. Correct this before installing radius server." 1>&2
+ exit 1
+ fi
+else
+ /usr/sbin/useradd -u 29 -d %{_localstatedir} -s /bin/false -M -r -c "%{name}" -g radius radius 1>&2
+fi
%post
-NAME=radiusd.init; %chkconfig_add
+/sbin/chkconfig --add %{name}
+if [ -f /var/lock/subsys/%{name} ]; then
+ /etc/rc.d/init.d/%{name} restart 1>&2
+else
+ echo "Run \"/etc/rc.d/init.d/%{name} start\" to start %{name} daemon."
+fi
%preun
-NAME=radiusd.init; %chkconfig_del
-
-%clean
-%{__rm} -rf $RPM_BUILD_ROOT
+if [ "$1" = "0" ]; then
+ if [ -f /var/lock/subsys/%{name} ]; then
+ /etc/rc.d/init.d/%{name} stop 1>&2
+ fi
+ /sbin/chkconfig --del %{name}
+fi
+
+%postun
+if [ "$1" = "0" ]; then
+ %userremove radius
+ %groupremove radius
+fi
%files
%defattr(644,root,root,755)
-%doc doc/ChangeLog doc/README* todo/ COPYRIGHT INSTALL
-%config /etc/pam.d/radius
-%config /etc/logrotate.d/radiusd
-%config /etc/rc.d/init.d/radiusd
-%config %{_sysconfdir}/raddb/*
-%{_prefix}/man/*
+%doc doc/*
+%doc src/modules/rlm_sql/drivers/*/*.sql
%attr(755,root,root) %{_bindir}/*
%attr(755,root,root) %{_sbindir}/*
-%{_libdir}/*
-%dir %{_localstatedir}/log/radacct/
-%config(missingok noreplace) %{_localstatedir}/log/checkrad.log
-%config(missingok noreplace) %{_localstatedir}/log/radwatch.log
-%config(missingok noreplace) %{_localstatedir}/log/radius.log
-%config(missingok noreplace) %{_localstatedir}/log/radwtmp
-%config(missingok noreplace) %{_localstatedir}/log/radutmp
+%attr(755,root,root) %{_libdir}/*.so
+%{_libdir}/*.la
+%dir %{_libdir}/%{name}
+%{_libdir}/%{name}/*.so
+%{_libdir}/%{name}/*.la
+%{_datadir}/freeradius
+
+%dir %{_sysconfdir}/raddb
+%config(noreplace) %verify(not md5 size mtime) %{_sysconfdir}/raddb/*
+
+%attr(771,root,radius) %dir %{_var}/log/%{name}
+%attr(771,root,radius) %dir %{_var}/log/%{name}/radacct
+%attr(775,root,radius) %dir /var/run/%{name}
+
+%attr(754,root,root) /etc/rc.d/init.d/%{name}
+%attr(640,root,root) %config(noreplace) %verify(not md5 size mtime) /etc/pam.d/*
+%attr(640,root,root) %config(noreplace) %verify(not size mtime md5) /etc/logrotate.d/*
+
+%{_mandir}/man?/*