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