Sisyphus repositório
Última atualização: 1 outubro 2023 | SRPMs: 18631 | Visitas: 37040622
en ru br
ALT Linux repositórios
S:4.17.11-alt1
5.0: 3.0.33-alt4
4.1: 3.0.30-alt3
4.0: 3.0.33-alt1.M40.1
+updates:3.0.33-alt1.M40.1
3.0: 3.0.14a-alt2
+backports:3.0.28-alt1

Group :: Sistema/Servidores
RPM: samba

 Main   Changelog   Spec   Patches   Sources   Download   Gear   Bugs e FR  Repocop 

# -*- rpm-spec -*-
%define origname samba

Name: samba
Version: 3.0.33
Release: alt4

# for pam modules

%add_findprov_lib_path /%_lib/security

%def_disable aw

# Do not use ccache while compiling Samba rpm by default

# you can enable ccaching by --enable ccache rpmbuild option
# and passing --define "__ccache_dir /path/to/cache" to override default setting
%def_disable ccache
%define __ccache_dir $HOME/.ccache

# Adds python support

%def_enable python

# **** NOTE **** NOTE **** NOTE ****

# This spec file has special support for XScale build
# It differs in options we use to compile Samba with for AW subproject, mainly:
# - We do not build documentation
# - We do not use CUPS
# These decisions are enforced through '--enable aw' switch on armv5l architecture

# Enable xml and mysql passdb modules only for ALT Linux build

%if_enabled aw
%define version_string v5.3
%ifnarch armv5l
%def_enable cups
%def_enable gendoc
%else
%def_disable cups
%def_disable gendoc
%endif
%else
%define version_string ALT/%release
# Do not generate documentation out of Docbook sources by default
%def_enable gendoc
# Use CUPS by default
%def_enable cups
%endif

%define negotiate_kernel 02041803
# Current ALT kernel version, used for enabling 'negotiate'
# feature in smbmount, works only with kernels after %negotiate_kernel
%define current_kernel 02061800

Summary: Samba SMB/CIFS server
License: GNU GPL
Group: System/Servers
Url: http://www.samba.org/
Packager: Alexander Bokovoy <ab at altlinux.ru>
PreReq: chkconfig, coreutils, sed, grep, glibc-gconv-modules
PreReq: %name-common = %version-%release
Requires(post): shadow-utils
Obsoletes: samba3 < %version-%release
Provides: samba3

Source: samba-%version.tar.gz
Source1: samba.log
Source2: mount.smb
Source3: samba.xinetd
Source4: swat_48.xpm.bz2
Source5: swat_32.xpm.bz2
Source6: swat_16.xpm.bz2
Source7: smb.init
Source8: winbind.init
Source15: using_samba.tar.bz2

# Config files for ALT Linux and ApplianceWare respectively

Source21: smb.conf
Source22: smb-aw.conf
Source23: system-auth-winbind
Source24: aw-system-auth-winbind
# Pam config for samba-based applications like swat
Source26: samba.pam
# catalog file for xsltproc
Source27: catalog.xml

# Fix build

Patch17: smbmount-sbin.patch
Patch18: samba-3.0.30-autoconf-2.62.patch
Patch19: samba-3.0.33-cifs.upcall-alt.patch

# ApplianceWare compatibility patch

Patch34: aw-smbstatus.patch

# Bugfixes:

#Patch42: samba-3.0.23-wins_nss.alt.patch
Patch43: smbumount-3.0.24-alt-options.patch

# Security fixes



Requires: %name-common = %version-%release

# due to sendfile64

BuildRequires: glibc-devel >= 2.2.6-alt0.10

# Automatically added by buildreq on Thu Apr 24 2003

BuildRequires: libattr-devel libldap-devel
BuildRequires: libncurses-devel libpam0-devel libpopt-devel libreadline-devel libsasl2 libssl-devel
BuildRequires: zlib-devel libacl-devel
BuildRequires: libkrb5-devel >= 1.3.1-alt2
BuildRequires: libkeyutils-devel >= 1.2-alt2

%if_enabled ccache
BuildRequires: gcc-common >= 1.4-alt1
%endif

%if_enabled cups
BuildRequires: libcups-devel libgnutls-devel
%define cups_serverbin %(cups-config --serverbin 2>/dev/null)
%endif

%if_enabled gendoc
BuildRequires: docbook-dtds latex2html inkscape
BuildRequires: docbook-style-xsl >= 1.73.2-alt1
BuildRequires: libxslt tetex-core tetex-latex xml-common xsltproc urw-fonts
BuildRequires: db2latex-xsl >= 0.8-alt0.pre1.2
BuildRequires: tetex-latex-listings tetex-latex-xcolor tetex-latex-unicode
%endif

