File samba.spec of Package samba-v3-0

#
# spec file for package samba (Version 3.0.34)
#
# Copyright (c) 2006 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
# neededforbuild  ccache cracklib-devel cups-devel cups-libs e2fsprogs e2fsprogs-devel heimdal-devel heimdal-lib libacl libacl-devel libattr libattr-devel libxml2 libxml2-devel mysql-devel mysql-shared openldap2-client openldap2-devel openssl openssl-devel pam-devel popt popt-devel postgresql-devel postgresql-libs python python-devel readline readline-devel

Name:           samba
BuildRequires:  cups-devel e2fsprogs-devel libacl-devel pam-devel popt-devel python-devel readline-devel
%if 0%{?suse_version}
BuildRequires:  ccache cracklib-devel openldap2-devel
%endif
%if 0%{?suse_version} > 1030
BuildRequires:  gdbm-devel pwdutils
%endif
%if 0%{?suse_version} > 930
BuildRequires:  krb5-devel libiniparser-devel libnscd-devel
%endif
%if 0%{?suse_version} > 930 && 0%{?suse_version} < 1031
BuildRequires:  dmapi-devel libnscd-devel libxml2-devel mysql-devel postgresql-devel xfsprogs-devel
%endif
%if 0%{?suse_version} > 830 && 0%{?suse_version} < 931
BuildRequires:  heimdal-devel
%endif
%if 0%{?fedora_version}
BuildRequires:  ccache cracklib-devel
%endif
%if 0%{?centos_version} || 0%{?fedora_version} || 0%{?rhel_version} || 0%{?mandriva_version}
BuildRequires:  krb5-devel openldap-devel
%endif
%define	samba_ver 3.0.34
%define	samba_ver_suffix %nil
%define	samba_ver_full %{samba_ver}%{samba_ver_suffix}
%define	vscan_ver 0.3.6b
%define	ldapsmb_ver 1.34b
License:        GPL
Group:          Productivity/Networking/Samba
Url:            http://www.samba.org/
AutoReqProv:    on
Version:        3.0.34
Release:        0
Requires:       samba-client >= %{version}
%if 0%{?suse_version} > 1030
Recommends:     cron
%endif
PreReq:         /bin/cp /bin/mkdir /bin/mv /bin/rm /bin/touch /usr/bin/dirname /usr/bin/grep /usr/sbin/groupadd /usr/bin/tr
Summary:        A SMB/CIFS File, Print, and Authentication Server
Source:         http://samba.org/samba/ftp/samba-%{version}%{samba_ver_suffix}.tar.bz2
Source1:        vendor-files.tar.bz2
Source2:        patches.tar.bz2
Source3:        build-source-timestamp
Source10:       http://prdownloads.sourceforge.net/openantivirus/samba-vscan-%{vscan_ver}.tar.bz2
Source11:       http://www.hhrm.de/~gd/ldapsmb/ldapsmb-%{ldapsmb_ver}.tar.bz2
# Choose some features / extra packages here
############################################
%define	make_devel 0
%define	use_ccache 0
# requires: docbook-utils docbook-xsl-stylesheets docbook_4 freetype2 ghostscript-fonts-std ghostscript-library ghostscript-x11 libxslt sgml-skel te_etex te_latex te_pdf tetex xmlcharent
%define	make_doc 0
%define	make_python 1
%define	make_utils 0
%define	make_vscan 1
%define	make_ldapsmb 1
%if 0%{?suse_version} > 1020
%define        make_cifsupcall 1
%else
%define        make_cifsupcall 0
%endif
# Define some global directories
################################
%define	DOCDIR %{_defaultdocdir}/samba
%define	DOCBOOKDIR %{_defaultdocdir}/%{name}/docbook
%define	SWATDIR %{_datadir}/samba/swat
%define	LOGDIR %{_localstatedir}/log/samba
%define	LOCKDIR %{_localstatedir}/lib/samba
%define	CONFIGDIR %{_sysconfdir}/samba
%define	INITDIR %{_sysconfdir}/init.d
%define	PIDDIR %{_localstatedir}/run/samba
%define	idmap_modules idmap_ad,idmap_ldap,idmap_rid
%if 0%{?ul_version} >= 1
%define	VENDOR UL
%else
%if "%{_vendor}" == "suse" || "%{_vendor}" == "redhat"
%define	VENDOR SUSE
%else
%define	VENDOR %_vendor
%endif
%endif
BuildRoot:      %{_tmppath}/%{name}-%{version}%{samba_ver_suffix}-build

%description
Samba is a suite of programs that allows SMB/CIFS clients to use the
Unix file space, printers, and authentication subsystem.

For a more detailed description, check the samba-doc package or the
Samba.org web page at http://www.Samba.org/

This package expects its configuration file to be found in
/etc/samba/smb.conf.



Authors:
--------
    The Samba Team <samba@samba.org>


%package client
Summary:        Samba Client Utilities
Group:          Productivity/Networking/Samba
AutoReqProv:    on
Provides:       smbfs samba3-client = %{version}-%{release}
Obsoletes:      samba3-client < %{version}
PreReq:         %{?insserv_prereq} %{?fillup_prereq} /bin/ln /bin/mkdir /bin/touch /sbin/ldconfig /usr/bin/dirname
%if 0%{?suse_version} == 0 || 0%{?suse_version} > 920
Requires:       cifs-mount
%endif

%description client
This package contains all programs that are needed to act as a Samba
client.



Authors:
--------
    The Samba Team <samba@samba.org>


%if 0%{?suse_version} == 0 || 0%{?suse_version} > 1020
%package devel
Summary:        Libraries and Header Files to Develop Programs with Samba Support
Group:          Development/Libraries/C and C++
AutoReqProv:    on

%description devel
This package contains the static libraries and header files needed to
develop programs which make use of Samba.



Authors:
--------
    The Samba Team <samba@samba.org>


%endif
%if 0%{?suse_version} && 0%{?suse_version} < 1001

%package doc
Summary:        Samba Documentation
Group:          Documentation/Other
AutoReqProv:    on
Provides:       samba3-doc = %{version}-%{release}
Obsoletes:      samba3-doc < %{version}
PreReq:         /bin/rm /usr/bin/find /usr/bin/xargs

%description doc
This package contains all the Samba documentation as it is not part of
the man pages.



Authors:
--------
    The Samba Team <samba@samba.org>

%endif

%package krb-printing
Summary:        Wrapper binary for kerberized printing
Group:          Productivity/Networking/Samba
AutoReqProv:    on
Provides:       samba3-krb-printing = %{version}-%{release}
Obsoletes:      samba3-krb-printing
%if 0%{?suse_version} > 1000
PreReq:         /sbin/conf.d/SuSEconfig.permissions
%endif
Requires:       samba-client >= %{version}

%description krb-printing
A wrapper binary to run smbspool with the original calling UID.



Authors:
--------
    Jeremy Allison <jeallison at Novell dot com>

%if %{make_python}

%package python
Summary:        Samba Python Modules
Group:          Productivity/Networking/Samba
AutoReqProv:    on
%define pyver %(python -c "import sys; print sys.version[:3]")
Provides:       samba3-python = %{version}-%{release}
Obsoletes:      samba3-python
Requires:       python >= %pyver, python < %pyver.99

