freeradius/freeradius.spec

Fri, 03 Aug 2012 20:11:53 +0200

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Fri, 03 Aug 2012 20:11:53 +0200
changeset 470
f8813e60f168
parent 306
cc6a45887422
child 546
7894123eadbf
permissions
-rw-r--r--

Neutralize buggy code causing OpenPKG to have 'fatal problems' in
spite of correct installation, configuration, and operation. An
administrator suffering from this failure is even unable to
uninstall the flawed software.

michael@47 1 ##
michael@47 2 ## freeradius.spec -- OpenPKG RPM Package Specification
michael@306 3 ## Copyright (c) 2000-2010 OpenPKG Foundation e.V. <http://openpkg.net/>
michael@47 4 ##
michael@47 5 ## Permission to use, copy, modify, and distribute this software for
michael@47 6 ## any purpose with or without fee is hereby granted, provided that
michael@47 7 ## the above copyright notice and this permission notice appear in all
michael@47 8 ## copies.
michael@47 9 ##
michael@47 10 ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
michael@47 11 ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
michael@47 12 ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
michael@47 13 ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
michael@47 14 ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
michael@47 15 ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
michael@47 16 ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
michael@47 17 ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
michael@47 18 ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
michael@47 19 ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
michael@47 20 ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
michael@47 21 ## SUCH DAMAGE.
michael@47 22 ##
michael@47 23
michael@47 24 # package information
michael@47 25 Name: freeradius
michael@47 26 Summary: FreeRADIUS Server
michael@47 27 URL: http://www.freeradius.org/
michael@47 28 Vendor: The FreeRADIUS Server Project
michael@47 29 Packager: OpenPKG Foundation e.V.
michael@47 30 Distribution: OpenPKG Community
michael@47 31 Class: EVAL
michael@47 32 Group: RADIUS
michael@47 33 License: GPL
michael@306 34 Version: 2.1.10
michael@307 35 Release: 20100930
michael@47 36
michael@47 37 # package options
michael@47 38 %option with_mysql no
michael@47 39 %option with_openldap no
michael@47 40 %option with_pgsql no
michael@47 41 %option with_snmp no
michael@47 42
michael@47 43 # list of sources
michael@47 44 Source0: ftp://ftp.freeradius.org/pub/freeradius/freeradius-server-%{version}.tar.gz
michael@47 45 Source1: rc.freeradius
michael@47 46 Patch0: freeradius.patch
michael@47 47
michael@47 48 # build information
michael@307 49 Prefix: %{l_prefix}
michael@307 50 BuildRoot: %{l_buildroot}
michael@307 51 BuildPreReq: OpenPKG, openpkg >= 20060823, make, gcc, libtool
michael@307 52 PreReq: OpenPKG, openpkg >= 20060823
michael@47 53 BuildPreReq: perl, openssl, gdbm, readline
michael@47 54 PreReq: perl, openssl, gdbm, readline
michael@47 55 %if "%{with_mysql}" == "yes"
michael@47 56 BuildPreReq: mysql, zlib
michael@47 57 PreReq: mysql, zlib
michael@47 58 %endif
michael@47 59 %if "%{with_openldap}" == "yes"
michael@47 60 BuildPreReq: openldap
michael@47 61 PreReq: openldap
michael@47 62 %endif
michael@47 63 %if "%{with_pgsql}" == "yes"
michael@47 64 BuildPreReq: postgresql
michael@47 65 PreReq: postgresql
michael@47 66 %endif
michael@47 67 %if "%{with_snmp}" == "yes"
michael@47 68 BuildPreReq: snmp
michael@47 69 PreReq: snmp
michael@47 70 %endif
michael@307 71 AutoReq: no
michael@307 72 AutoReqProv: no
michael@47 73
michael@47 74 %description
michael@47 75 FreeRADIUS is one of the most modular and featureful RADIUS servers
michael@47 76 available today. It has been written by a team of developers who
michael@47 77 have more than a decade of collective experience in implementing
michael@47 78 and deploying RADIUS software, in software engineering, and in Unix
michael@47 79 package management.
michael@47 80
michael@47 81 %track
michael@47 82 prog freeradius = {
michael@47 83 version = %{version}
michael@47 84 url = ftp://ftp.freeradius.org/pub/freeradius/
michael@47 85 regex = freeradius-server-(\d+\.\d+(\.\d+)*)\.tar\.gz
michael@47 86 }
michael@47 87
michael@47 88 %prep
michael@47 89 %setup -q -n freeradius-server-%{version}
michael@47 90 %patch -p0
michael@307 91 %{l_shtool} subst \
michael@307 92 -e 's; */usr/\(include/postgresql\);%{l_prefix}/\1;g' \
michael@307 93 -e 's; */usr/local/pgsql/include;;g' \
michael@307 94 -e 's; */usr/include/pgsql;;g' \
michael@307 95 src/modules/rlm_sql/drivers/rlm_sql_postgresql/configure
michael@307 96 extlib=''
michael@307 97 case "%{l_platform -t}" in
michael@307 98 *-sunos* )
michael@307 99 extlib='-lsocket -lnsl'
michael@307 100 ;;
michael@307 101 esac
michael@47 102 %if "%{with_openldap}" == "yes"
michael@47 103 %{l_shtool} subst \
michael@307 104 -e "s;\(LIBS *=.* *-lldap[_r]*\);\1 -llber -lssl -lcrypto $extlib;g" \
michael@307 105 -e "s;\(smart_lib *=.* *-lldap[_r]*\);\1 -llber -lssl -lcrypto $extlib;g" \
michael@47 106 src/modules/rlm_ldap/configure
michael@47 107 %endif
michael@307 108 %if "%{with_pgsql}" == "yes"
michael@307 109 %{l_shtool} subst \
michael@307 110 -e "s;-lpq;-lpq `%{l_prefix}/bin/pg_config --libs` $extlib;g" \
michael@307 111 src/modules/rlm_sql/drivers/rlm_sql_postgresql/configure
michael@307 112 %endif
michael@47 113
michael@47 114 %build
michael@47 115 # configure package
michael@47 116 CC="%{l_cc}" \
michael@47 117 CFLAGS="-I`pwd`/src/include %{l_cflags -O} %{l_cppflags}" \
michael@47 118 CPPFLAGS="%{l_cppflags}" \
michael@47 119 LDFLAGS="%{l_ldflags}" \
michael@47 120 %if "%{with_openldap}" == "yes"
michael@47 121 LIBS="-llber -lssl -lcrypto -lreadline" \
michael@47 122 %endif
michael@47 123 ./configure \
michael@47 124 --prefix=%{l_prefix} \
michael@47 125 --libdir=%{l_prefix}/lib/freeradius \
michael@47 126 --mandir=%{l_prefix}/man \
michael@47 127 --localstatedir=%{l_prefix}/var/freeradius \
michael@47 128 --datadir=%{l_prefix}/share/freeradius \
michael@47 129 --sysconfdir=%{l_prefix}/etc \
michael@47 130 --with-system-libtool \
michael@47 131 --disable-shared \
michael@47 132 --enable-static \
michael@47 133 --with-logdir=%{l_prefix}/var/freeradius \
michael@47 134 --with-radacctdir=%{l_prefix}/var/freeradius \
michael@47 135 --with-raddbdir=%{l_prefix}/etc/freeradius \
michael@306 136 --with-threads \
michael@47 137 --with-openssl-includes=%{l_prefix}/include/openssl \
michael@47 138 --with-openssl-libraries=%{l_prefix}/lib/ \
michael@47 139 --with-rlm_perl \
michael@47 140 %if "%{with_mysql}" == "yes" || "%{with_pgsql}" == "yes"
michael@47 141 --with-rlm_sql \
michael@47 142 --with-rlm_sqlippool \
michael@47 143 %else
michael@47 144 --without-rlm_sql \
michael@47 145 --without-rlm_sqlippool \
michael@47 146 %endif
michael@47 147 %if "%{with_mysql}" == "yes"
michael@47 148 --with-rlm_sql_mysql \
michael@47 149 %else
michael@47 150 --without-rlm_sql_mysql \
michael@47 151 %endif
michael@47 152 %if "%{with_pgsql}" == "yes"
michael@47 153 --with-rlm_sql_postgresql \
michael@47 154 %else
michael@47 155 --without-rlm_sql_postgresql \
michael@47 156 %endif
michael@47 157 --without-rlm_sql_db2 \
michael@47 158 --without-rlm_sql_firebird \
michael@47 159 --without-rlm_sql_freetds \
michael@47 160 --without-rlm_sql_iodbc \
michael@47 161 --without-rlm_sql_oracle \
michael@47 162 --without-rlm_sql_sybase \
michael@47 163 --without-rlm_sql_unixodbc \
michael@47 164 %if "%{with_openldap}" == "yes"
michael@47 165 --with-rlm-ldap-include-dir=%{l_prefix}/include/ \
michael@47 166 --with-rlm-ldap-lib-dir=%{l_prefix}/lib/ \
michael@47 167 %else
michael@47 168 --without-rlm-ldap \
michael@47 169 %endif
michael@47 170 --without-rlm_eap_ikev2 \
michael@47 171 --without-rlm_eap_sim \
michael@47 172 --without-rlm_eap_tls \
michael@47 173 --without-rlm_eap_peap \
michael@47 174 --without-rlm_eap_ttls \
michael@47 175 --without-rlm_eap_tnc \
michael@47 176 --without-rlm_krb5 \
michael@47 177 --without-rlm_dbm \
michael@47 178 --without-rlm_otp \
michael@47 179 --without-rlm_pam \
michael@47 180 --without-rlm_python \
michael@47 181 %if "%{with_snmp}" == "yes"
michael@47 182 --with-snmp \
michael@47 183 %else
michael@47 184 --without-snmp \
michael@47 185 %endif
michael@47 186 --enable-strict-dependencies \
michael@47 187 --with-ltdl-lib=%{l_prefix}/lib \
michael@47 188 --with-ltdl-include=%{l_prefix}/include \
michael@47 189 --disable-ltdl-install
michael@47 190
michael@47 191 # build package
michael@47 192 %{l_make} %{l_mflags}
michael@47 193
michael@47 194 %install
michael@47 195 # install package
michael@307 196 rm -rf $RPM_BUILD_ROOT
michael@47 197 %{l_shtool} mkdir -f -p -m 755 \
michael@47 198 $RPM_BUILD_ROOT%{l_prefix}/lib/freeradius
michael@47 199 %{l_make} %{l_mflags} install \
michael@47 200 R=$RPM_BUILD_ROOT
michael@47 201
michael@47 202 # strip down installation
michael@47 203 strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
michael@47 204 rm -rf $RPM_BUILD_ROOT%{l_prefix}/etc/freeradius/certs
michael@47 205 rm -f $RPM_BUILD_ROOT%{l_prefix}/etc/freeradius/*.sample
michael@47 206 rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/freeradius/doc
michael@47 207 rm -f $RPM_BUILD_ROOT%{l_prefix}/sbin/rc.radiusd
michael@47 208 rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/freeradius/*%{version}*
michael@47 209 rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/freeradius/rlm_*
michael@47 210
michael@47 211 # adjust default configuration
michael@47 212 %{l_shtool} subst \
michael@47 213 -e 's;^#user = nobody;user = %{l_rusr};' \
michael@47 214 -e 's;^#group = nobody;group = %{l_rgrp};' \
michael@47 215 $RPM_BUILD_ROOT%{l_prefix}/etc/freeradius/radiusd.conf
michael@47 216
michael@47 217 # install run-command script
michael@47 218 %{l_shtool} mkdir -f -p -m 755 \
michael@47 219 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
michael@47 220 %{l_shtool} install -c -m 755 %{l_value -s -a} \
michael@47 221 %{SOURCE rc.freeradius} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
michael@47 222
michael@47 223 # determine installation files
michael@47 224 %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
michael@47 225 %{l_files_std} \
michael@47 226 '%config %{l_prefix}/etc/freeradius/*' \
michael@47 227 '%attr(755,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/freeradius'
michael@47 228
michael@47 229 %files -f files
michael@47 230
michael@47 231 %clean
michael@307 232 rm -rf $RPM_BUILD_ROOT
michael@47 233

mercurial