%package common
Summary: Files used by both Samba servers and clients
Group: System/Servers
Provides: pam-winbind
Conflicts: %origname-common < 3.0
Obsoletes: samba3-common < %version-%release, samba-pdb-xml < %version-%release, samba-pdb-mysql < %version-%release, samba-pdb-pgsql < %version-%release
Provides: samba3-common
Requires: libkrb5 >= 1.3.1-alt2
Requires(pre): shadow-utils, service

%package client
Summary: Samba (SMB/CIFS) client programs
Group: Networking/Other
PreReq: samba-client-control >= 0:1.2
PreReq: %name-common = %version-%release
Requires: libsmbclient = %version-%release
Obsoletes: smbfs
Obsoletes: samba3-client < %version-%release
Provides: samba3-client
Requires: keyutils >= 1.2-alt2

%package -n libsmbclient
Summary: Samba client shared library
Group: Development/C

%package -n libsmbclient-devel
Summary: Samba client shared library development headers
Group: Development/C
Requires: libcups-devel libncurses-devel libpam-devel libreadline-devel libssl openssl-devel
Requires: libacl-devel libsmbclient = %version-%release
Obsoletes: samba3-client-devel < %version-%release
Provides: samba3-client-devel
Provides: samba-client-devel

%package -n libsmbclient-devel-static
Summary: Samba client static library
Group: Development/C
Requires: libsmbclient-devel = %version-%release
Requires: libacl-devel-static
Obsoletes: samba3-client-devel-static < %version-%release
Provides: samba3-client-devel-static
Provides: samba-client-devel-static

%if_enabled cups
%package client-cups
Summary: Samba (SMB) support for CUPS
Group: Networking/Other
PreReq: cups
Requires: %name-client = %version-%release, cups
Obsoletes: samba3-client-cups < %version-%release
Provides: samba3-client-cups
%endif

%package vfs
Summary: Sample VFS modules (audit, recycle bin, netatalk, readonly) for Samba server
Group: System/Servers
Autoreq: yes
Requires: %name = %version-%release
Obsoletes: samba3-vfs < %version-%release
Provides: samba3-vfs

%package utils
Summary: Samba utils
Group: System/Servers
Autoreq: yes
Requires: %name-common = %version-%release

%package vfs-devel
Summary: Files needed for building VFS modules for Samba server
Group: Development/C
Obsoletes: samba3-vfs-devel < %version-%release
Provides: samba3-vfs-devel
Autoreq: no
Requires: %name-common = %version-%release
Requires: libncurses-devel libpam0-devel
Requires: kernel-headers libreadline-devel openssl-devel
Requires: libldap-devel libkrb5-devel libpopt-devel
Requires: libacl-devel libattr-devel

%package swat
Summary: SWAT -- Samba Web Administration Tool
Group: Security/Networking
Requires: %name = %version-%release
Obsoletes: samba3-swat < %version-%release
Provides: samba3-swat

%package doc
Summary: Samba documentation
Group: Networking/Other
Requires: %name-common = %version-%release
Obsoletes: samba3-doc < %version-%release
Provides: samba3-doc

%if_enabled python
%package -n python-module-samba
Summary: This package contains Python bindings to allow you to access various aspects of Samba
Group: System/Servers
Autoreq: yes
Requires: %name-common = %version-%release
%setup_python_module samba
%endif

%description
Samba provides an SMB server which can be used to provide network
services to SMB (sometimes called "Lan Manager") clients, including
various versions of MS Windows, OS/2, and other Linux machines. Samba
uses NetBIOS over TCP/IP (NetBT) protocols and does NOT need NetBEUI
(Microsoft Raw NetBIOS frame) protocol.

Samba 3.0 features an almost working NT Domain Control and Active
Directory support capabilities and includes the new SWAT (Samba Web
Administration Tool) that allows samba's smb.conf file to be remotely
managed using your favourite web browser. For the time being this is
being enabled on TCP port 901 via xinetd.

Please refer to the WHATSNEW.txt document for fixup information.  This
binary release includes encrypted password support.  Please read the
smb.conf file and ENCRYPTION.txt in the docs directory for
implementation details.

%description common
Samba-common provides files necessary for both the server and client
packages of Samba.

%description client
Samba-client provides some SMB clients, which complement the built-in
SMB filesystem in Linux. These allow the accessing of SMB shares.
Support for printing to SMB printers is in Samba-client-cups package.