%description python
This package provides the Samba Python modules.



Authors:
--------
    The Samba Team <samba@samba.org>

%endif
%if %{make_utils}

%package utils
Summary:        debug tools
Group:          Productivity/Networking/Samba
AutoReqProv:    on
Provides:       samba3-utils = %{version}-%{release}
Obsoletes:      samba3-utils

%description utils
Some of the debug-tools for developpers.



Authors:
--------
    The Samba Team <samba@samba.org>

%endif

%package winbind
Summary:        Winbind Daemon and Tool
Group:          Productivity/Networking/Samba
AutoReqProv:    on
Provides:       samba3-winbind = %{version}-%{release} samba-client:/usr/sbin/winbindd
Obsoletes:      samba3-winbind
Requires:       samba-client >= %{version}
%if 0%{?suse_version} > 1030
Recommends:     cron
%endif
PreReq:         /bin/ln /sbin/ldconfig /sbin/insserv

%description winbind
This is the winbind-daemon and the wbinfo-tool.



Authors:
--------
    The Samba Team <samba@samba.org>

%if 0%{?suse_version} && 0%{?suse_version} < 1031
%package -n libsmbclient
Provides:       libsmbclient = %{version}-%{release}
Obsoletes:      libsmbclient
%else
%package -n libsmbclient0
%endif
Summary:        Samba Client Library
Group:          System/Libraries
AutoReqProv:    on
PreReq:         /sbin/ldconfig

%if 0%{?suse_version} && 0%{?suse_version} < 1031
%description -n libsmbclient
%else
%description -n libsmbclient0
%endif
This package includes the smbclient library.



Authors:
--------
    The Samba Team <samba@samba.org>

%package -n libsmbclient-devel
Summary:        Libraries and Header Files to Develop Programs with smbclient Support
Group:          Development/Libraries/C and C++
AutoReqProv:    on
%if 0%{?suse_version} && 0%{?suse_version} < 921
Requires:       libsmbclient = %{version} heimdal-devel
%else
%if 0%{?suse_version} && 0%{?suse_version} < 1031
Requires:       libsmbclient = %{version} krb5-devel
%else
Requires:       libsmbclient0 = %{version} krb5-devel
%endif
%endif

%description -n libsmbclient-devel
This package contains the static libraries and header files needed to
develop programs which make use of the smbclient programming interface.



Authors:
--------
    The Samba Team <samba@samba.org>


%package -n libmsrpc
Summary:        Samba msrpc Library
Group:          System/Libraries
AutoReqProv:    on
PreReq:         /sbin/ldconfig

%description -n libmsrpc
This package includes the libmsrpc library.



Authors:
--------
    The Samba Team <samba@samba.org>

%package -n libmsrpc-devel
Summary:        Libraries and Header Files to Develop Programs with msrpc Support
Group:          Development/Libraries/C and C++
AutoReqProv:    on
Requires:       libmsrpc = %{version}

%description -n libmsrpc-devel
This package contains the static libraries and header files needed to
develop programs which make use of the msrpc programming interface.



Authors:
--------
    The Samba Team <samba@samba.org>

%if 0%{?suse_version} && 0%{?suse_version} < 1031
%package -n libsmbsharemodes
%else
%package -n libsmbsharemodes0
%endif
Summary:        Samba smbsharemodes Library
Group:          System/Libraries
AutoReqProv:    on
PreReq:         /sbin/ldconfig

%if 0%{?suse_version} && 0%{?suse_version} < 1031
%description -n libsmbsharemodes
%else
%description -n libsmbsharemodes0
%endif
This package includes the smbsharemodes library.



Authors:
--------
    The Samba Team <samba@samba.org>


%package -n libsmbsharemodes-devel
Summary:        Libraries and Header Files to Develop Programs with smbsharemodes Support
Group:          Development/Libraries/C and C++
AutoReqProv:    on
%if 0%{?suse_version} && 0%{?suse_version} < 1031
Requires:       libsmbsharemodes = %{version}
%else
Requires:       libsmbsharemodes0 = %{version}
%endif

%description -n libsmbsharemodes-devel
This package contains the static libraries and header files needed to
develop programs which make use of the smbsharemodes programming interface.



Authors:
--------
    The Samba Team <samba@samba.org>

%if %{make_ldapsmb}

%package -n ldapsmb
Summary:        Tool to administer Samba's LDAP backend
Group:          Productivity/Networking/Samba
AutoReqProv:    on
Version:        1.34b
Release:        0
Requires:       perl-ldap

%description -n ldapsmb
This tool aims to simplify the administration of a Samba Domain
Controller that uses the ldapsam passdb backend.



Authors:
--------
    Guenther Deschner <guenther at deschner dot de>

%endif
%if 0%{?suse_version} == 0 || 0%{?suse_version} > 920

%package -n cifs-mount
Summary:        mount using the Common Internet File System (CIFS)
Group:          System/Filesystems
AutoReqProv:    on

%description -n cifs-mount
mount.cifs mounts a CIFS filesystem. It is usually invoked indirectly
by the mount command when using the "-t cifs"  option.



Authors:
--------
    Steve French <sfrench at Samba dot org>

%endif
%if %{make_vscan}

%package vscan
Summary:        On-Access Virus Scanning with Samba
Group:          Productivity/Networking/Samba
AutoReqProv:    on
Version:        0.3.6b
Release:        0
Provides:       samba3-vscan = 0.3.6b
Obsoletes:      samba3-vscan
Requires:       samba = %{samba_ver}
Url:            http://www.openantivirus.org/

%description vscan
samba-vscan provides on-access scanning of Samba shares with ClamAV,
FRISK F-Prot, F-Secure AV, Kaspersky Anti-Virus, mks32, OAV
ScannerDaemon, Sophos Sweep, Symantec AntiVirus Engine (via ICAP) and
Trend Micro.



Authors:
--------
    Rainer Link <rainer@openantivirus.org>

%endif

%prep
%setup -n samba-%{samba_ver_full} -q
# ldapsmb
%if %{make_ldapsmb}
%setup -T -D -a 11 -n samba-%{samba_ver_full} -q
%endif
# patches
%setup -T -D -a 2 -n samba-%{samba_ver_full} -q
for patch in $( patches/tools/guards <patches/series); do
	if ! patch -s -E -p0 --no-backup-if-mismatch -i patches/$patch; then
		echo "*** Patch $patch failed ***"
		exit 1
	fi
done
# vscan
%if %{make_vscan}
%setup -T -D -a 10 -n samba-%{samba_ver_full}/examples/VFS -q
pushd samba-vscan-%{vscan_ver}
for patch in $( ../../../patches/tools/guards <../../../patches/vscan/series); do
	if ! patch -s -E -p0 --no-backup-if-mismatch -i ${RPM_BUILD_DIR}/samba-%{samba_ver_full}/patches/vscan/$patch; then
		echo "*** Patch $patch failed ***"
		exit 1
	fi
done
popd
%endif
# vendor-files (config, scripts, tools)
%setup -T -D -a 1 -n samba-%{samba_ver_full} -q
for file in docs/htmldocs/index.html vendor-files/docu/README.vendor; do
	sed -e "s/VENDOR/%{VENDOR}/g" "${file}" >"${file}.new" && \
		mv "${file}.new" "${file}"
