Репозиторий Sisyphus
Последнее обновление: 1 октября 2023 | Пакетов: 18631 | Посещений: 37506322
en ru br
Репозитории ALT
S:4.17.11-alt1
5.1: 3.0.37-alt5.M50P.1
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
www.altlinux.org/Changes

Группа :: Система/Серверы
Пакет: samba

 Главная   Изменения   Спек   Патчи   Sources   Загрузить   Gear   Bugs and FR  Repocop 

# -*- rpm-spec -*-
%define baseversion 3.0.14a
%define origname samba

Name: samba
Version: %baseversion
Release: alt2

# 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

# **** 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
%def_disable xml
%def_disable mysql
%def_disable pgsql
%ifnarch armv5l
%def_enable cups
%def_enable gendoc
%else
%def_disable cups
%def_enable gendoc
%endif
%else
%define version_string ALT/%release
%def_enable xml
%def_enable mysql
%def_enable pgsql
# 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 02042905

%set_autoconf_version 2.5
%set_automake_version 1.6


Summary: Samba SMB 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-%baseversion.tar.bz2
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
Source10: ChangeLog.SAMBA_3_0.bz2
Source11: ChangeLog.svn.SAMBA_3_0.bz2
Source14: samba-docs-svn20050417.tar.bz2
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
#Source25: VERSION
# Pam config for samba-based applications like swat
Source26: samba
Source27: gpl.xml

# Post release fixes

Patch1: samba-3.0.14a-acl-bug.patch
Patch2: samba-docs-svn20050417.patch

# Fix build

Patch11: smbw.patch.bz2
Patch12: samba-3.0.0-buildroot.patch.bz2
Patch17: smbmount-sbin.patch
#Patch20: samba-docs-alt-build.patch

# ApplianceWare compatibility patch

Patch34: aw-smbstatus.patch

# Bugfixes:

Patch38: samba-3.0-gencache-init-alt.patch
#Patch39: samba-3.0-getgrouplist-alt.patch
Patch40: samba-3.0-vendorversion-alt.patch

# Patches which are under testing:

# currently none

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

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

%if_enabled cups
BuildRequires: libcups-devel
%endif

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

%if_enabled xml
BuildRequires: libxml2-devel
%endif

%if_enabled mysql
BuildRequires: libMySQL-devel
%endif

%if_enabled pgsql
BuildRequires: postgresql-devel
%endif

%if_enabled aw
%ifarch armv5l
BuildRequires: kernel-headers-iq31244
%else
BuildRequires: kernel-headers-aw
%endif
%else
BuildRequires: kernel-headers-std
%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
Provides: samba3-common
Requires: libkrb5 >= 1.3.1-alt2
Requires(pre): shadow-utils, service

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

%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

%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

%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

%if_enabled xml
%package pdb-xml
Summary: XML Passdb backend for Samba server
Group: System/Servers
Autoreq: yes
Requires: %name-common = %version-%release
Obsoletes: samba3-pdb-xml < %version-%release
Provides: samba3-pdb-xml
%endif

%if_enabled mysql
%package pdb-mysql
Summary: MySQL Passdb backend for Samba server
Group: System/Servers
Autoreq: yes
Requires: %name-common = %version-%release
Obsoletes: samba3-pdb-mysql < %version-%release
Provides: samba3-pdb-mysql
%endif

%if_enabled pgsql
%package pdb-pgsql
Summary: PostgreSQL Passdb backend for Samba server
Group: System/Servers
Autoreq: yes
Requires: %name-common = %version-%release
%endif

%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

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

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

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

%if_enabled xml
%description pdb-xml
This package provides XML-based Passdb backend for Samba server.
%endif

%if_enabled mysql
%description pdb-mysql
This package provides MySQL-based Passdb backend for Samba server.
%endif

%if_enabled pgsql
%description pdb-pgsql
This package provides PostgreSQL-based Passdb backend for Samba server.
%endif

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

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

%prep
%setup -q -n%origname-%baseversion
pushd source
%patch1 -p0
popd

%patch11 -p1 -b .smbw
%patch12 -p1 -b .buildroot
%patch17 -p1
#%patch34 -p1
%patch38 -p1
#%patch39 -p1
%patch40 -p1

# Replace version to our one

#%__cp %SOURCE25 source/
#/usr/bin/subst 's# at defaultvendor at #"%version_string"#' source/VERSION
#%__chmod +x source/script/mkversion.sh

%if_enabled gendoc
# Import documentation from samba-docs CVS
   rm -rf docs
   mkdir docs
pushd docs
   # Using Samba, 2nd ed.
   tar xjf %SOURCE15
   # Documentation sources
   tar xjf %SOURCE14
%patch2 -p0
# Make build non-interactive and networkless    
   pushd samba-docs
       %__cp %SOURCE27 .
       %__subst "s|http://www.gnu.org/licenses/gpl.xml|../gpl.xml|" Samba-Guide/index.xml \
       Samba-HOWTO-Collection/index.xml
   popd
popd
%endif

# Correct documentation a bit.

find examples docs -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 -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 -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|smbsh|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|smbsh|smbspool|smbstatus|smbtar|smbumount|testparm|testprns|wbinfo\),%_bindir/\3,g'
find examples docs -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 -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

# Enable experimental SAM modules only if requested by --enable options to rpmbuild

PDBMOD=
%if_enabled xml
PDBMOD="xml"
%endif
%if_enabled mysql
PDBMOD="${PDBMOD},mysql"
%endif
%if_enabled pgsql
PDBMOD="${PDBMOD},pgsql"
%endif
[ -n "$PDBMOD" ] || PDBMOD=no

