Complete packaging logic and include fscanf(3) proxy to correct runtime.

Tue, 06 Jan 2009 23:48:04 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 06 Jan 2009 23:48:04 +0100
changeset 18
9115bae56135
parent 17
dabc4f22486f
child 19
c6c9e9bf76fd

Complete packaging logic and include fscanf(3) proxy to correct runtime.

radiusclient/fsl.radiusclient file | annotate | diff | comparison | revisions
radiusclient/radiusclient.patch file | annotate | diff | comparison | revisions
radiusclient/radiusclient.patch.libc file | annotate | diff | comparison | revisions
radiusclient/radiusclient.spec file | annotate | diff | comparison | revisions
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/radiusclient/fsl.radiusclient	Tue Jan 06 23:48:04 2009 +0100
     1.3 @@ -0,0 +1,52 @@
     1.4 +##
     1.5 +##  fsl.arpwatch -- OSSP fsl configuration
     1.6 +##
     1.7 +
     1.8 +ident (radexample)/.+ q{
     1.9 +    prefix(
    1.10 +        prefix="%b %d %H:%M:%S %N <%L> $1[%P]: "
    1.11 +    )
    1.12 +    -> {
    1.13 +        debug: file(
    1.14 +            path="@l_prefix@/var/radiusclient/radexample.log",
    1.15 +            perm=0644
    1.16 +        )
    1.17 +    }
    1.18 +};
    1.19 +
    1.20 +ident (radlogin)/.+ q{
    1.21 +    prefix(
    1.22 +        prefix="%b %d %H:%M:%S %N <%L> $1[%P]: "
    1.23 +    )
    1.24 +    -> {
    1.25 +        debug: file(
    1.26 +            path="@l_prefix@/var/radiusclient/radlogin.log",
    1.27 +            perm=0644
    1.28 +        )
    1.29 +    }
    1.30 +};
    1.31 +
    1.32 +ident (radstatus)/.+ q{
    1.33 +    prefix(
    1.34 +        prefix="%b %d %H:%M:%S %N <%L> $1[%P]: "
    1.35 +    )
    1.36 +    -> {
    1.37 +        debug: file(
    1.38 +            path="@l_prefix@/var/radiusclient/radstatus.log",
    1.39 +            perm=0644
    1.40 +        )
    1.41 +    }
    1.42 +};
    1.43 +
    1.44 +ident (radacct)/.+ q{
    1.45 +    prefix(
    1.46 +        prefix="%b %d %H:%M:%S %N <%L> $1[%P]: "
    1.47 +    )
    1.48 +    -> {
    1.49 +        debug: file(
    1.50 +            path="@l_prefix@/var/radiusclient/radacct.log",
    1.51 +            perm=0644
    1.52 +        )
    1.53 +    }
    1.54 +};
    1.55 +
     2.1 --- a/radiusclient/radiusclient.patch	Tue Jan 06 23:46:19 2009 +0100
     2.2 +++ b/radiusclient/radiusclient.patch	Tue Jan 06 23:48:04 2009 +0100
     2.3 @@ -73,3 +73,26 @@
     2.4   CLEANFILES = *~
     2.5   noinst_HEADERS = radlogin.h
     2.6   radlogin_SOURCES = radlogin.c radius.c local.c
     2.7 +Index: etc/Makefile.in
     2.8 +--- etc/Makefile.in.orig	2008-02-24 01:04:31.031421286 +0100
     2.9 ++++ etc/Makefile.in	2008-02-24 01:04:38.951886176 +0100
    2.10 +@@ -382,6 +382,7 @@
    2.11 + radiusclient.conf: radiusclient.conf.in
    2.12 + 	sed -e 's|@sbin''dir@|$(sbindir)|g' \
    2.13 + 	    -e 's|@pkgsysconf''dir@|$(pkgsysconfdir)|g' \
    2.14 ++	    -e 's|@localstate''dir@|$(localstatedir)/radiusclient|g' \
    2.15 + 	    <$(srcdir)/radiusclient.conf.in >radiusclient.conf
    2.16 + 
    2.17 + install-data-local: servers
    2.18 +Index: etc/radiusclient.conf.in
    2.19 +--- etc/radiusclient.conf.in.orig	2008-02-24 00:54:01.643791239 +0100
    2.20 ++++ etc/radiusclient.conf.in	2008-02-24 00:55:07.378684108 +0100
    2.21 +@@ -54,7 +54,7 @@
    2.22 + 
    2.23 + # file which holds sequence number for communication with the
    2.24 + # RADIUS server
    2.25 +-seqfile		/var/run/radius.seq
    2.26 ++seqfile		@localstatedir@/radius.seq
    2.27 + 
    2.28 + # file which specifies mapping between ttyname and NAS-Port attribute
    2.29 + mapfile		@pkgsysconfdir@/port-id-map
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/radiusclient/radiusclient.patch.libc	Tue Jan 06 23:48:04 2009 +0100
     3.3 @@ -0,0 +1,20 @@
     3.4 +Index: lib/buildreq.c
     3.5 +--- lib/buildreq.c.orig	2005-07-21 01:01:07.000000000 -0700
     3.6 ++++ lib/buildreq.c	2008-02-23 16:33:08.000000000 -0800
     3.7 +@@ -89,10 +89,14 @@
     3.8 + 	}
     3.9 + 
    3.10 + 	rewind(sf);
    3.11 +-	if (fscanf(sf, "%d", &seq_nbr) != 1) {
    3.12 ++	/* comment the following block out to work around some broken */
    3.13 ++	/* libc distros which return 0 on successful fscanf(3) calls, */
    3.14 ++	/* and use the simple replacement follwing the block instead. */
    3.15 ++	/*if (fscanf(sf, "%d", &seq_nbr) != 1) {
    3.16 + 		rc_log(LOG_ERR,"rc_get_seqnbr: fscanf failure: %s", seqfile);
    3.17 + 		seq_nbr = rc_guess_seqnbr();
    3.18 +-	}
    3.19 ++	}*/
    3.20 ++	fscanf(sf, "%d", &seq_nbr);
    3.21 + 
    3.22 + 	rewind(sf);
    3.23 + 	ftruncate(fileno(sf),0);
     4.1 --- a/radiusclient/radiusclient.spec	Tue Jan 06 23:46:19 2009 +0100
     4.2 +++ b/radiusclient/radiusclient.spec	Tue Jan 06 23:48:04 2009 +0100
     4.3 @@ -32,17 +32,28 @@
     4.4  Group:        RADIUS
     4.5  License:      BSD-style
     4.6  Version:      0.5.6
     4.7 -Release:      20080317
     4.8 +Release:      20080620
     4.9 +
    4.10 +#   package options
    4.11 +%option       with_fsl         yes
    4.12 +%option       with_brokenlibc  no
    4.13 +
    4.14  
    4.15  #   list of sources
    4.16 -Source0:      http://download.berlios.de/radiusclient-ng/radiusclient-ng-%{version}.tar.gz
    4.17 +Source0:      ftp://ftp.iptel.org/pub/radiusclient-ng/radiusclient-ng-%{version}.tar.gz
    4.18 +Source2:      fsl.radiusclient
    4.19  Patch0:       radiusclient.patch
    4.20 +Patch1:       radiusclient.patch.libc
    4.21  
    4.22  #   build information
    4.23  Prefix:       %{l_prefix}
    4.24  BuildRoot:    %{l_buildroot}
    4.25  BuildPreReq:  OpenPKG, openpkg >= 20060823
    4.26  PreReq:       OpenPKG, openpkg >= 20060823
    4.27 +%if "%{with_fsl}" == "yes"
    4.28 +BuildPreReq:  fsl
    4.29 +PreReq:       fsl
    4.30 +%endif
    4.31  AutoReq:      no
    4.32  AutoReqProv:  no
    4.33  
    4.34 @@ -52,19 +63,24 @@
    4.35  %track
    4.36      prog radiusclient = {
    4.37          version   = %{version}
    4.38 -        url       = http://prdownload.berlios.de/radiusclient-ng/
    4.39 +        url       = ftp://ftp.iptel.org/pub/radiusclient-ng/
    4.40          regex     = radiusclient-ng-(__VER__)\.tar\.gz
    4.41      }
    4.42  
    4.43  %prep
    4.44      %setup -q -n radiusclient-ng-%{version}
    4.45      %patch -p0
    4.46 +%if "%{with_brokenlibc}" == "yes"
    4.47 +    %patch -p0 -P 1
    4.48 +%endif
    4.49  
    4.50  %build
    4.51      CC="%{l_cc}" \
    4.52      CFLAGS="%{l_cflags -O}" \
    4.53      CPPFLAGS="%{l_cppflags}" \
    4.54 -    LDFLAGS="%{l_ldflags}" \
    4.55 +    LDFLAGS="%{l_ldflags} %{l_fsl_ldflags}" \
    4.56 +    LIBS="%{l_fsl_libs}" \
    4.57 +    GREP="grep" \
    4.58      ./configure \
    4.59          --prefix=%{l_prefix} \
    4.60          --sysconfdir=%{l_prefix}/etc/radiusclient \
    4.61 @@ -74,16 +90,32 @@
    4.62  %install
    4.63      rm -rf $RPM_BUILD_ROOT
    4.64      %{l_make} %{l_mflags} install AM_MAKEFLAGS="DESTDIR=$RPM_BUILD_ROOT"
    4.65 +    %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/var/radiusclient
    4.66 +    touch $RPM_BUILD_ROOT%{l_prefix}/var/radiusclient/radius.seq
    4.67 +    mv \
    4.68 +        $RPM_BUILD_ROOT%{l_prefix}/include/radiusclient-ng.h \
    4.69 +        $RPM_BUILD_ROOT%{l_prefix}/include/radiusclient.h
    4.70      rm -f $RPM_BUILD_ROOT%{l_prefix}/sbin/login.radius
    4.71      strip $RPM_BUILD_ROOT%{l_prefix}/sbin/* >/dev/null 2>&1 || true
    4.72 -    mv  $RPM_BUILD_ROOT%{l_prefix}/include/radiusclient-ng.h \
    4.73 -        $RPM_BUILD_ROOT%{l_prefix}/include/radiusclient.h
    4.74 +    %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/etc/fsl
    4.75 +    %{l_shtool} install -c -m 644 %{l_value -s -a} \
    4.76 +        %{SOURCE fsl.radiusclient} \
    4.77 +        $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/
    4.78 +
    4.79      %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
    4.80          %{l_files_std} \
    4.81 -        '%config %{l_prefix}/etc/radiusclient/*'
    4.82 +        '%not %dir %{l_prefix}/etc/fsl' \
    4.83 +        '%config %{l_prefix}/etc/radiusclient/*' \
    4.84 +        '%attr(640,%{l_mgrp},%{l_rgrp}) %{l_prefix}/etc/radiusclient/servers' \
    4.85 +        '%attr(644,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/radiusclient/radius.seq'
    4.86  
    4.87  %files -f files
    4.88  
    4.89  %clean
    4.90      rm -rf $RPM_BUILD_ROOT
    4.91  
    4.92 +%preun
    4.93 +    [ $1 -eq 0 ] || exit 0
    4.94 +    rm -f $RPM_INSTALL_PREFIX/var/radiusclient/*.log >/dev/null 2>&1 || true
    4.95 +    exit 0
    4.96 +

mercurial