Source2: %{name}.init
Source3: %{name}.pam
URL: http://www.freeradius.org/
-Requires(post,preun): /sbin/chkconfig
-Requires(pre): user-radius
+Prereq: /sbin/chkconfig
Requires: libtool
BuildRequires: gdbm-devel
BuildRequires: libltdl-devel
%clean
rm -rf $RPM_BUILD_ROOT
+%pre
+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 nobody radius 1>&2
+fi
+
%post
/sbin/chkconfig --add %{name}
if [ -f /var/lock/subsys/%{name} ]; then
/sbin/chkconfig --del %{name}
fi
+%postun
+if [ "$1" = "0" ]; then
+ /usr/sbin/userdel %{name}
+fi
+
%files
%defattr(644,root,root,755)
%doc doc/*