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