File capi4hylafax.spec of Package capi4hylafax

#
# spec file for package capi4hylafax (Version 01.03.00)
#
# Copyright (c) 2007 SUSE LINUX Products GmbH, Nuernberg, Germany.
# This file and all modifications and additions to the pristine
# package are under the same license as the package itself.
#
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#

# norootforbuild

Name:           capi4hylafax
BuildRequires:  capi4linux capi4linux-devel gcc-c++ ghostscript-library libpng-devel libtiff-devel pwdutils
Excludearch:    s390 s390x
Group:          Hardware/Fax
Requires:       hylafax tiff gs_lib smtp_daemon a2ps hylafax-client
Autoreqprov:    on
Version:        01.03.00
Release:        1
Source:         %{name}-%{version}.tar.bz2
Patch0:         capi4hylafax-suse.diff
Patch1:         capi4hylafax-secfix.diff
Patch2:         capi4hylafax-secfix2.diff
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
Summary:        Adds a faxcapi modem for hylafax
PreReq:         sh-utils fileutils %insserv_prereq %fillup_prereq /usr/sbin/useradd /usr/sbin/usermod
License:        GPL v2 or later
URL:            http://www.avm.de
Summary:        Adds a faxcapi modem for hylafax

%description
capi4hylafax adds a faxcapi modem to the hylafax environment. So you
can send and receive FAX documents with CAPI 2.0 fax controllers via a
hylafax server.



Authors:
--------
    AVM  <cvs-capi4hylafax@avm.de>

%prep
%setup -q -n %{name}-%{version}
%patch -p1
%patch1 -p1
%patch2 -p1
find ../ -name .cvsignore -exec rm {} \;

%build
%{?suse_update_config:%{suse_update_config -f}}
CFLAGS=$RPM_OPT_FLAGS CXXFLAGS=$RPM_OPT_FLAGS \
./configure 	--prefix=/usr \
		--with-hylafax-spooldir=/var/spool/fax
#		--enable-debug 
make 

%install
install -d ${RPM_BUILD_ROOT}/var/spool/fax
install -d ${RPM_BUILD_ROOT}/usr/lib
install -d ${RPM_BUILD_ROOT}/usr/%_lib
install -d ${RPM_BUILD_ROOT}/usr/sbin
install -d ${RPM_BUILD_ROOT}/etc
make install BIN=${RPM_BUILD_ROOT}/usr/bin \
		SPOOL=${RPM_BUILD_ROOT}/var/spool/fax \
		LIBEXEC=${RPM_BUILD_ROOT}/usr/lib/fax \
		SBIN=${RPM_BUILD_ROOT}/usr/sbin \
		LIBDIR=${RPM_BUILD_ROOT}/usr/%_lib \
		DESTDIR=${RPM_BUILD_ROOT}
install -m755 faxaddmodem.capi ${RPM_BUILD_ROOT}/usr/sbin/
install -m755 setupconffile ${RPM_BUILD_ROOT}/usr/sbin/faxaddmodem.capi_dia
cp -p config.faxCAPI ${RPM_BUILD_ROOT}/etc/config.faxCAPI.sample
mkdir -p ${RPM_BUILD_ROOT}%{_defaultdocdir}/capi4hylafax
cp -p AUTHORS LIESMICH.html README.html fritz_pic.tif COPYING Readme_src \
	LIESMICH.SuSE README.SuSE \
	ChangeLog sample_AVMC4_config.faxCAPI sample_faxrcvd \
	config.faxCAPI \
	${RPM_BUILD_ROOT}%{_defaultdocdir}/capi4hylafax

%pre
/usr/sbin/useradd -r -o -g uucp -u 33 -s /bin/bash -c "Facsimile agent" -d /var/spool/fax fax 2> /dev/null || :
/usr/sbin/usermod -g uucp -G dialout fax 2> /dev/null || :
test -f /var/spool/fax/etc/config.faxCAPI -a ! -f /etc/config.faxCAPI && \
    cp -a /var/spool/fax/etc/config.faxCAPI /etc/config.faxCAPI || :

%clean
[ "${RPM_BUILD_ROOT}" != "/" ] && [ -d ${RPM_BUILD_ROOT} ] && rm -rf ${RPM_BUILD_ROOT};

%post
#!/bin/sh
cd etc
FILES=`grep -l "FaxReceiveUser:" config.fax*`
test -z "$FILES" && exit
CFG=""
for f in $FILES ; do
    case $f in
	*~);;
	*orig);;
	*save);;
	*new);;
	*sample);;
	*)  FRG=`grep "FaxReceiveGroup:" $f`
	    if [ -z "$FRG" ]; then
		CFG="${CFG} $f"
	    fi
	    ;;
    esac
done
test -z "$CFG" && exit
for f in $CFG ; do
    mv ${f} ${f}.orig
    cat ${f}.orig | while read line ; do
	case $line in
	    FaxReceiveUser:*)
		echo "FaxReceiveUser:         fax" >> ${f}
		echo "FaxReceiveGroup:        dialout" >> ${f}
		;;
	    *)  echo "$line" >> ${f}
		;;
	esac
    done
done

%files
%defattr(-, root, root)
%doc %{_defaultdocdir}/capi4hylafax
/usr/bin/c2faxrecv
/usr/bin/c2faxsend
/usr/sbin/faxaddmodem.capi
/usr/sbin/faxaddmodem.capi_dia
/etc/config.faxCAPI.sample

%changelog
* Tue Jul 31 2007 - kkeil@suse.de
- first standalone source
openSUSE Build Service is sponsored by