done
cp -p vendor-files/tools/get_printing_ticket.c source/client/
# Create and add vendor suffix
test -f vendor-files/tools/package-data && \
	. vendor-files/tools/package-data
pushd source
vendor_tag=$( grep ^Release: ${RPM_SOURCE_DIR}/samba.spec | \
	head -n 1 | \
	while read tag release; do \
		echo -n "${release:+${release}-}"; \
	done; \
	echo -n "${SAMBA_PACKAGE_SVN_VERSION:+${SAMBA_PACKAGE_SVN_VERSION}-}"; \
	test %{make_devel} -eq 1 && echo -n "devel-" || :)
# Create product suffix
test 0%{?centos_version} -gt 0 && product_version=%{?centos_version}
test 0%{?fedora_version} -gt 0 && product_version=%{?fedora_version}
test 0%{?mandriva_version} -gt 0 && product_version=%{?mandriva_version}
test 0%{?rhel_version} -gt 0 && product_version=%{?rhel_version}
test 0%{?suse_version} -gt 0 && product_version=%{?suse_version}
major_version=$((${product_version}/100))
minor_version=$((${product_version}/10))
minor_version="${minor_version#$major_version}"
product_version="${major_version}.${minor_version}"
product_suffix=""
if test "%{VENDOR}" != "UL"; then
	if test "0%{?sles_version}" -gt 0; then
		product_suffix="-SLES%{sles_version}"
	elif test 0%{?suse_version} -gt 0; then
		product_suffix="-SL${product_version}"
	else
		product_suffix="-OBS"
	fi
	case "%{?suse_version}" in
		1010|1110) product_suffix="-CODE${major_version}" ;;
	esac
fi
# Set SAMBA_VERSION_VENDOR_SUFFIX in the VERSION file
mv VERSION VERSION.orig
sed -e s/^SAMBA_VERSION_VENDOR_SUFFIX=$/SAMBA_VERSION_VENDOR_SUFFIX=\"${vendor_tag}%{VENDOR}${product_suffix}\"/ VERSION.orig >VERSION

%build
%if 0%{?suse_version} && 0%{?suse_version} < 911
	OPTIMIZATION="-O"
%else
	# use the default optimization
	unset OPTIMIZATION
%endif
export CFLAGS="${RPM_OPT_FLAGS} -D_GNU_SOURCE ${OPTIMIZATION} -D_LARGEFILE64_SOURCE -DIDMAP_RID_SUPPORT_TRUSTED_DOMAINS"
%if 0%{?suse_version} > 1000
# debugging symbols
export CFLAGS="${CFLAGS} -g"
%endif
%if %{use_ccache}
export CC="ccache gcc"
%endif
cd source
%{?suse_update_config:%{suse_update_config -f}}
autoreconf --force --install -Ilib/replace
CONFIGURE_OPTIONS="\
	--prefix=%{_prefix} \
	--localstatedir=%{LOCKDIR} \
	--sysconfdir=%{CONFIGDIR} \
	--with-configdir=%{CONFIGDIR} \
	--with-libdir=%{_libdir} \
	--with-lockdir=%{LOCKDIR} \
	--with-logfilebase=%{LOGDIR} \
	--with-mandir=%{_mandir} \
	--with-rootsbindir=/sbin \
	--enable-cups \
	--with-acl-support \
	--with-automount \
	--with-dnsupdate \
	--with-msdfs \
	--with-pam \
	--with-pammodulesdir=%{_lib}/security \
	--with-pam_smbpass \
	--with-piddir=%{PIDDIR} \
	--with-privatedir=%{CONFIGDIR} \
%if %{make_devel}
	--with-profiling-data \
%endif
	--with-quotas \
%if 0%{?suse_version} && 0%{?suse_version} < 1011
	--with-smbmount \
%endif
	--with-swatdir=%{SWATDIR} \
	--with-syslog \
	--with-tdbsam \
	--with-utmp \
	--with-vfs \
	--with-winbind \
	--with-shared-modules=%{idmap_modules} \
%if %{make_python}
	--with-python \
%endif
%if %{make_cifsupcall}
	--with-cifsupcall \
%endif
%if %{make_devel}
	--enable-developer \
	--enable-krb5developer \
%endif
"
# make sure we have a chance to find krb5-config
for dir in /usr/lib/mit/bin /usr/lib/heimdal; do
	test -d "${dir}" && export PATH="${PATH}:${dir}"
done
unset CONFIGURE_OPTIONS_DEVEL
%if %{make_devel}
CONFIGURE_OPTIONS_DEVEL="--enable-debug --enable-developer"
%endif
./configure ${CONFIGURE_OPTIONS} ${CONFIGURE_OPTIONS_DEVEL}
./script/mkversion.sh
%if 0%{?suse_version} == 0 || 0%{?suse_version} > 930
%{__make} pch
%else
%{__make} proto
%endif
%{__make} %{?jobs:-j%jobs} \
	CONFIGDIR=%{CONFIGDIR} \
	LIBDIR=%{_libdir}/samba \
	everything
#%{__make} %{?jobs:-j%jobs} -C tdb tdbtest tdbtorture
%if %{make_vscan}
pushd ../examples/VFS/samba-vscan-%{vscan_ver}/
%{?suse_update_config:%{suse_update_config -f}}
autoreconf --force --install
./configure ${CONFIGURE_OPTIONS} ${CONFIGURE_OPTIONS_DEVEL}
%{__make} %{?jobs:-j%jobs}
popd
%endif
%if %{make_ldapsmb}
pushd ../ldapsmb-%{ldapsmb_ver}
./autogen.sh
rm ldapsmb
%{__make} %{?jobs:-j%jobs} all doc
popd
%endif
%if %{make_python}
%{__make} python_ext
%endif

%check
pushd source
make test_nss_modules
make test_pam_modules
popd
pushd testsuite/libsmbclient/src
make
popd

%install
[ x"${RPM_BUILD_ROOT}" = x"/" ] && ( echo "your buildroot is /" && exit 0) || rm -rf "${RPM_BUILD_ROOT}"
%if %{make_devel}
	export NO_BRP_STRIP_DEBUG="true"
