d9f63f49582d6ec30afc5b1956b99e27cf4250da
[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.1.0
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 * Thurs Dec 15 2004 Alan DeKok
119 - update for 1.1.0
120
121 * Mon May 31 2004 Paul Hampson
122 - update for 1.0.0 release
123
124 * Fri May 23 2003 Marko Myllynen
125 - update for 0.9
126
127 * Wed Sep  4 2002 Marko Myllynen
128 - fix libtool issues for good
129
130 * Thu Aug 22 2002 Marko Myllynen
131 - update for 0.7/0.8
132
133 * Tue Jun 18 2002 Marko Myllynen
134 - run as radiusd user instead of root
135 - added some options for configure
136
137 * Thu Jun  6 2002 Marko Myllynen
138 - set noreplace for non-dictionary files in /etc/raddb
139
140 * Sun May 26 2002 Frank Cusack <frank@google.com>
141 - move /var dirs from %%post to %%files
142
143 * Thu Feb 14 2002 Marko Myllynen
144 - use dir name macros in all configure options
145 - libtool is required only when building the package
146 - misc clean ups
147
148 * Wed Feb 13 2002 Marko Myllynen
149 - use %%{_mandir} instead of /usr/man
150 - rename %%postin as %%post
151 - clean up name/version
152
153 * Fri Jan 18 2002 Frank Cusack <frank@google.com>
154 - remove (noreplace) for /etc/raddb/* (due to rpm bugs)
155
156 * Fri Sep 07 2001 Ivan F. Martinez <ivanfm@ecodigit.com.br>
157 - changes to make compatible with default config file shipped
158 - adjusts log files are on /var/log/radius instead of /var/log
159 - /etc/raddb changed to config(noreplace) to don't override
160 -   user configs
161
162 * Fri Sep 22 2000 Bruno Lopes F. Cabral <bruno@openline.com.br>
163 - spec file clear accordling to the libltdl fix and minor updates
164
165 * Wed Sep 12 2000 Bruno Lopes F. Cabral <bruno@openline.com.br>
166 - Updated to snapshot-12-Sep-00
167
168 * Fri Jun 16 2000 Bruno Lopes F. Cabral <bruno@openline.com.br>
169 - Initial release