%configure \
--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-automount \
--with-pam \
--with-sambabook=%_datadir/%origname/swat/using_samba \
--with-mmap \
--with-netatalk \
--with-quotas \
--with-smbwrapper \
--with-acl-support \
--with-expsam=$PDBMOD \
--with-winbind \
--with-swatdir=%_datadir/%origname/swat \
--with-piddir=%_lockdir \
--with-lockdir=%_localstatedir/%origname \
--with-libsmbclient=yes

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

%__make  \
   proto

# Make Samba using SMP if available

%make  \
   everything bin/smbfilter modules \
   nsswitch nsswitch/libnss_winbind.so nsswitch/libnss_wins.so nsswitch/pam_winbind.so \
   bin/tdbbackup  bin/libsmbclient.a bin/libsmbclient.so bin/tdbdump \
   bin/vfstest bin/smbget

$CC -o bin/cifsmount client/mount.cifs.c
popd

# Generate documentation if requested

%if_enabled gendoc
pushd docs/samba-docs
autoconf
./configure
%__make release
# We do not package editreg, therefore manual page also isn't needed.
%__rm output/manpages/editreg*
%__mv output/* ../
popd
%endif

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

%__rm -rf docs/samba-docs

%install
pushd source
%make DESTDIR=%buildroot install-everything
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 %buildroot%_datadir/%origname/vfs-devel/source/

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

for i in smbfilter smbsh smbwrapper.so cifsmount log2pcap vfstest smbget
do
 %__install -m755 source/bin/$i %buildroot%_bindir
done

for i in smbmnt
do
 %__install -m755 source/bin/$i %buildroot/%_sbindir
 [ ! -x %buildroot%_bindir/$i ] || %__rm -f %buildroot%_bindir/$i
done

%__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/nsswitch/pam_winbind.so %buildroot/lib/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 is obsolete by 'admin users' option
# and now by 'net rpc rights' management
cat packaging/Mandrake/smbusers | grep -v root > smbusers
%__install -m644 smbusers %buildroot%_sysconfdir/%origname/smbusers
%__install -m755 packaging/Mandrake/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

# Link smbmount to /sbin/mount.smb and /sbin/mount.smbfs

%__ln_s %_bindir/smbmount %buildroot/sbin/mount.smb
%__ln_s %_bindir/smbmount %buildroot/sbin/mount.smbfs
%__ln_s %_bindir/cifsmount %buildroot/sbin/mount.cifs
echo 127.0.0.1 localhost > %buildroot%_sysconfdir/%origname/lmhosts

# Link smbspool to CUPS (does not require installed CUPS)

%__install -d %buildroot%_libdir/cups/backend
%__ln_s %_bindir/smbspool %buildroot%_libdir/cups/backend/smb

## 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

bzip2 -9fk WHATSNEW.txt
# 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
install -p -m644 %{SOURCE10} %buildroot%_docdir/%origname-%version
install -p -m644 %{SOURCE11} %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 yet.
unset RPM_PYTHON

%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
if [ $1 -gt 1 ] ; 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
/usr/sbin/groupadd -r -f winbind

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

%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

%clean_menus

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

%post client
%post_control -s wheelonly cifsmount 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
%attr(-,root,root) %config(noreplace) %_sysconfdir/%origname/smbusers
%attr(-,root,root) %config %_initdir/smb
%attr(-,root,root) %config(noreplace) %_sysconfdir/logrotate.d/%origname
%_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
%dir %_logdir/%origname
%attr(1777,root,root) %dir %_spooldir/%origname
%dir %_docdir/%origname-%version
%_docdir/%origname-%version/[A-Z]*

%files client
%_bindir/smbfilter
/sbin/mount.smb
/sbin/mount.smbfs
/sbin/mount.cifs
%attr(755,root,root) %_bindir/smbmount
%attr(700,root,root) %_bindir/cifsmount
%attr(700,root,root) %_bindir/smbumount
%attr(700,root,root) %_sbindir/smbmnt
%_man8dir/smbmnt.8*
%_man8dir/smbmount.8*
%_man8dir/mount.cifs.8*
%_man8dir/smbumount.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*

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

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

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

%files client-cups
# Link of smbspool to CUPS
%_libdir/cups/backend/smb

%files common
#%%_bindir/editreg
%_bindir/mksmbpasswd.sh
%_bindir/log2pcap
%_bindir/net
%_bindir/ntlm_auth
%_bindir/rpcclient
%_bindir/smbcontrol
%_bindir/smbpasswd
%_bindir/smbsh
%_bindir/smbwrapper.so
%_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*
%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/smbsh.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/tdbdump.8*
%_man8dir/winbindd.8*
%_man8dir/pam_winbind.8*
%dir %_libdir/%origname/vfs
%dir %_libdir/%origname/pdb
%dir %_libdir/%origname/auth
%dir %_libdir/%origname/charset
%dir %_libdir/%origname/idmap
%dir %_libdir/%origname/rpc
%_libdir/%origname/*.dat
%dir %_localstatedir/%origname
%attr (750,root,winbind) %dir %_localstatedir/%origname/winbindd_privileged

%if_enabled xml
%files pdb-xml
%_libdir/%origname/pdb/xml.so
%endif

%if_enabled mysql
%files pdb-mysql
%_libdir/%origname/pdb/mysql.so
%endif

%if_enabled pgsql
%files pdb-pgsql
%_libdir/%origname/pdb/pgsql.so
%endif

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

%files vfs
%_bindir/vfstest
%_libdir/%origname/vfs/*
%_man1dir/vfstest.1*

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

%changelog

Полный changelog можно просмотреть здесь

 
дизайн и разработка: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
текущий майнтейнер: Michael Shigorin