d102f2512990209b88e916c59d688659394880a8
[freeradius.git] / redhat / freeradius.spec
1 Summary: High-performance and highly configurable RADIUS server
2 URL: http://www.freeradius.org/
3 Name: freeradius
4 Version: 2.0.0
5 Release: 0
6 License: GPL
7 Group: Networking/Daemons
8 Packager: FreeRADIUS.org
9 Source0: %{name}-%{version}.tar.gz
10 Prereq: /sbin/chkconfig
11 BuildPreReq: libtool
12 # FIXME: snmpwalk, snmpget and rusers POSSIBLY needed by checkrad
13 Provides: radiusd
14 Conflicts: cistron-radius
15 BuildRoot: %{_tmppath}/%{name}-root
16
17 %description
18 The FreeRADIUS Server Project is a high-performance and highly
19 configurable GPL'd RADIUS server. It is somewhat similar to the
20 Livingston 2.0 RADIUS server, but has many more features, and is much
21 more configurable.
22
23 %prep
24 %setup
25
26 %build
27 CFLAGS="$RPM_OPT_FLAGS" \
28 %configure --prefix=%{_prefix} \
29         --localstatedir=%{_localstatedir} \
30         --sysconfdir=%{_sysconfdir} \
31         --mandir=%{_mandir} \
32         --with-docdir=%{_datadir}/doc/%{name}-%{version} \
33         --with-system-libtool \
34         --disable-ltdl-install \
35         --with-ltdl-lib=/usr/lib \
36         --with-ltdl-include=/usr/include \
37         --with-large-files --with-udpfromto --with-edir \
38         --with-rlm-sql_postgresql-include-dir=/usr/include/pgsql \
39         --with-rlm-krb5-include-dir=/usr/kerberos/include \
40         --with-rlm-krb5-lib-dir=/usr/kerberos/lib
41 make
42
43 %install
44 [ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT
45
46 mkdir -p $RPM_BUILD_ROOT/etc/{logrotate.d,pam.d,rc.d/init.d}
47
48 make install R=$RPM_BUILD_ROOT
49
50 RADDB=$RPM_BUILD_ROOT/etc/raddb
51 # set radiusd as default user/group
52 perl -i -pe 's/^#user =.*$/user = radiusd/' $RADDB/radiusd.conf
53 perl -i -pe 's/^#group =.*$/group = radiusd/' $RADDB/radiusd.conf
54 # shadow password file MUST be defined on Linux
55 perl -i -pe 's/#        shadow =/shadow =/' $RADDB/radiusd.conf
56
57 # remove unneeded stuff
58 rm -f $RPM_BUILD_ROOT%{_mandir}/man8/builddbm.8
59 rm -f $RPM_BUILD_ROOT%{_prefix}/sbin/rc.radiusd
60
61 # more files go to /usr/share/doc/freeradius-%{version}
62 install -m 0644 CREDITS $RPM_BUILD_ROOT%{_datadir}/doc/%{name}-%{version}
63 install -m 0644 COPYRIGHT $RPM_BUILD_ROOT%{_datadir}/doc/%{name}-%{version}
64 install -m 0644 LICENSE $RPM_BUILD_ROOT%{_datadir}/doc/%{name}-%{version}
65
66 cd redhat
67 install -m 755 rc.radiusd-redhat $RPM_BUILD_ROOT/etc/rc.d/init.d/radiusd
68 install -m 644 radiusd-logrotate $RPM_BUILD_ROOT/etc/logrotate.d/radiusd
69 install -m 644 radiusd-pam       $RPM_BUILD_ROOT/etc/pam.d/radius
70 cd ..
71
72 %pre
73 /usr/sbin/useradd -c "radiusd user" -r -s /bin/false -u 95 -d / radiusd 2>/dev/null || :
74
75 %preun
76 if [ "$1" = "0" ]; then
77         /sbin/service radiusd stop > /dev/null 2>&1
78         /sbin/chkconfig --del radiusd
79 fi
80
81 %post
82 /sbin/ldconfig
83 /sbin/chkconfig --add radiusd
84
85 # Done here to avoid messing up existing installations
86 for i in radius/radutmp radius/radwtmp radius/radius.log # radius/radwatch.log radius/checkrad.log
87 do
88         touch /var/log/$i
89         chown radiusd:radiusd /var/log/$i
90         chmod 600 /var/log/$i
91 done
92
93 %postun
94 if [ "$1" -ge "1" ]; then
95         /sbin/service radiusd condrestart >/dev/null 2>&1
96 fi
97 if [ $1 = 0 ]; then
98         /usr/sbin/userdel radiusd > /dev/null 2>&1 || :
99 fi
100 /sbin/ldconfig
101
102 %clean
103 [ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT
104
105 %files
106 %defattr(-,root,root)
107 %config /etc/pam.d/radius
108 %config /etc/logrotate.d/radiusd
109 %config /etc/rc.d/init.d/radiusd
110 %config (noreplace) /etc/raddb/*
111 %doc %{_datadir}/doc/%{name}-%{version}
112 %{_bindir}/*
113 %{_datadir}/%{name}
114 %{_libdir}/*
115 %{_mandir}/*/*
116 %{_sbindir}/*
117 %{_incdir}/freeradius/*
118 %attr(0700,radiusd,radiusd) %dir /var/log/radius
119 %attr(0700,radiusd,radiusd) %dir /var/log/radius/radacct
120 %attr(0700,radiusd,radiusd) %dir /var/run/radiusd
121
122 %changelog
123 * Thu Dec 15 2004 Alan DeKok
124 - update for 1.1.0
125
126 * Mon May 31 2004 Paul Hampson
127 - update for 1.0.0 release
128
129 * Fri May 23 2003 Marko Myllynen
130 - update for 0.9
131
132 * Wed Sep  4 2002 Marko Myllynen
133 - fix libtool issues for good
134
135 * Thu Aug 22 2002 Marko Myllynen
136 - update for 0.7/0.8
137
138 * Tue Jun 18 2002 Marko Myllynen
139 - run as radiusd user instead of root
140 - added some options for configure
141
142 * Thu Jun  6 2002 Marko Myllynen
143 - set noreplace for non-dictionary files in /etc/raddb
144
145 * Sun May 26 2002 Frank Cusack <frank@google.com>
146 - move /var dirs from %%post to %%files
147
148 * Thu Feb 14 2002 Marko Myllynen
149 - use dir name macros in all configure options
150 - libtool is required only when building the package
151 - misc clean ups
152
153 * Wed Feb 13 2002 Marko Myllynen
154 - use %%{_mandir} instead of /usr/man
155 - rename %%postin as %%post
156 - clean up name/version
157
158 * Fri Jan 18 2002 Frank Cusack <frank@google.com>
159 - remove (noreplace) for /etc/raddb/* (due to rpm bugs)
160
161 * Fri Sep 07 2001 Ivan F. Martinez <ivanfm@ecodigit.com.br>
162 - changes to make compatible with default config file shipped
163 - adjusts log files are on /var/log/radius instead of /var/log
164 - /etc/raddb changed to config(noreplace) to don't override
165 -   user configs
166
167 * Fri Sep 22 2000 Bruno Lopes F. Cabral <bruno@openline.com.br>
168 - spec file clear accordling to the libltdl fix and minor updates
169
170 * Wed Sep 12 2000 Bruno Lopes F. Cabral <bruno@openline.com.br>
171 - Updated to snapshot-12-Sep-00
172
173 * Fri Jun 16 2000 Bruno Lopes F. Cabral <bruno@openline.com.br>
174 - Initial release