%description -n libsmbclient
This is a shared library which implements RPC interfaces needed for
client-side of CIFS implementation.

%description -n libsmbclient-devel
Samba client-side development headers

%description -n libsmbclient-devel-static
Static version of Samba client library (libsmbclient)

%if_enabled cups
%description client-cups
Samba-client-cups provides pluggable backend for CUPS printing system.
It allows printing to SMB printers.
%endif

%description vfs
Samba-vfs provides prebuilt Samba server VFS modules (audit, recycle bin, netatalk, and cap).

%description vfs-devel
Samba3-vfs-devel provides files necessary for building Samba server
VFS modules (for example, audit or antivirus scanner modules).

%description utils
Samba utils

%description doc
This package contains Samba documentation.

%description swat
Samba3-swat provides Samba web administration tool which allows
a Samba administrator to configure the complex smb.conf file
via web browser.

%if_enabled python
%description -n python-module-samba
This package contains Python bindings to allow you to access various aspects of Samba
%endif

%prep
%setup -q -n %origname-%version

%patch17 -p1
%patch18 -p1
%patch19 -p1
%patch43 -p1

# Apply security patches


%if_enabled gendoc
# fix install of man pages
%__subst "s/manpages/manpages-3/" source/script/installman.sh
# Import documentation from samba-docs CVS
   mkdir -p docs
pushd docs
   # Using Samba, 2nd ed.
   tar xjf %SOURCE15
popd
# Documentation sources
pushd docs-xml
# remove man pages for things which we either don't build or don't have in Samba 3.0
rm manpages-3/vfs_{gpfs,xattr_tdb}.*.xml
popd
%endif

# Correct documentation a bit.

find examples docs docs-xml -type f -print0 |
xargs -r0 fgrep -l /usr/local/samba/var/log |
xargs /usr/bin/subst 's|/usr/local/samba/var/log|%_logdir/%origname/log|g'
find examples docs docs-xml -type f -print0 |
xargs -r0 egrep -l '/(opt|usr/local)/samba/(bin/|private/)?(smbd|nmbd|swat|winbindd)' |
xargs /usr/bin/subst  's,/\(opt|usr/local\)/samba/\(bin/|private/\)?\(smbd|nmbd|swat|winbindd\),%_sbindir/\3,g'
find examples docs docs-xml -type f -print0 |
xargs -r0 egrep -l '/(opt|usr/local)/samba/(bin/|private/)?(convert_smbpasswd|findsmb|make_printerdef|make_smbcodepage|make_unicodemap|nmblookup|rpcclient|smbclient|smbmount|smbpasswd|smbprint|smbspool|smbstatus|smbtar|smbumount|testparm|testprns|wbinfo)' |
xargs /usr/bin/subst  's,/\(opt|usr/local\)/samba/\(bin/|private/\)?\(convert_smbpasswd|findsmb|make_printerdef|make_smbcodepage|make_unicodemap|nmblookup|rpcclient|smbclient|smbmount|smbpasswd|smbprint|smbspool|smbstatus|smbtar|smbumount|testparm|testprns|wbinfo\),%_bindir/\3,g'
find examples docs docs-xml -type f -print0 |
xargs -r0 fgrep -l '/usr/local/samba/lib/smb.conf' |
xargs /usr/bin/subst  's,/usr/local/samba/lib/smb.conf,%_sysconfdir/%origname/smb.conf,g'
find examples docs docs-xml -type f -print0 |
xargs -r0 fgrep -l '/usr/local/samba/netlogon' |
xargs /usr/bin/subst  's,/usr/local/samba/netlogon,%_localstatedir/%origname/netlogon,g'

%build
pushd source
./autogen.sh
export CPPFLAGS="$RPM_OPT_FLAGS -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -DREPLACE_UTIMES=1"
export CFLAGS="$RPM_OPT_FLAGS -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -DREPLACE_UTIMES=1"
# We do not use libcap due its wrong unconditional __u32 typedefs
export ac_cv_header_sys_capability_h=no

# Export CC=gcc if it CC is unset. This allows us to reuse ccache in BTE

[ -n "$CC" ] || export CC=gcc

# Use ccache to optimise rebuilds

%if_enabled ccache
export GCC_USE_CCACHE=1
export CCACHE_DIR=%__ccache_dir
%endif

%if_enabled debug
use_debug=" --enable-developer"
%endif