%endif
mkdir -p \
	${RPM_BUILD_ROOT}/%{_sysconfdir}/{pam.d,xinetd.d,logrotate.d} \
	${RPM_BUILD_ROOT}/%{_sysconfdir}/openldap/schema \
	${RPM_BUILD_ROOT}/%{_sysconfdir}/sysconfig/network/{if-{down,up}.d,scripts} \
	${RPM_BUILD_ROOT}/%{_sysconfdir}/permissions.d \
	${RPM_BUILD_ROOT}/%{_sysconfdir}/security \
	${RPM_BUILD_ROOT}/%{_sysconfdir}/slp.reg.d \
	${RPM_BUILD_ROOT}/%{CONFIGDIR} \
	${RPM_BUILD_ROOT}/%{INITDIR} \
	${RPM_BUILD_ROOT}/%{_lib}/security \
	${RPM_BUILD_ROOT}/sbin \
	${RPM_BUILD_ROOT}/%{_includedir} \
	${RPM_BUILD_ROOT}/%{_libdir}/python/lib-dynload \
	${RPM_BUILD_ROOT}/%{_libdir}/samba/{config,vfs,rpc,auth,charset,idmap} \
	${RPM_BUILD_ROOT}/%{_datadir}/omc/svcinfo.d \
	${RPM_BUILD_ROOT}/%{_datadir}/samba/{LDAP,templates} \
	${RPM_BUILD_ROOT}/%{_localstatedir}/adm \
	${RPM_BUILD_ROOT}/%{LOCKDIR}/{netlogon,drivers/{WIN40,W32X86,W32MIPS,W32ALPHA,W32PPC,IA64,x64},printing,profiles} \
	${RPM_BUILD_ROOT}/%{LOGDIR} \
	${RPM_BUILD_ROOT}/%{PIDDIR} \
	${RPM_BUILD_ROOT}/%{_var}/adm/fillup-templates \
	${RPM_BUILD_ROOT}/%{_var}/lock/subsys \
	${RPM_BUILD_ROOT}/%{DOCDIR}-vscan \
	${RPM_BUILD_ROOT}/%{DOCDIR} \
	${RPM_BUILD_ROOT}/%{DOCBOOKDIR} \
	${RPM_BUILD_ROOT}/%{SWATDIR}/help \
	${RPM_BUILD_ROOT}/%{_datadir}/susehelp/meta/Administration/System
%{__make} -C source/ install \
	DESTDIR=${RPM_BUILD_ROOT} \
	CONFIGDIR=%{CONFIGDIR} \
	LIBDIR=%{_libdir}/samba
# utility scripts
scripts="creategroup mksmbpasswd.sh"
mkdir -p examples/scripts
for i in $scripts; do
	cp -p "source/script/${i}" examples/scripts
done
# configuration files
pushd vendor-files
echo "# smb.conf is the main Samba configuration file. You find a full commented" >config/smb.conf
echo "# version at %{DOCDIR}/examples/smb.conf.%{VENDOR} if the" >>config/smb.conf
echo "# samba-doc package is installed." >>config/smb.conf
echo "# Date: $( date -I)" >>config/smb.conf
grep -v "\(^#\|^;\|^$\)" config/smb.conf.vendor >>config/smb.conf
cp -p config/smb.conf.vendor ../examples/smb.conf.%{VENDOR}
for file in smb.conf lmhosts smbusers smbpasswd smbfstab smbusers; do
	cp -p "config/${file}" ${RPM_BUILD_ROOT}/%{CONFIGDIR}/
done
section_names=$( sed -ne 's/^\[\(.*\)\]$/\1/p' config/smb.conf)
for section in $section_names; do
	../source/bin/testparm -s --section-name "${section}" config/smb.conf >"${RPM_BUILD_ROOT}/%{_datadir}/samba/templates/default-${section}" || :
