c33c596e52fd58fb75c881bf51684078bf1b1475
[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: 0.9
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 Conflicts: cistron-radius
14 BuildRoot: %{_tmppath}/%{name}-root
15
16 %description
17 The FreeRADIUS Server Project is a high-performance and highly
18 configurable GPL'd RADIUS server. It is somewhat similar to the
19 Livingston 2.0 RADIUS server, but has many more features, and is much
20 more configurable.
21
22 %prep 
23 %setup
24
25 %build
26 CFLAGS="$RPM_OPT_FLAGS" \
27 %configure --prefix=%{_prefix} \
28         --localstatedir=%{_localstatedir} \
29         --sysconfdir=%{_sysconfdir} \
30         --mandir=%{_mandir} \
31         --with-threads \
32         --with-thread-pool \
33         --with-system-libtool \
34         --disable-ltdl-install \
35         --with-ltdl-lib=/usr/lib \
36         --with-ltdl-include=/usr/include \
37         --with-gnu-ld \
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 cd redhat
62 install -m 755 rc.radiusd-redhat $RPM_BUILD_ROOT/etc/rc.d/init.d/radiusd
63 install -m 644 radiusd-logrotate $RPM_BUILD_ROOT/etc/logrotate.d/radiusd
64 install -m 644 radiusd-pam       $RPM_BUILD_ROOT/etc/pam.d/radius
65 cd ..
66
67 %pre
68 /usr/sbin/useradd -c "radiusd user" -r -s /bin/false -u 95 -d / radiusd 2>/dev/null || :
69
70 %preun
71 if [ "$1" = "0" ]; then
72         /sbin/service radiusd stop > /dev/null 2>&1
73         /sbin/chkconfig --del radiusd
74 fi
75
76 %post
77 /sbin/ldconfig
78 /sbin/chkconfig --add radiusd
79
80 # Done here to avoid messing up existing installations
81 for i in radius/radutmp radius/radwtmp radius/radius.log # radius/radwatch.log radius/checkrad.log
82 do
83         touch /var/log/$i
84         chown radiusd:radiusd /var/log/$i
85         chmod 600 /var/log/$i
86 done
87
88 %postun
89 if [ "$1" -ge "1" ]; then
90         /sbin/service radiusd condrestart >/dev/null 2>&1
91 fi
92 if [ $1 = 0 ]; then
93         /usr/sbin/userdel radiusd > /dev/null 2>&1 || :
94 fi
95 /sbin/ldconfig
96
97 %clean
98 [ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT
99
100 %files
101 %defattr(-,root,root)
102 %doc doc/ChangeLog doc/README* todo/ COPYRIGHT INSTALL
103 %config /etc/pam.d/radius
104 %config /etc/logrotate.d/radiusd
105 %config /etc/rc.d/init.d/radiusd
106 %config (noreplace) /etc/raddb/*
107 %{_bindir}/*
108 %{_datadir}/%{name}
109 %{_libdir}/*
110 %{_mandir}/*/*
111 %{_sbindir}/*
112 %attr(0700,radiusd,radiusd) %dir /var/log/radius
113 %attr(0700,radiusd,radiusd) %dir /var/log/radius/radacct
114 %attr(0700,radiusd,radiusd) %dir /var/run/radiusd
115
116 %changelog
117 * Fri May 23 2003 Marko Myllynen
118 - update for 0.9
119
120 * Wed Sep  4 2002 Marko Myllynen
121 - fix libtool issues for good
122
123 * Thu Aug 22 2002 Marko Myllynen
124 - update for 0.7/0.8
125
126 * Tue Jun 18 2002 Marko Myllynen
127 - run as radiusd user instead of root
128 - added some options for configure
129
130 * Thu Jun  6 2002 Marko Myllynen
131 - set noreplace for non-dictionary files in /etc/raddb
132
133 * Sun May 26 2002 Frank Cusack <frank@google.com>
134 - move /var dirs from %%post to %%files
135
136 * Thu Feb 14 2002 Marko Myllynen
137 - use dir name macros in all configure options
138 - libtool is required only when building the package
139 - misc clean ups
140
141 * Wed Feb 13 2002 Marko Myllynen
142 - use %%{_mandir} instead of /usr/man
143 - rename %%postin as %%post
144 - clean up name/version
145
146 * Fri Jan 18 2002 Frank Cusack <frank@google.com>
147 - remove (noreplace) for /etc/raddb/* (due to rpm bugs)
148
149 * Fri Sep 07 2001 Ivan F. Martinez <ivanfm@ecodigit.com.br>
150 - changes to make compatible with default config file shipped
151 - adjusts log files are on /var/log/radius instead of /var/log
152 - /etc/raddb changed to config(noreplace) to don't override
153 -   user configs
154
155 * Fri Sep 22 2000 Bruno Lopes F. Cabral <bruno@openline.com.br>
156 - spec file clear accordling to the libltdl fix and minor updates
157
158 * Wed Sep 12 2000 Bruno Lopes F. Cabral <bruno@openline.com.br>
159 - Updated to snapshot-12-Sep-00
160
161 * Fri Jun 16 2000 Bruno Lopes F. Cabral <bruno@openline.com.br>
162 - Initial release