%configure $use_debug \
--with-fhs \
--libdir=%_libdir/%origname \
--sysconfdir=%_sysconfdir/%origname \
--localstatedir=%_var \
--with-logfilebase=%_logdir/%origname \
--with-configdir=%_sysconfdir/%origname \
--with-privatedir=%_sysconfdir/%origname \
--with-smbmount \
--with-syslog \
--with-ads \
--with-pam \
--with-sambabook=%_datadir/%origname/swat/using_samba \
--with-mmap \
--with-netatalk \
--with-quotas \
--with-acl-support \
--with-aio-support \
--with-winbind \
--with-swatdir=%_datadir/%origname/swat \
--with-piddir=%_lockdir \
--with-lockdir=%_localstatedir/%origname \
--with-shared-modules=idmap_rid,idmap_ad,vfs_prealloc,vfs_commit,vfs_catia,vfs_cacheprime,vfs_readahead \
--with-libsmbclient=yes \
--with-cifsupcall=yes \
%if_enabled python
--with-python=python%__python_version
%endif


%__subst 's,^LIBDIR *=.*,LIBDIR = %_libdir/%origname,' Makefile

# Make prototypes using uniprocessor (important, proto does not work for SMP)

%__make  \
   proto

# Make Samba using SMP if available

%make  \
   everything nsswitch smbcacls smbcquotas \
   sharesec timelimit wins cac \
   libsmbclient libsmbsharemodes libmsrpc libaddns \
   bin/tdbbackup bin/tdbdump bin/vfstest bin/smbget \
%if_enabled python
   python_ext
%endif


popd

# Generate documentation if requested