done
for file in config/templates/*; do
	cp -a "${file}" "${RPM_BUILD_ROOT}/%{_datadir}/samba/templates/"
done
# start scripts
scriptSuffix=""
%if 0%{?suse_version}
if test 0%{?suse_version} -lt 901; then
	scriptSuffix="-900"
elif test 0%{?suse_version} -lt 1011; then
	scriptSuffix="-1010"
fi
%endif
startScripts="smb nmb smbfs winbind"
for script in ${startScripts}; do
	cp -p "init/${script}${scriptSuffix}" \
		"${RPM_BUILD_ROOT}/%{INITDIR}/${script}"
	ln -s "%{INITDIR}/${script}" "${RPM_BUILD_ROOT}/%{_sbindir}/rc${script}"
done
for script in ${startScripts}; do
	SERVICE_NAME=$( echo "${script}" | tr [:lower:] [:upper:])
	sed \
		-e "s#__SERVICE_NAME#${SERVICE_NAME}#g" \
		-e "s#__SERVICE_SCRIPT_NAME#${script}#g" \
			init/template.xml \
			>"${RPM_BUILD_ROOT}/%{_datadir}/omc/svcinfo.d/${script}.xml"
done
cp -p tools/nmbstatus ${RPM_BUILD_ROOT}/%{_bindir}/
pod2man tools/nmbstatus >${RPM_BUILD_ROOT}/%{_mandir}/man1/nmbstatus.1
# PDF generator
cp -p tools/smbprngenpdf ${RPM_BUILD_ROOT}/%{_bindir}/
touch ${RPM_BUILD_ROOT}/var/lock/subsys/smbfs
cp -p config/swat.xinetd ${RPM_BUILD_ROOT}/%{_sysconfdir}/xinetd.d/swat
cp -p config/samba.reg ${RPM_BUILD_ROOT}/%{_sysconfdir}/slp.reg.d/
%if 0%{?suse_version} && 0%{?suse_version} < 921
	cp -p config/samba.pamd ${RPM_BUILD_ROOT}/%{_sysconfdir}/pam.d/samba
%else
	cp -p config/samba.pamd-common ${RPM_BUILD_ROOT}/%{_sysconfdir}/pam.d/samba
%endif
cp -p config/dhcp.conf ${RPM_BUILD_ROOT}/%{_var}/adm/fillup-templates/samba-client-dhcp.conf
cp -p config/sysconfig.dhcp-samba-client ${RPM_BUILD_ROOT}/%{_var}/adm/fillup-templates/
for script in dhcpcd-hook-samba samba-winbindd smbfs; do
	cp -p "tools/${script}" "${RPM_BUILD_ROOT}/%{_sysconfdir}/sysconfig/network/scripts/"
done
# Create ghosts for the symlinks
for script in 21-dhcpcd-hook-samba 21-smbfs 55-samba-winbindd; do
	touch ${RPM_BUILD_ROOT}/%{_sysconfdir}/sysconfig/network/if-{down,up}.d/${script}
done
# Add logrotate settings for nmbd and smbd only on systems newer than 8.1.
%if 0%{?suse_version} && 0%{?suse_version} < 811
	LOGROTATE_FILES="samba-winbind"
	rm -f "${RPM_BUILD_DIR}/samba-%{samba_ver_full}/filelist-samba"
	touch "${RPM_BUILD_DIR}/samba-%{samba_ver_full}/filelist-samba"
%else
	LOGROTATE_FILES="samba samba-winbind"
%endif
for file in ${LOGROTATE_FILES}; do
	cp -p logrotate/${file} ${RPM_BUILD_ROOT}/%{_sysconfdir}/logrotate.d/${file}
	rm -f "${RPM_BUILD_DIR}/samba-%{samba_ver_full}/filelist-${file}"
	touch "${RPM_BUILD_DIR}/samba-%{samba_ver_full}/filelist-${file}"
	echo "%config(noreplace) %{_sysconfdir}/logrotate.d/${file}" >>${RPM_BUILD_DIR}/samba-%{samba_ver_full}/filelist-${file}
done
cp -p docu/README.vendor ${RPM_BUILD_ROOT}/%{DOCDIR}/README.%{VENDOR}
# SuSEhelp files
cp -p docu/Samba.desktop ${RPM_BUILD_ROOT}/%{_datadir}/susehelp/meta/Administration/System
cp -p docu/manpages.html ../docs/htmldocs
popd
cp -p packaging/Debian/debian-unstable/samba-common.dhcp ${RPM_BUILD_ROOT}/%{_sysconfdir}/sysconfig/network/scripts/dhcpcd-hook-samba-functions
# libnss_wins.so
install -m 0755 source/nsswitch/libnss_wins.so ${RPM_BUILD_ROOT}/%{_lib}/libnss_wins.so.2
# winbind stuff
install -m 0644 examples/pam_winbind/pam_winbind.conf ${RPM_BUILD_ROOT}/%{_sysconfdir}/security/
install -m 0755 source/nsswitch/libnss_winbind.so ${RPM_BUILD_ROOT}/%{_lib}/libnss_winbind.so.2
# smbfilter
cp -p source/bin/smbfilter ${RPM_BUILD_ROOT}/%{_bindir}/
# smbget
cp -p source/bin/smbget ${RPM_BUILD_ROOT}/%{_bindir}/
# workaround for broken make install target
for file in libsmbclient libmsrpc libsmbsharemodes; do
	rm "${RPM_BUILD_ROOT}/%{_libdir}/samba/${file}.so"
	# install libs
	install -m 0644 "source/bin/${file}.a" "${RPM_BUILD_ROOT}/%{_libdir}"
	install -m 0755 "source/bin/${file}.so" "${RPM_BUILD_ROOT}/%{_libdir}/${file}.so.0"
	ln -s "${file}.so.0" "${RPM_BUILD_ROOT}/%{_libdir}/${file}.so"
done
# install nsswitch-headers (for squid, etc. #FIXME)
mkdir -p ${RPM_BUILD_ROOT}/%{_includedir}/samba/nsswitch
for file in winbind_client.h winbind_nss.h winbind_nss_config.h winbind_nss_linux.h winbindd.h winbindd_nss.h winbindd_proto.h; do
	cp -p "source/nsswitch/${file}" ${RPM_BUILD_ROOT}/%{_includedir}/samba/nsswitch/
done
# install smbtorture and other test-programs
%if %{make_utils}
install -m 0755 source/bin/debug2html ${RPM_BUILD_ROOT}/%{_bindir}/
install -m 0755 source/bin/log2pcap ${RPM_BUILD_ROOT}/%{_bindir}/
install -m 0755 source/bin/smbtorture ${RPM_BUILD_ROOT}/%{_bindir}/
install -m 0755 source/bin/talloctort ${RPM_BUILD_ROOT}/%{_bindir}/
install -m 0755 source/bin/{msgtest,masktest,locktest*} ${RPM_BUILD_ROOT}/%{_bindir}/
install -m 0755 source/bin/nsstest ${RPM_BUILD_ROOT}/%{_bindir}/
install -m 0755 source/bin/vfstest ${RPM_BUILD_ROOT}/%{_bindir}/
# install tdb tools
#install -m 0755 source/tdb/{tdbtest,tdbtorture} ${RPM_BUILD_ROOT}/%{_bindir}/
%endif
%if %{make_vscan}
# install VSCAN-vfs-modules
%{__make} -C examples/VFS/samba-vscan-%{vscan_ver} install \
	DESTDIR="${RPM_BUILD_ROOT}" \
	LIBDIR=%{_libdir}/samba
%endif
%if %{make_ldapsmb}
install -m 0700 ldapsmb-%{ldapsmb_ver}/ldapsmb ${RPM_BUILD_ROOT}/%{_sbindir}/
cp -a ldapsmb-%{ldapsmb_ver}/ldapsmb.5 ${RPM_BUILD_ROOT}/%{_mandir}/man5
%endif
# cups SMB support
mkdir	-p ${RPM_BUILD_ROOT}/%{_libdir}/cups/backend/
touch ${RPM_BUILD_ROOT}/%{_libdir}/cups/backend/smb
# make examples clean
VFS="${RPM_BUILD_DIR}/samba-%{samba_ver_full}/examples/VFS"
VSCAN="$VFS/samba-vscan-%{vscan_ver}"
dirs=" $SAM $VFS"
(for i in $dirs; do make -C "${i}" clean; done)
# install python
%if %{make_python}
cp -a source/build/lib.*/samba ${RPM_BUILD_ROOT}/%{_libdir}/python/lib-dynload/
%endif
# add docs
%if %{make_vscan}
mv examples/VFS/samba-vscan-%{vscan_ver} .
%endif
# pam_smbpass is missing
cp -a source/pam_smbpass/samples examples/pam_smbpass
cp -p source/pam_smbpass/{CHANGELOG,INSTALL,README,TODO} examples/pam_smbpass/
mv COPYING Manifest README Read-Manifest-Now Roadmap WHATSNEW.txt ${RPM_BUILD_ROOT}/%{DOCDIR}/
# this is empty
rm -rf docs/yodldocs
rm -rf docs/manpages
cp -a docs/* ${RPM_BUILD_ROOT}/%{DOCDIR}
rm -rf "${RPM_BUILD_ROOT}/%{DOCBOOKDIR}"
cp -a examples/ ${RPM_BUILD_ROOT}/%{DOCDIR}
rm -rf "${RPM_BUILD_ROOT}/%{SWATDIR}/using_samba"
ln -s "%{DOCDIR}/htmldocs/using_samba" "${RPM_BUILD_ROOT}/%{SWATDIR}"
test -e "${RPM_BUILD_ROOT}/%{SWATDIR}/help/manpages" || \
	ln -s "%{DOCDIR}/htmldocs/manpages" "${RPM_BUILD_ROOT}/%{SWATDIR}/help"
# Install HTML pages only in the samba-doc package
pushd ${RPM_BUILD_ROOT}/%{SWATDIR}/help
for file in $( find -mindepth 1 -maxdepth 1); do
	file="${file#./}"
	case "${file}" in
		welcome-no-samba-doc.html)
			case "%{name}" in
				samba*-doc) rm "${file}" ;;
			esac
			continue
			;;
		welcome.html) ;;
		*)
			rm -r "${file}"
			ln -s "%{DOCDIR}/htmldocs/${file}" .
			;;
	esac
	echo "%doc %{SWATDIR}/help/${file}" >>${RPM_BUILD_DIR}/samba-%{samba_ver_full}/filelist-samba-doc
done
popd
# finally build filelist-samba-doc
for file in $( find ${RPM_BUILD_ROOT}%{DOCDIR} -maxdepth 1); do
	# exclude %{DOCDIR}, README, and docbook
	case "${file#${RPM_BUILD_ROOT}}" in
		%{DOCDIR}|%{DOCDIR}/README.%{VENDOR}|%{DOCDIR}/docbook) continue ;;
	esac
	echo "%doc ${file#${RPM_BUILD_ROOT}}" >>"${RPM_BUILD_DIR}/samba-%{samba_ver_full}/filelist-samba-doc"
done
%if ! %{make_utils}
# delete manpages if not packaged in utils-package
rm -f \
	${RPM_BUILD_ROOT}/%{_mandir}/man1/log2pcap.1* \
	${RPM_BUILD_ROOT}/%{_mandir}/man1/vfstest.1*
%endif
# sort out vscan-modules from the main filelist
for file in $( find ${RPM_BUILD_ROOT}%{_libdir}/samba/vfs/ -mindepth 1 ! -iname '*vscan*' ); do
	echo "${file#${RPM_BUILD_ROOT}}" >>${RPM_BUILD_DIR}/samba-%{samba_ver_full}/filelist-samba
done
# copy the schema
cp -p examples/LDAP/samba.schema ${RPM_BUILD_ROOT}/%{_sysconfdir}/openldap/schema/samba3.schema
cp -p examples/LDAP/samba-nds.schema ${RPM_BUILD_ROOT}/%{_datadir}/samba/LDAP
# Clean up installed doc if we have a noarch doc package
%if 0%{?suse_version} == 0 || 0%{?suse_version} > 1000
while read file; do
	rm -r "${RPM_BUILD_ROOT}/${file#%* }"
done <"${RPM_BUILD_DIR}/samba-%{samba_ver_full}/filelist-samba-doc"
for file in %{SWATDIR}/using_samba %{_datadir}/susehelp; do
	rm -r "${RPM_BUILD_ROOT}/${file}"
done
pushd "${RPM_BUILD_ROOT}/%{DOCDIR}"
for file in $( find . -mindepth 1 -maxdepth 1);do
	test "${file}" = "./README.%{VENDOR}" && continue
	rm -r "${file}"
done
popd
%endif

%pre
/usr/sbin/groupadd -g 71 -o -r ntadmin 2>/dev/null || :

%preun
%stop_on_removal smb nmb

%postun
%restart_on_update nmb smb
%insserv_cleanup

%preun client
%stop_on_removal smbfs

%post client
/sbin/ldconfig
if [ ${1:-0} -eq 1 ]; then
# Only insserv smbfs if we're not in update mode.
%if 0%{?suse_version} && 0%{?suse_version} < 1001
%{fillup_and_insserv -fy smbfs} || :
%else
%fillup_and_insserv -fy smbfs
%endif
	ln -fs %{_sysconfdir}/sysconfig/network/scripts/dhcpcd-hook-samba %{_sysconfdir}/sysconfig/network/if-down.d/21-dhcpcd-hook-samba
	ln -fs %{_sysconfdir}/sysconfig/network/scripts/dhcpcd-hook-samba %{_sysconfdir}/sysconfig/network/if-up.d/21-dhcpcd-hook-samba
	ln -fs %{_sysconfdir}/sysconfig/network/scripts/smbfs %{_sysconfdir}/sysconfig/network/if-down.d/21-smbfs
	ln -fs %{_sysconfdir}/sysconfig/network/scripts/smbfs %{_sysconfdir}/sysconfig/network/if-up.d/21-smbfs
else
	for if_case in if-down.d if-up.d; do
		test -h %{_sysconfdir}/sysconfig/network/${if_case}/dhcpcd-hook-samba || \
			continue
		rm -f %{_sysconfdir}/sysconfig/network/${if_case}/dhcpcd-hook-samba
		ln -fs %{_sysconfdir}/sysconfig/network/scripts/dhcpcd-hook-samba %{_sysconfdir}/sysconfig/network/${if_case}/21-dhcpcd-hook-samba
		test -h %{_sysconfdir}/sysconfig/network/${if_case}/smbfs || \
			continue
		rm -f %{_sysconfdir}/sysconfig/network/${if_case}/smbfs
		ln -fs %{_sysconfdir}/sysconfig/network/scripts/smbfs %{_sysconfdir}/sysconfig/network/${if_case}/21-smbfs
	done
fi
if ! test -e %{_bindir}/get_printing_ticket; then
	ln -fs %{_bindir}/smbspool %{_libdir}/cups/backend/smb
fi
%fillup_only -nsd dhcp samba-client network

%postun client
/sbin/ldconfig
%insserv_cleanup
%if 0%{?suse_version} && 0%{?suse_version} < 1001

%pre doc
# Remove all directories and files from usr/share/samba/swat/help expect welcome-*.html
if [ -d usr/share/samba/swat/help ]; then
	find usr/share/samba/swat/help -mindepth 1 -maxdepth 1 -type d -print0 | \
		xargs -0 rm -rf
	for file in $( find usr/share/samba/swat/help -maxdepth 1 -type f); do
		case "${file}" in
			usr/share/samba/swat/help/welcome*.html) continue ;;
			*) rm -f "${file}" ;;
		esac
	done
fi
%endif

%post krb-printing
if test ${1:-0} -eq 1 -a -d %{_libdir}/cups/backend; then
	ln -fs %{_bindir}/get_printing_ticket %{_libdir}/cups/backend/smb
fi
%run_permissions

%postun krb-printing
if test -e %{_bindir}/smbspool -a -d %{_libdir}/cups/backend; then
	ln -fs %{_bindir}/smbspool %{_libdir}/cups/backend/smb
fi
%if 0%{?suse_version} == 0 || 0%{?suse_version} > 1000
%verifyscript krb-printing
%verify_permissions -e %{_bindir}/get_printing_ticket
%endif

%post winbind
/sbin/ldconfig
if test ${1:-0} -eq 1; then
	ln -fs %{_sysconfdir}/sysconfig/network/scripts/samba-winbindd %{_sysconfdir}/sysconfig/network/if-down.d/55-samba-winbindd
	ln -fs %{_sysconfdir}/sysconfig/network/scripts/samba-winbindd %{_sysconfdir}/sysconfig/network/if-up.d/55-samba-winbindd
else
	for if_case in if-down.d if-up.d; do
		test -h %{_sysconfdir}/sysconfig/network/${if_case}/samba-winbindd || \
			continue
		rm -f %{_sysconfdir}/sysconfig/network/${if_case}/samba-winbindd
		ln -fs %{_sysconfdir}/sysconfig/network/scripts/samba-winbindd %{_sysconfdir}/sysconfig/network/${if_case}/55-samba-winbindd
	done
fi

%preun winbind
%stop_on_removal winbind

%postun winbind
/sbin/ldconfig
%restart_on_update nscd winbind
%insserv_cleanup

%if 0%{?suse_version} && 0%{?suse_version} < 1031
%post -n libsmbclient
%else
%post -n libsmbclient0
%endif
/sbin/ldconfig

%if 0%{?suse_version} && 0%{?suse_version} < 1031
%postun -n libsmbclient
%else
%postun -n libsmbclient0
%endif
/sbin/ldconfig

%post -n libmsrpc
/sbin/ldconfig

%postun -n libmsrpc
/sbin/ldconfig

%if 0%{?suse_version} && 0%{?suse_version} < 1031
%post -n libsmbsharemodes
%else
%post -n libsmbsharemodes0
%endif
/sbin/ldconfig

%if 0%{?suse_version} && 0%{?suse_version} < 1031
%postun -n libsmbsharemodes
%else
%postun -n libsmbsharemodes0
%endif
/sbin/ldconfig

%clean
[ x"${RPM_BUILD_ROOT}" = x"/" ] && ( echo "your buildroot is /" && exit 0) || rm -rf "${RPM_BUILD_ROOT}"

%files -f filelist-samba
%defattr(-,root,root)
%attr(0754,root,root) %config %{INITDIR}/nmb
%attr(0754,root,root) %config %{INITDIR}/smb
%attr(0600,root,root) %config(noreplace) %{CONFIGDIR}/smbpasswd
%config(noreplace) %{CONFIGDIR}/smbusers
%config %{_sysconfdir}/pam.d/samba
%{_sysconfdir}/slp.reg.d
%config(noreplace) %{_sysconfdir}/xinetd.d/swat
/%{_lib}/security/pam_smbpass.so
%dir %{_libdir}/samba
%dir %{_libdir}/samba/vfs
%{_libdir}/samba/auth
%{_libdir}/samba/config
%{_libdir}/samba/rpc
%{_libdir}/samba/*.msg
%attr(0775,root,ntadmin) %{LOCKDIR}/drivers
%{LOCKDIR}/netlogon
%attr(0770,root,users) %dir %{LOCKDIR}/profiles
%dir %{SWATDIR}
%dir %{SWATDIR}/help
%{SWATDIR}/help/welcome-no-samba-doc.html
%{SWATDIR}/images
%{SWATDIR}/include
%{SWATDIR}/lang
%{_bindir}/smbstatus
%{_sbindir}/nmbd
%{_sbindir}/rcnmb
%{_sbindir}/rcsmb
%{_sbindir}/smbd
%{_sbindir}/swat
%if 0%{?suse_version} && 0%{?suse_version} < 1100
%dir %{_datadir}/omc
%dir %{_datadir}/omc/svcinfo.d
%endif
%attr(0644,root,root) %{_datadir}/omc/svcinfo.d/nmb.xml
%attr(0644,root,root) %{_datadir}/omc/svcinfo.d/smb.xml
%dir %{_datadir}/samba
%doc %{_mandir}/man1/smbstatus.1.*
%doc %{_mandir}/man5/smbpasswd.5.*
%doc %{_mandir}/man8/nmbd.8.*
%doc %{_mandir}/man8/smbd.8.*
%doc %{_mandir}/man8/swat.8.*
%doc %{_mandir}/man8/vfs_audit.8.*
%doc %{_mandir}/man8/vfs_cacheprime.8.*
%doc %{_mandir}/man8/vfs_cap.8.*
%doc %{_mandir}/man8/vfs_catia.8.*
%doc %{_mandir}/man8/vfs_commit.8.*
%doc %{_mandir}/man8/vfs_default_quota.8.*
%doc %{_mandir}/man8/vfs_extd_audit.8.*
%doc %{_mandir}/man8/vfs_fake_perms.8.*
%doc %{_mandir}/man8/vfs_full_audit.8.*
%doc %{_mandir}/man8/vfs_gpfs.8.*
%doc %{_mandir}/man8/vfs_netatalk.8.*
%doc %{_mandir}/man8/vfs_notify_fam.8.*
%doc %{_mandir}/man8/vfs_prealloc.8.*
%doc %{_mandir}/man8/vfs_readahead.8.*
%doc %{_mandir}/man8/vfs_readonly.8.*
%doc %{_mandir}/man8/vfs_recycle.8.*
%doc %{_mandir}/man8/vfs_shadow_copy.8.*
%doc %{_mandir}/man8/vfs_xattr_tdb.8.*
%if 0%{?suse_version} && 0%{?suse_version} < 1021
%{_includedir}/samba
%endif
%if 0%{?suse_version} == 0 || 0%{?suse_version} > 1020

%files devel
%defattr(-,root,root)
%{_includedir}/samba
%endif

%files client
%defattr(-,root,root)
%attr(0754,root,root) %config %{INITDIR}/smbfs
%dir %{CONFIGDIR}
%config(noreplace) %{CONFIGDIR}/lmhosts
%config(noreplace) %{CONFIGDIR}/smb.conf
%attr(0600,root,root) %config(noreplace) %{CONFIGDIR}/smbfstab
%dir %{_sysconfdir}/openldap
%dir %{_sysconfdir}/openldap/schema
%attr(0444,root,root) %config %{_sysconfdir}/openldap/schema/samba3.schema
%ghost %{_sysconfdir}/sysconfig/network/if-down.d/21-dhcpcd-hook-samba
%ghost %{_sysconfdir}/sysconfig/network/if-up.d/21-dhcpcd-hook-samba
%{_sysconfdir}/sysconfig/network/scripts/dhcpcd-hook-samba
%{_sysconfdir}/sysconfig/network/scripts/dhcpcd-hook-samba-functions
%ghost %{_sysconfdir}/sysconfig/network/if-down.d/21-smbfs
%ghost %{_sysconfdir}/sysconfig/network/if-up.d/21-smbfs
%{_sysconfdir}/sysconfig/network/scripts/smbfs
%{_bindir}/eventlogadm
%{_bindir}/findsmb
%{_bindir}/net
%{_bindir}/nmblookup
%{_bindir}/nmbstatus
%{_bindir}/pdbedit
%{_bindir}/profiles
%{_bindir}/rpcclient
%{_bindir}/smbcacls
%{_bindir}/smbclient
%{_bindir}/smbcontrol
%{_bindir}/smbcquotas
%{_bindir}/smbfilter
%{_bindir}/smbget
%{_bindir}/smbpasswd
%{_bindir}/smbprngenpdf
%{_bindir}/smbspool
%{_bindir}/smbtar
%{_bindir}/smbtree
%{_bindir}/tdbbackup
%{_bindir}/tdbdump
%{_bindir}/tdbtool
%{_bindir}/testparm
%{_sbindir}/rcsmbfs
%if 0%{?suse_version} && 0%{?suse_version} < 1011
%{_bindir}/smbmnt
%{_bindir}/smbmount
%{_bindir}/smbumount
%doc %{_mandir}/man8/smbmnt.8.*
%doc %{_mandir}/man8/smbmount.8.*
%doc %{_mandir}/man8/smbumount.8.*
/sbin/mount.smbfs
%endif
/%{_lib}/libnss_wins.so.2
%dir %{_libdir}/cups
%dir %{_libdir}/cups/backend
%ghost %{_libdir}/cups/backend/smb
%dir %{_libdir}/samba
%{_libdir}/samba/charset
%{_libdir}/samba/lowcase.dat
%{_libdir}/samba/upcase.dat
%{_libdir}/samba/valid.dat
%doc %{_mandir}/man1/findsmb.1.*
%doc %{_mandir}/man1/nmblookup.1.*
%doc %{_mandir}/man1/nmbstatus.1.*
%doc %{_mandir}/man1/profiles.1.*
%doc %{_mandir}/man1/rpcclient.1.*
%doc %{_mandir}/man1/smbcacls.1.*
%doc %{_mandir}/man1/smbcontrol.1.*
%doc %{_mandir}/man1/smbclient.1.*
%doc %{_mandir}/man1/smbcquotas.1.*
%doc %{_mandir}/man1/smbget.1.*
%doc %{_mandir}/man1/smbtar.1.*
%doc %{_mandir}/man1/smbtree.1.*
%doc %{_mandir}/man1/testparm.1.*
%doc %{_mandir}/man5/lmhosts.5.*
%doc %{_mandir}/man5/smb.conf.5.*
%doc %{_mandir}/man5/smbgetrc.5.*
%doc %{_mandir}/man7/samba.7.*
%doc %{_mandir}/man8/eventlogadm.8.*
%doc %{_mandir}/man8/net.8.*
%doc %{_mandir}/man8/pdbedit.8.*
%doc %{_mandir}/man8/smbpasswd.8.*
%doc %{_mandir}/man8/smbspool.8.*
%doc %{_mandir}/man8/tdbbackup.8.*
%doc %{_mandir}/man8/tdbdump.8.*
%doc %{_mandir}/man8/tdbtool.8.*
%if 0%{?suse_version} && 0%{?suse_version} < 1100
%dir %{_datadir}/omc
%dir %{_datadir}/omc/svcinfo.d
%endif
%attr(0644,root,root) %{_datadir}/omc/svcinfo.d/smbfs.xml
%dir %{_datadir}/samba
%dir %{_datadir}/samba/LDAP
%config %{_datadir}/samba/LDAP/samba-nds.schema
%{_datadir}/samba/templates
%dir %{DOCDIR}
%doc %{DOCDIR}/README.%{VENDOR}
%{_var}/adm/fillup-templates/samba-client-dhcp.conf
%{_var}/adm/fillup-templates/sysconfig.dhcp-samba-client
%ghost %{_var}/lock/subsys/smbfs
%dir %{LOCKDIR}
%attr(0750,root,root) %dir %{LOGDIR}
%dir %{PIDDIR}
%if 0%{?suse_version} && 0%{?suse_version} < 921
/sbin/mount.cifs
/sbin/umount.cifs
%doc %{_mandir}/man8/mount.cifs.8.*
%doc %{_mandir}/man8/umount.cifs.8.*
%endif

%files winbind -f filelist-samba-winbind
%defattr(-,root,root)
%config(noreplace) %{_sysconfdir}/security/pam_winbind.conf
%attr(0754,root,root) %config %{INITDIR}/winbind
%ghost %{_sysconfdir}/sysconfig/network/if-down.d/55-samba-winbindd
%ghost %{_sysconfdir}/sysconfig/network/if-up.d/55-samba-winbindd
%{_sysconfdir}/sysconfig/network/scripts/samba-winbindd
%doc %{_mandir}/man1/ntlm_auth.1.*
%doc %{_mandir}/man1/wbinfo.1.*
%doc %{_mandir}/man8/winbindd.8.*
%{_bindir}/ntlm_auth
%{_bindir}/wbinfo
%{_sbindir}/rcwinbind
%{_sbindir}/winbindd
/%{_lib}/libnss_winbind.so.2
/%{_lib}/security/pam_winbind.so
%{_libdir}/samba/idmap
%{_libdir}/samba/nss_info
%doc %{_mandir}/man7/pam_winbind.7.*
%doc %{_mandir}/man8/idmap_ad.8.*
%doc %{_mandir}/man8/idmap_ldap.8.*
%doc %{_mandir}/man8/idmap_nss.8.*
%doc %{_mandir}/man8/idmap_rid.8.*
%doc %{_mandir}/man8/idmap_tdb.8.*
%if 0%{?suse_version} && 0%{?suse_version} < 1100
%dir %{_datadir}/omc
%dir %{_datadir}/omc/svcinfo.d
%endif
%attr(0644,root,root) %{_datadir}/omc/svcinfo.d/winbind.xml
%if %{make_utils}

%files utils
%defattr(-,root,root)
%{_bindir}/debug2html
%{_bindir}/log2pcap
%{_bindir}/locktest
%{_bindir}/locktest2
%{_bindir}/masktest
%{_bindir}/msgtest
%{_bindir}/nsstest
%{_bindir}/smbtorture
%{_bindir}/talloctort
#%{_bindir}/tdbtest
#%{_bindir}/tdbtorture
%{_bindir}/vfstest
%doc %{_mandir}/man1/log2pcap.1.*
%doc %{_mandir}/man1/vfstest.1.*
%endif
%if 0%{?suse_version} && 0%{?suse_version} < 1001

%files doc -f filelist-samba-doc
%defattr(-,root,root)
%dir %{DOCDIR}
%dir %{_datadir}/samba
%dir %{SWATDIR}
%dir %{SWATDIR}/help
%{SWATDIR}/using_samba
%doc %{_datadir}/susehelp
%endif

%files krb-printing
%defattr(-,root,root)
%if 0%{?suse_version} == 0 || 0%{?suse_version} > 1000
%verify(not mode) %attr(4750,root,lp) %{_bindir}/get_printing_ticket
%else
%attr(0750,root,lp) %{_bindir}/get_printing_ticket
%endif
%dir %{_libdir}/cups
%dir %{_libdir}/cups/backend
%ghost %{_libdir}/cups/backend/smb

%if %{make_vscan}

%files vscan
%defattr(-,root,root)
%{_libdir}/samba/vfs/vscan*
%doc samba-vscan-%{vscan_ver}/{AUTHORS,COPYING,ChangeLog,FAQ,INSTALL,NEWS,README,TODO}
%doc samba-vscan-%{vscan_ver}/*/vscan-*.conf
%dir %{_libdir}/samba/vfs
%endif
%if %{make_python}

