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.

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

mercurial