%if_enabled gendoc
pushd docs-xml
export XML_CATALOG_FILES="file:///etc/xml/catalog file://$(pwd)/build/catalog.xml"
autoconf
./configure --with-samba-sources=../source
%__make smbdotconf/parameters.all.xml
%__make smbdotconf/parameters.global.xml
%__make smbdotconf/parameters.service.xml
%__make release
mv output/* ../docs/
popd
%endif

# Do not distribute sources of documentation, they already included in src.rpm

%__rm -rf docs-xml

%install
pushd source
%make DESTDIR=%buildroot install-everything \
%if_enabled python
python_install
%endif


popd

%__mkdir -p %buildroot/sbin
%__mkdir -p %buildroot/%_sysconfdir/{%origname,logrotate.d,pam.d,xinetd.d}
%__mkdir -p %buildroot/%_initdir
%__mkdir -p %buildroot/%_localstatedir/%origname/winbindd_privileged
%__mkdir -p %buildroot/%_logdir/%origname
%__mkdir -p %buildroot/%_spooldir/%origname
%__mkdir -p %buildroot/%_localstatedir/%origname/{netlogon,profiles}
%__mkdir -p %buildroot/%_lib/security
%__mkdir -p %buildroot/%_datadir/%origname/vfs-devel/source
%__mkdir -p %buildroot/%_includedir


# Install samba-vfs-devel

pushd source
for i in `find . -name '*.h' -exec dirname '{}' \; |sort -u` ; do
   %__mkdir -p %buildroot%_datadir/%origname/vfs-devel/source/$i
   %__cp  $i/*.h %buildroot%_datadir/%origname/vfs-devel/source/$i/
done

%__cp include/libsmbclient.h %buildroot%_includedir/
popd

%__cp -r examples/VFS source/Makefile %buildroot%_datadir/%origname/vfs-devel/source/
sed -ri 's,^(src|build)dir=.*$,\1dir=.,' %buildroot%_datadir/%origname/vfs-devel/source/Makefile

for i in mksmbpasswd.sh
do
 %__install -m755 source/script/$i %buildroot%_bindir
done

for i in smbfilter log2pcap vfstest smbget \
        debug2html locktest locktest2 masktest msgtest nsstest smbtorture talloctort
do
 %__install -m755 source/bin/$i %buildroot%_bindir
done

install -pm700 source/bin/smbmnt %buildroot/sbin/
rm -f %buildroot%_bindir/smbmnt

%__install -m755 source/bin/libsmbclient.a %buildroot%_libdir/
%__mv %buildroot%_libdir/%origname/libsmbclient.so %buildroot%_libdir/libsmbclient.so.0
%__ln_s libsmbclient.so.0 %buildroot%_libdir/libsmbclient.so
%__rm -f %buildroot%_libdir/%origname/libsmbclient.a

# Install the nsswitch library extension file

for i in wins winbind ; do
 %__install -m755 source/nsswitch/libnss_$i.so %buildroot/%_lib
# Make link for Name Switch modules
 ( cd %buildroot/%_lib; %__ln_s libnss_$i.so libnss_$i.so.2; )
done

# Install PAM modules

%__mkdir -p %buildroot/%_lib/security
%__install -m755 source/bin/pam_winbind.so %buildroot/%_lib/security
%__rm -rf %buildroot%_libdir/%origname/security

%if_enabled aw
%__install -m644 %{SOURCE22} %buildroot%_sysconfdir/%origname/smb.conf
%else
%__install -m644 %{SOURCE21} %buildroot%_sysconfdir/%origname/smb.conf
%endif
# Remove 'root = administrator' mapping as it was obsoleted by 'admin users' option
# and now by 'net rpc rights' management
cat packaging/RHEL/setup/smbusers | grep -v root > smbusers
%__install -m644 smbusers %buildroot%_sysconfdir/%origname/smbusers
%__install -m755 packaging/RHEL/setup/smbprint %buildroot%_bindir
%__install -m755 source/script/findsmb %buildroot%_bindir
%if_enabled aw
%__install -m644 %{SOURCE24} %buildroot%_sysconfdir/pam.d/system-auth-winbind
%else
%__install -m644 %{SOURCE23} %buildroot%_sysconfdir/pam.d/system-auth-winbind
%endif
%__install -m644 %{SOURCE26} %buildroot%_sysconfdir/pam.d/samba
%__install -m644 %SOURCE1 %buildroot%_sysconfdir/logrotate.d/%origname

%__install -p -m755 -D %SOURCE7 %buildroot%_initdir/smb
%__install -p -m755 -D %SOURCE8 %buildroot%_initdir/winbind
%__ln_s  %_initdir/smb %buildroot%_sbindir/samba

# Fix mount.smbfs

mv %buildroot%_bindir/smbmount %buildroot/sbin/mount.smbfs
ln -s ../../sbin/mount.smbfs %buildroot%_bindir/smbmount
mv %buildroot%_man8dir/{smbmount,mount.smbfs}.8
ln -s mount.smbfs.8 %buildroot%_man8dir/smbmount.8

# Fix umount.smbfs

mv %buildroot%_bindir/smbumount %buildroot/sbin/umount.smbfs
ln -s ../../sbin/umount.smbfs %buildroot%_bindir/smbumount
mv %buildroot%_man8dir/{smbumount,umount.smbfs}.8
ln -s umount.smbfs.8 %buildroot%_man8dir/smbumount.8
rm %buildroot%_sbindir/mount.smbfs

# Fix *mount.cifs

mv %buildroot%_sbindir/*mount.cifs %buildroot/sbin/
ln -s ../../sbin/mount.cifs %buildroot%_bindir/cifsmount
ln -s mount.cifs.8 %buildroot%_man8dir/cifsmount.8
ln -s ../../sbin/umount.cifs %buildroot%_bindir/cifsumount
ln -s umount.cifs.8 %buildroot%_man8dir/cifsumount.8

# Fix *mount.cifs

mv %buildroot%_sbindir/cifs.upcall %buildroot/sbin/

# Fix *mount.*fs perms

chmod 700 %buildroot/sbin/{*mount.cifs,umount.smbfs,cifs.upcall}

echo 127.0.0.1 localhost > %buildroot%_sysconfdir/%origname/lmhosts

%if_enabled cups
# Link smbspool to CUPS (does not require installed CUPS)
%__install -d %buildroot%{cups_serverbin}/backend
%__ln_s %_bindir/smbspool %buildroot%{cups_serverbin}/backend/smb
%endif

## xinetd support

%__mkdir -p %buildroot/etc/xinetd.d
%__install -m644 %SOURCE3 %buildroot%_sysconfdir/xinetd.d/swat

# menu support

%__mkdir -p %buildroot%_menudir
%__cat > %buildroot%_menudir/%origname << EOF
?package(%origname):command="gnome-moz-remote http://localhost:901/" needs="gnome" \
icon="swat.xpm" section="Configuration/Networking" title="Samba Configuration" \
longtitle="The Swat Samba Administration Tool"
?package(%origname):command="sh -c '\$BROWSER http://localhost:901/'" needs="x11" \
icon="swat.xpm" section="Configuration/Networking" title="Samba Configuration" \
longtitle="The Swat Samba Administration Tool"
EOF

%__mkdir -p %buildroot%_liconsdir %buildroot%_iconsdir %buildroot%_miconsdir

bzcat %SOURCE4 > %buildroot%_liconsdir/swat.xpm
bzcat %SOURCE5 > %buildroot%_iconsdir/swat.xpm
bzcat %SOURCE6 > %buildroot%_miconsdir/swat.xpm

# remove "left" docs

%__rm -rf docs/manpages{,-3} docs/htmldocs/Samba4-HOWTO docs/htmldocs/test
%__rm -f docs/Samba4-HOWTO.pdf docs/test.pdf

# Install documentation.

%__mkdir -p %buildroot%_docdir/%origname-%version
install -p -m644 README Manifest WHATSNEW.txt Roadmap %buildroot%_docdir/%origname-%version
%__cp -a docs examples %buildroot%_docdir/%origname-%version
%if_enabled gendoc
%__cp -a docs/using_samba %buildroot%_datadir/%origname/swat/ ||:
%else
%__cp -a docs/htmldocs/using_samba %buildroot%_datadir/%origname/swat/ ||:
%endif

pushd %buildroot%_docdir/%origname-%version
find . -type f | xargs chmod 644
popd

# Do not install charset modules as we don't need them on ALT Linux

%__rm -f %buildroot%_libdir/%origname/charset/*
# Same for non-compiled SWAT translations
%__rm -f %buildroot%_libdir/%origname/*.msg

# This is a hack but we really don't need to bytecompile

# Python code as we didn't build it.
%if_disabled python
unset RPM_PYTHON
%endif

%post
# Add a unix group for samba machine accounts
/usr/sbin/groupadd -frg 421 machines
if [ $1 -gt 1 ] ; then
   # We stopped services previously at %%pre of %name-common if they were running
   # It is time to start them again
   if [ -f %_localstatedir/%origname/wnbstopped ] ; then
/sbin/service winbind start
%__rm -f %_localstatedir/%origname/wnbstopped
   fi
   if [ -f %_localstatedir/%origname/smbstopped ] ; then
/sbin/service smb start
%__rm -f %_localstatedir/%origname/smbstopped
   fi
else
   %post_service smb
fi

%pre
# Transfer databases into different location
if [ $1 -gt 1 ] ; then
   # Migrate tdb's from /var/lock/samba (taken from official samba spec file):
   if [ -d %_lockdir/%origname ]; then
       echo "Moving tdb files in /var/lock/samba/*.tdb to /var/lib/samba/*.tdb"
       for i in %_lockdir/%origname/*.tdb; do
   biname=$(basename $i)
   wrongname=$(ls -1 %_localstatedir/*.tdb 2>/dev/null |grep $biname)
   [ -n "$wrongname" ] || continue
   if [ -f $wrongname ] ; then
newname="%_localstatedir/%origname/$biname"
    echo "Moving $wrongname to $newname (fixing relocation error in 3.0.2a-alt2)"
    %__mv $wrongname $newname
   else
if [ -f $i ] ; then
   newname="%_localstatedir/%origname/$biname"
       echo "Moving $i to $newname"
       %__mv $i $newname
fi
   fi
done
   fi

   # Migrate tdb's from /var/cache/samba (taken from official samba spec file):
   if [ -d %_cachedir/%origname ]; then
echo "Moving tdb files in /var/cache/samba/*.tdb to /var/lib/samba/*.tdb"
for i in %_cachedir/%origname/*.tdb; do
   biname=$(basename $i)
   wrongname=$(ls -1 %_localstatedir/*.tdb 2>/dev/null |grep $biname)
   [ -n "$wrongname" ] || continue
   if [ -f $wrongname ] ; then
newname="%_localstatedir/%origname/$biname"
    echo "Moving $wrongname to $newname (fixing relocation error in 3.0.2a-alt2)"
    %__mv $wrongname $newname
   else
if [ -f $i ]; then
   newname="%_localstatedir/%origname/$biname"
       echo "Moving $i to $newname"
       %__mv $i $newname
fi
   fi
done
   fi

   # Remove the transient tdb files (modified from version in off. samba spec:
   for TDB in brlock unexpected locking messages; do
   if [ -e %_localstatedir/%origname/$TDB.tdb ]; then
   %__rm -f %_localstatedir/%origname/$TDB.tdb;
   fi;
   done

   if [ -d %_lockdir/%origname ]; then
%__rm -rf %_lockdir/%origname
   fi

   # Hack to fix upgrade from ancient versions.
   if [ $1 -gt 1 -a ! -e /etc/inetd.conf ]; then
touch /etc/inetd.conf
   fi
   
fi

%pre common
/usr/sbin/groupadd -r -f winbind
if [ $1 -gt 1 -a -s /etc/samba/smb.conf -a -f %_initdir/smb -a -f %_initdir/winbind ]; then
   smbstopped=$(/sbin/service smb status|grep stopped)
   wnbstopped=$(/sbin/service winbind status|grep stopped)
   [ -n "$smbstopped" ] || /sbin/service smb stop
   [ -n "$wnbstopped" ] || /sbin/service winbind stop
   [ -n "$smbstopped" ] || touch %_localstatedir/%origname/smbstopped
   [ -n "$wnbstopped" ] || touch %_localstatedir/%origname/wnbstopped
fi

%post common
if [ $1 -eq 1 ] ; then
   %post_service winbind
fi

%preun common
%preun_service winbind

%post swat
if [ -f %_lockdir/subsys/xinetd ]; then
/sbin/service xinetd sreload || :
fi

%preun
%preun_service smb
if [ $1 = 0 ] ; then
   if [ -e %_localstatedir/%origname/browse.dat ]; then
   %__rm -f %_localstatedir/%origname/browse.dat
   fi
   if [ -e %_localstatedir/%origname/wins.dat ]; then
   %__rm -f %_localstatedir/%origname/wins.dat
   fi
   if [ -d %_logdir/%origname ]; then
   %__rm -rf %_logdir/%origname/*
   fi
   if [ -d %_localstatedir/%origname ]; then
   %__rm -rf %_localstatedir/%origname/*
   fi
fi

%postun
# Remove swat entry from xinetd
if [ $1 = 0 -a -f %_sysconfdir/xinetd.conf -a -f %_lockdir/subsys/xinetd ]; then
/sbin/service xinetd sreload || :
fi


%triggerpostun -- samba < 1.9.18p7
if [ $1 != 0 ]; then
/sbin/chkconfig --add smb
fi

%triggerpostun -- samba < 2.0.10
if [ $1 != 0 ]; then
[ -d %_lockdir/%origname ] || %__mkdir -m755 %_lockdir/%origname
[ -d %_spooldir/%origname ] || %__mkdir -m1777 %_spooldir/%origname
[ ! -s %_sysconfdir/inetd.conf ] || %__chmod 644 %_sysconfdir/services %_sysconfdir/inetd.conf
else
[ -s %_sysconfdir/inetd.conf ] || rm -f %_sysconfdir/inetd.conf
fi

%pre client
%pre_control cifsmount cifsumount smbmount

%post client
%post_control -s wheelonly cifsmount cifsumount smbmount

%files swat
%config(noreplace) %_sysconfdir/xinetd.d/swat
%_sbindir/swat
%attr(-,root,root) %_datadir/%origname/swat
%_man8dir/swat.8*
%_menudir/%origname
%_miconsdir/*.xpm
%_liconsdir/*.xpm
%_iconsdir/*.xpm

%files
%_sbindir/%origname
%_sbindir/smbd
%_sbindir/nmbd
%_bindir/smbstatus
%_bindir/pdbedit
%_bindir/profiles
%_bindir/eventlogadm
%_libdir/%origname/libmsrpc.so
%attr(-,root,root) %config(noreplace) %_sysconfdir/%origname/smbusers
%attr(-,root,root) %config %_initdir/smb
%_man1dir/smbstatus.1*
%_man1dir/profiles.1*
%_man8dir/smbd.8*
%_man8dir/nmbd.8*
%_man8dir/pdbedit.8*
%attr(775,root,root) %dir %_localstatedir/%origname/netlogon
%attr(775,root,root) %dir %_localstatedir/%origname/profiles
%attr(1777,root,root) %dir %_spooldir/%origname
%dir %_docdir/%origname-%version
%_docdir/%origname-%version/[A-Z]*
%_man8dir/eventlogadm.8*
%_man8dir/idmap_*.8*



%files client
%_bindir/smbfilter
/sbin/smbmnt
/sbin/mount.cifs
/sbin/mount.smbfs
/sbin/umount.cifs
/sbin/umount.smbfs
/sbin/cifs.upcall
%_bindir/cifs*mount
%_bindir/smb*mount
%_man8dir/smbmnt.8*
%_man8dir/cifs*mount.8*
%_man8dir/smb*mount.8*
%_man8dir/*mount.cifs.8*
%_man8dir/*mount.smbfs.8*
%_bindir/nmblookup
%_bindir/findsmb
%_bindir/smbprint
%_bindir/smbtar
%_bindir/smbspool
%_bindir/smbclient
%_bindir/smbtree
%_bindir/smbcacls
%_bindir/smbcquotas
%_bindir/rpcclient
%_man1dir/smbtar.1*
%_man1dir/smbtree.1*
%_man1dir/smbclient.1*
%_man1dir/nmblookup.1*
%_man1dir/findsmb.1*
%_man1dir/smbcacls.1*
%_man1dir/smbcquotas.1*
%_man1dir/rpcclient.1*
%_man8dir/smbspool.8*
%_man7dir/libsmbclient.7*
%_man8dir/cifs.upcall.8*

%files -n libsmbclient
%_libdir/*.so.*
%_libdir/%origname/libsmbsharemodes.so

%files -n libsmbclient-devel-static
%_libdir/*.a

%files -n libsmbclient-devel
%_includedir/*.h
%_libdir/*.so

%if_enabled cups
%files client-cups
# Link of smbspool to CUPS
%{cups_serverbin}/backend/smb
%endif

%files common
#%%_bindir/editreg
%_bindir/mksmbpasswd.sh
%_bindir/log2pcap
%_bindir/net
%_bindir/ntlm_auth
%_bindir/smbcontrol
%_bindir/smbpasswd
%_bindir/tdbbackup
%_bindir/tdbtool
%_bindir/tdbdump
%_bindir/testparm
#%%_bindir/testprns
%_bindir/wbinfo
%_bindir/smbget
%_sbindir/winbindd
%attr(755,root,root) /%_lib/security/*
%attr(755,root,root) /%_lib/libnss*
%dir %_sysconfdir/%origname
%attr(-,root,root) %config(noreplace) %_sysconfdir/%origname/smb.conf
%attr(-,root,root) %config(noreplace) %_sysconfdir/%origname/lmhosts
%attr(-,root,root) %config %_initdir/winbind
%attr(644,root,root) %config(noreplace) %_sysconfdir/pam.d/system-auth-winbind
%attr(644,root,root) %config(noreplace) %_sysconfdir/pam.d/samba
#%%_man1dir/editreg.1*
%_man1dir/log2pcap.1*
%_man1dir/ntlm_auth.1*
%_man1dir/smbcontrol.1*
%_man1dir/testparm.1*
#%%_man1dir/testprns.1*
%_man5dir/smb.conf.5*
%_man5dir/smbpasswd.5*
%_man5dir/smbgetrc.5*
%_man5dir/lmhosts.5*
%_man1dir/wbinfo.1*
%_man1dir/smbget.1*
%_man7dir/samba.7*
%_man8dir/net.8*
%_man8dir/smbpasswd.8*
%_man8dir/tdbbackup.8*
%_man8dir/tdbtool.8*
%_man8dir/tdbdump.8*
%_man8dir/winbindd.8*
%_man7dir/pam_winbind.7*
%dir %_libdir/%origname
%dir %_libdir/%origname/vfs
%dir %_libdir/%origname/pdb
%dir %_libdir/%origname/auth
%dir %_libdir/%origname/charset
%dir %_libdir/%origname/idmap
%dir %_libdir/%origname/rpc
%dir %_libdir/%origname/nss_info
%_libdir/%origname/*.dat
%dir %_localstatedir/%origname
%_libdir/%origname/auth/*.so
%_libdir/%origname/idmap/*.so
%_libdir/%origname/nss_info/*.so
%attr(750,root,adm) %dir %_logdir/%origname
%attr(-,root,root) %config(noreplace) %_sysconfdir/logrotate.d/%origname
%attr (750,root,winbind) %dir %_localstatedir/%origname/winbindd_privileged

%files utils
%_bindir/vfstest
%_bindir/debug2html
%_bindir/locktest
%_bindir/locktest2
%_bindir/masktest
%_bindir/msgtest
%_bindir/nsstest
%_bindir/smbtorture
%_bindir/talloctort
%_man1dir/vfstest.1*

%if_enabled python
%files -n python-module-samba
%doc source/python/README
%doc source/python/examples
%doc source/python/gprinterdata
%doc source/python/gtdbtool
%doc source/python/gtkdictbrowser.py
%python_sitelibdir/%name
%python_sitelibdir/Samba_Python_Extensions*
%endif

%files doc
%dir %_docdir/%origname-%version
%_docdir/%origname-%version/[a-z]*

%files vfs
%_libdir/%origname/vfs/*
%_man8dir/vfs*.8*

%files vfs-devel
%dir %_datadir/%origname/vfs-devel
%_datadir/%origname/vfs-devel/*

%changelog

Todas as alterações você pod ver aqui

 
projeto & código: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
mantenedor atual: Michael Shigorin
mantenedor da tradução: Fernando Martini aka fmartini © 2009