%files python
%defattr(-,root,root)
%doc source/python/README
%doc source/python/examples
%doc source/python/gprinterdata
%doc source/python/gtdbtool
%doc source/python/gtkdictbrowser.py
%{_libdir}/python/lib-dynload/samba
%endif

%if 0%{?suse_version} && 0%{?suse_version} < 1031
%files -n libsmbclient
%else
%files -n libsmbclient0
%endif
%defattr(-,root,root)
%{_libdir}/libsmbclient.so.*
%doc %{_mandir}/man7/libsmbclient.7.*

%files -n libsmbclient-devel
%defattr(-,root,root)
%{_includedir}/libsmbclient.h
%{_libdir}/libsmbclient.a
%{_libdir}/libsmbclient.so

%files -n libmsrpc
%defattr(-,root,root)
%{_libdir}/libmsrpc.so.*

%files -n libmsrpc-devel
%defattr(-,root,root)
%{_includedir}/libmsrpc.h
%{_libdir}/libmsrpc.a
%{_libdir}/libmsrpc.so

%if 0%{?suse_version} && 0%{?suse_version} < 1031
%files -n libsmbsharemodes
%else
%files -n libsmbsharemodes0
%endif
%defattr(-,root,root)
%{_libdir}/libsmbsharemodes.so.*

%files -n libsmbsharemodes-devel
%defattr(-,root,root)
%{_includedir}/smb_share_modes.h
%{_libdir}/libsmbsharemodes.a
%{_libdir}/libsmbsharemodes.so
%if %{make_ldapsmb}

%files -n ldapsmb
%defattr(-,root,root)
%{_sbindir}/ldapsmb
%{_mandir}/man5/ldapsmb.5.*
%endif
%if 0%{?suse_version} == 0 || 0%{?suse_version} > 920

%files -n cifs-mount
%defattr(-,root,root)
/sbin/mount.cifs
/sbin/umount.cifs
%if 0%{?suse_version} > 1020
%{_sbindir}/cifs.upcall
%doc %{_mandir}/man8/cifs.upcall.8.*
%endif
%doc %{_mandir}/man8/mount.cifs.8.*
%doc %{_mandir}/man8/umount.cifs.8.*
%endif