backport from HEAD
[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: 1.0.2
5 Release: 1
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-threads \
33         --with-thread-pool \
34         --with-system-libtool \
35         --disable-ltdl-install \
36         --with-ltdl-lib=/usr/lib \
37         --with-ltdl-include=/usr/include \
38         --with-gnu-ld \
39         --with-rlm-sql_postgresql-include-dir=/usr/include/pgsql \
40         --with-rlm-krb5-include-dir=/usr/kerberos/include \
41         --with-rlm-krb5-lib-dir=/usr/kerberos/lib
42 make
43
44 %install
45 [ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT
46
47 mkdir -p $RPM_BUILD_ROOT/etc/{logrotate.d,pam.d,rc.d/init.d}
48
49 make install R=$RPM_BUILD_ROOT
50
51 RADDB=$RPM_BUILD_ROOT/etc/raddb
52 # set radiusd as default user/group
53 perl -i -pe 's/^#user =.*$/user = radiusd/' $RADDB/radiusd.conf
54 perl -i -pe 's/^#group =.*$/group = radiusd/' $RADDB/radiusd.conf
55 # shadow password file MUST be defined on Linux
56 perl -i -pe 's/#        shadow =/shadow =/' $RADDB/radiusd.conf
57
58 # remove unneeded stuff
59 rm -f $RPM_BUILD_ROOT%{_mandir}/man8/builddbm.8
60 rm -f $RPM_BUILD_ROOT%{_prefix}/sbin/rc.radiusd
61
62 cd redhat
63 install -m 755 rc.radiusd-redhat $RPM_BUILD_ROOT/etc/rc.d/init.d/radiusd
64 install -m 644 radiusd-logrotate $RPM_BUILD_ROOT/etc/logrotate.d/radiusd
65 install -m 644 radiusd-pam       $RPM_BUILD_ROOT/etc/pam.d/radius
66 cd ..
67
68 %pre
69 /usr/sbin/useradd -c "radiusd user" -r -s /bin/false -u 95 -d / radiusd 2>/dev/null || :
70
71 %preun
72 if [ "$1" = "0" ]; then
73         /sbin/service radiusd stop > /dev/null 2>&1
74         /sbin/chkconfig --del radiusd
75 fi
76
77 %post
78 /sbin/ldconfig
79 /sbin/chkconfig --add radiusd
80
81 # Done here to avoid messing up existing installations
82 for i in radius/radutmp radius/radwtmp radius/radius.log # radius/radwatch.log radius/checkrad.log
83 do
84         touch /var/log/$i
85         chown radiusd:radiusd /var/log/$i
86         chmod 600 /var/log/$i
87 done
88
89 %postun
90 if [ "$1" -ge "1" ]; then
91         /sbin/service radiusd condrestart >/dev/null 2>&1
92 fi
93 if [ $1 = 0 ]; then
94         /usr/sbin/userdel radiusd > /dev/null 2>&1 || :
95 fi
96 /sbin/ldconfig
97
98 %clean
99 [ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT
100
101 %files
102 %defattr(-,root,root)
103 %doc doc/ChangeLog doc/README* todo/ COPYRIGHT INSTALL
104 %config /etc/pam.d/radius
105 %config /etc/logrotate.d/radiusd
106 %config /etc/rc.d/init.d/radiusd
107 %config (noreplace) /etc/raddb/*
108 %{_bindir}/*
109 %{_datadir}/%{name}
110 %{_libdir}/*
111 %{_mandir}/*/*
112 %{_sbindir}/*
113 %attr(0700,radiusd,radiusd) %dir /var/log/radius
114 %attr(0700,radiusd,radiusd) %dir /var/log/radius/radacct
115 %attr(0700,radiusd,radiusd) %dir /var/run/radiusd
116
117 %changelog
118 * Mon May 31 2004 Paul Hampson
119 - update for 1.0.0 release
120
121 * Fri May 23 2003 Marko Myllynen
122 - update for 0.9
123
124 * Wed Sep  4 2002 Marko Myllynen
125 - fix libtool issues for good
126
127 * Thu Aug 22 2002 Marko Myllynen
128 - update for 0.7/0.8
129
130 * Tue Jun 18 2002 Marko Myllynen
131 - run as radiusd user instead of root
132 - added some options for configure
133
134 * Thu Jun  6 2002 Marko Myllynen
135 - set noreplace for non-dictionary files in /etc/raddb
136
137 * Sun May 26 2002 Frank Cusack <frank@google.com>
138 - move /var dirs from %%post to %%files
139
140 * Thu Feb 14 2002 Marko Myllynen
141 - use dir name macros in all configure options
142 - libtool is required only when building the package
143 - misc clean ups
144
145 * Wed Feb 13 2002 Marko Myllynen
146 - use %%{_mandir} instead of /usr/man
147 - rename %%postin as %%post
148 - clean up name/version
149
150 * Fri Jan 18 2002 Frank Cusack <frank@google.com>
151 - remove (noreplace) for /etc/raddb/* (due to rpm bugs)
152
153 * Fri Sep 07 2001 Ivan F. Martinez <ivanfm@ecodigit.com.br>
154 - changes to make compatible with default config file shipped
155 - adjusts log files are on /var/log/radius instead of /var/log
156 - /etc/raddb changed to config(noreplace) to don't override
157 -   user configs
158
159 * Fri Sep 22 2000 Bruno Lopes F. Cabral <bruno@openline.com.br>
160 - spec file clear accordling to the libltdl fix and minor updates
161
162 * Wed Sep 12 2000 Bruno Lopes F. Cabral <bruno@openline.com.br>
163 - Updated to snapshot-12-Sep-00
164
165 * Fri Jun 16 2000 Bruno Lopes F. Cabral <bruno@openline.com.br>
166 - Initial release