File capi4hylafax.spec of Package capi4hylafax

#
# spec file for package capi4hylafax
#
# Copyright (c) 2011 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#



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
Version:        01.03.00
Release:        155
Source:         %{name}-%{version}.tar.bz2
Patch0:         capi4hylafax-suse.diff
Patch1:         capi4hylafax-secfix.diff
Patch2:         capi4hylafax-secfix2.diff
Patch3:         capi4hylafax-configure.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:        GPLv2+
Url:            http://www.avm.de
Summary:        Adds a faxcapi modem for hylafax

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

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

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

%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 || :

%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
openSUSE Build Service is sponsored by