summaryrefslogtreecommitdiff
path: root/packaging/RedHat/samba.spec.tmpl
diff options
context:
space:
mode:
Diffstat (limited to 'packaging/RedHat/samba.spec.tmpl')
-rw-r--r--packaging/RedHat/samba.spec.tmpl201
1 files changed, 101 insertions, 100 deletions
diff --git a/packaging/RedHat/samba.spec.tmpl b/packaging/RedHat/samba.spec.tmpl
index ee0b43c017..787fe87d4a 100644
--- a/packaging/RedHat/samba.spec.tmpl
+++ b/packaging/RedHat/samba.spec.tmpl
@@ -2,6 +2,7 @@
%define rpm_version `rpm --version | awk '{print $3}' | awk -F. '{print $1$2}'`
Summary: Samba SMB client and server
+Vendor: Samba Team
Name: samba
Version: PVERSION
Release: PRELEASE
@@ -113,7 +114,7 @@ mkdir -p $RPM_BUILD_ROOT%{prefix}/{bin,sbin}
mkdir -p $RPM_BUILD_ROOT%{prefix}/share/swat/{images,help,include,using_samba}
mkdir -p $RPM_BUILD_ROOT%{prefix}/share/swat/using_samba/{figs,gifs}
mkdir -p $RPM_BUILD_ROOTMANDIR_MACRO
-mkdir -p $RPM_BUILD_ROOT/var/cache/samba
+mkdir -p $RPM_BUILD_ROOT/var/lib/samba
mkdir -p $RPM_BUILD_ROOT/var/{log,run}/samba
mkdir -p $RPM_BUILD_ROOT/var/spool/samba
mkdir -p $RPM_BUILD_ROOT/lib/security
@@ -192,10 +193,23 @@ echo 127.0.0.1 localhost > $RPM_BUILD_ROOT/etc/samba/lmhosts
# Remove "*.old" files
find $RPM_BUILD_ROOT -name "*.old" -exec rm -f {} \;
+##
+## Clean out man pages for tools not installed here
+##
+rm -f $RPM_BUILD_ROOT/%{_mandir}/man1/editreg.1*
+rm -f $RPM_BUILD_ROOT%{_mandir}/man1/log2pcap.1*
+rm -f $RPM_BUILD_ROOT%{_mandir}/man1/smbsh.1*
+rm -f $RPM_BUILD_ROOT%{_mandir}/man1/smbget.1*
+rm -f $RPM_BUILD_ROOT/%{_mandir}/man8/mount.cifs.8*
+
+
%clean
rm -rf $RPM_BUILD_ROOT
%post
+##
+## only needed if this is a new install (not an upgrade)
+##
if [ "$1" -eq "1" ]; then
/sbin/chkconfig --add smb
/sbin/chkconfig --add winbind
@@ -203,96 +217,85 @@ if [ "$1" -eq "1" ]; then
/sbin/chkconfig winbind off
fi
-echo "Looking for old /etc/smb.conf..."
-if [ -f /etc/smb.conf -a ! -f /etc/samba/smb.conf ]; then
- echo "Moving old /etc/smb.conf to /etc/samba/smb.conf"
- mv /etc/smb.conf /etc/samba/smb.conf
-fi
-
-echo "Looking for old /etc/smbusers..."
-if [ -f /etc/smbusers -a ! -f /etc/samba/smbusers ]; then
- echo "Moving old /etc/smbusers to /etc/samba/smbusers"
- mv /etc/smbusers /etc/samba/smbusers
-fi
-
-echo "Looking for old /etc/lmhosts..."
-if [ -f /etc/lmhosts -a ! -f /etc/samba/lmhosts ]; then
- echo "Moving old /etc/lmhosts to /etc/samba/lmhosts"
- mv /etc/lmhosts /etc/samba/lmhosts
-fi
-
-echo "Looking for old /etc/MACHINE.SID..."
-if [ -f /etc/MACHINE.SID -a ! -f /etc/samba/MACHINE.SID ]; then
- echo "Moving old /etc/MACHINE.SID to /etc/samba/MACHINE.SID"
- mv /etc/MACHINE.SID /etc/samba/MACHINE.SID
-fi
-
-echo "Looking for old /etc/smbpasswd..."
-if [ -f /etc/smbpasswd -a ! -f /etc/samba/smbpasswd ]; then
- echo "Moving old /etc/smbpasswd to /etc/samba/smbpasswd"
- mv /etc/smbpasswd /etc/samba/smbpasswd
-fi
-
-#
-# For 2.2.1 we move the tdb files from /var/lock/samba to /var/cache/samba
-# to preserve across reboots.
-#
-echo "Moving tdb files in /var/lock/samba/*.tdb to /var/cache/samba/*.tdb"
-for i in /var/lock/samba/*.tdb
-do
-if [ -f $i ]; then
- newname=`echo $i | sed -e's|var\/lock\/samba|var\/cache\/samba|'`
- echo "Moving $i to $newname"
- mv $i $newname
-fi
-done
+##
+## we only have to wory about this if we are upgrading
+##
+if [ "$1" -eq "2" ]; then
+ if [ -f /etc/smb.conf -a ! -f /etc/samba/smb.conf ]; then
+ echo "Moving old /etc/smb.conf to /etc/samba/smb.conf"
+ mv /etc/smb.conf /etc/samba/smb.conf
+ fi
-# Remove the transient tdb files.
-if [ -e /var/cache/samba/brlock.tdb ]; then
- rm -f /var/cache/samba/brlock.tdb
-fi
+ if [ -f /etc/smbusers -a ! -f /etc/samba/smbusers ]; then
+ echo "Moving old /etc/smbusers to /etc/samba/smbusers"
+ mv /etc/smbusers /etc/samba/smbusers
+ fi
-if [ -e /var/cache/samba/unexpected.tdb ]; then
- rm -f /var/cache/samba/unexpected.tdb
-fi
+ if [ -f /etc/lmhosts -a ! -f /etc/samba/lmhosts ]; then
+ echo "Moving old /etc/lmhosts to /etc/samba/lmhosts"
+ mv /etc/lmhosts /etc/samba/lmhosts
+ fi
-if [ -e /var/cache/samba/connections.tdb ]; then
- rm -f /var/cache/samba/connections.tdb
-fi
+ if [ -f /etc/MACHINE.SID -a ! -f /etc/samba/MACHINE.SID ]; then
+ echo "Moving old /etc/MACHINE.SID to /etc/samba/MACHINE.SID"
+ mv /etc/MACHINE.SID /etc/samba/MACHINE.SID
+ fi
-if [ -e /var/cache/samba/locking.tdb ]; then
- rm -f /var/cache/samba/locking.tdb
-fi
+ if [ -f /etc/smbpasswd -a ! -f /etc/samba/smbpasswd ]; then
+ echo "Moving old /etc/smbpasswd to /etc/samba/smbpasswd"
+ mv /etc/smbpasswd /etc/samba/smbpasswd
+ fi
-if [ -e /var/cache/samba/messages.tdb ]; then
- rm -f /var/cache/samba/messages.tdb
+ #
+ # For 2.2.1 we move the tdb files from /var/lock/samba to /var/cache/samba
+ # to preserve across reboots.
+ #
+ for i in /var/lock/samba/*.tdb; do
+ if [ -f $i ]; then
+ newname="/var/lib/samba/`basename $i`"
+ echo "Moving $i to $newname"
+ mv $i $newname
+ fi
+ done
+
+ #
+ # For 3.0.1 we move the tdb files from /var/cache/samba to /var/lib/samba
+ #
+ echo "Moving tdb files in /var/cache/samba/*.tdb to /var/lib/samba/*.tdb"
+ for i in /var/cache/samba/*.tdb; do
+ if [ -f $i ]; then
+ newname="/var/lib/samba/`basename $i`"
+ echo "Moving $i to $newname"
+ mv $i $newname
+ fi
+ done
fi
-if [ -d /var/lock/samba ]; then
- rm -rf /var/lock/samba
-fi
+##
+## New things
+##
# Add swat entry to /etc/services if not already there.
-if !( grep ^[:space:]*swat /etc/services > /dev/null ) then
+if [ ! "`grep ^\s**swat /etc/services`" ]; then
echo 'swat 901/tcp # Add swat service used via inetd' >> /etc/services
fi
# Add swat entry to /etc/inetd.conf if needed.
if [ -f /etc/inetd.conf ]; then
- if !( grep ^[:space:]*swat /etc/inetd.conf > /dev/null ) then
+ if [ ! "`grep ^\s*swat /etc/inetd.conf`" ]; then
echo 'swat stream tcp nowait.400 root %{prefix}/sbin/swat swat' >> /etc/inetd.conf
- killall -1 inetd || :
+ killall -HUP inetd || :
fi
fi
# Add swat entry to xinetd.d if needed.
-if [ -d $RPM_BUILD_ROOT/etc/xinetd.d -a ! -f /etc/xinetd.d/swat ]; then
+if [ -d /etc/xinetd.d -a ! -f /etc/xinetd.d/swat ]; then
mv /etc/samba/samba.xinetd /etc/xinetd.d/swat
else
rm -f /etc/samba/samba.xinetd
fi
-# Install the correct version of the samba pam file, depending on pam version.
+# Install the correct version of the samba pam file
if [ -f /lib/security/pam_stack.so ]; then
echo "Installing stack version of /etc/pam.d/samba..."
mv /etc/samba/samba.stack /etc/pam.d/samba
@@ -305,77 +308,75 @@ fi
/sbin/ldconfig
%preun
-if [ $1 = 0 ] ; then
+if [ "$1" -eq "0" ] ; then
/sbin/chkconfig --del smb
/sbin/chkconfig --del winbind
- # We want to remove the browse.dat and wins.dat files so they can not interfer with a new version of samba!
- if [ -e /var/cache/samba/browse.dat ]; then
- rm -f /var/cache/samba/browse.dat
+ # We want to remove the browse.dat and wins.dat files
+ # so they can not interfer with a new version of samba!
+ if [ -e /var/lib/samba/browse.dat ]; then
+ rm -f /var/lib/samba/browse.dat
fi
- if [ -e /var/cache/samba/wins.dat ]; then
- rm -f /var/cache/samba/wins.dat
+ if [ -e /var/lib/samba/wins.dat ]; then
+ rm -f /var/lib/samba/wins.dat
fi
# Remove the transient tdb files.
- if [ -e /var/cache/samba/brlock.tdb ]; then
- rm -f /var/cache/samba/brlock.tdb
- fi
-
- if [ -e /var/cache/samba/unexpected.tdb ]; then
- rm -f /var/cache/samba/unexpected.tdb
+ if [ -e /var/lib/samba/brlock.tdb ]; then
+ rm -f /var/lib/samba/brlock.tdb
fi
- if [ -e /var/cache/samba/connections.tdb ]; then
- rm -f /var/cache/samba/connections.tdb
+ if [ -e /var/lib/samba/unexpected.tdb ]; then
+ rm -f /var/lib/samba/unexpected.tdb
fi
- if [ -e /var/cache/samba/locking.tdb ]; then
- rm -f /var/cache/samba/locking.tdb
+ if [ -e /var/lib/samba/connections.tdb ]; then
+ rm -f /var/lib/samba/connections.tdb
fi
- if [ -e /var/cache/samba/messages.tdb ]; then
- rm -f /var/cache/samba/messages.tdb
+ if [ -e /var/lib/samba/locking.tdb ]; then
+ rm -f /var/lib/samba/locking.tdb
fi
- # Remove winbind nss client symlink
-
- if [ -L /lib/libnss_winbind.so.2 ]; then
- rm -f /lib/libnss_winbind.so.2
+ if [ -e /var/lib/samba/messages.tdb ]; then
+ rm -f /var/lib/samba/messages.tdb
fi
fi
%postun
# Only delete remnants of samba if this is the final deletion.
-if [ $1 = 0 ] ; then
+if [ "$1" -eq "0" ] ; then
if [ -x /etc/pam.d/samba ]; then
rm -f /etc/pam.d/samba
fi
+
if [ -e /var/log/samba ]; then
rm -rf /var/log/samba
fi
- if [ -e /var/cache/samba ]; then
- rm -rf /var/cache/samba
- fi
+
+ if [ -e /var/lib/samba ]; then
+ rm -rf /var/lib/samba
+ fi
# Remove swat entries from /etc/inetd.conf and /etc/services
cd /etc
tmpfile=/etc/tmp.$$
- if [ -f /etc/inetd.conf ]; then
+ if [ -f /etc/inetd.conf ]; then
# preserve inetd.conf permissions.
cp -p /etc/inetd.conf $tmpfile
sed -e '/^[:space:]*swat.*$/d' /etc/inetd.conf > $tmpfile
mv $tmpfile inetd.conf
- fi
+ fi
+
# preserve services permissions.
cp -p /etc/services $tmpfile
sed -e '/^[:space:]*swat.*$/d' /etc/services > $tmpfile
mv $tmpfile /etc/services
- # Remove swat entry from /etc/xinetd.d
- if [ -f /etc/xinetd.d/swat ]; then
- rm -r /etc/xinetd.d/swat
- fi
+ # Remove swat entry from /etc/xinetd.d
+ if [ -f /etc/xinetd.d/swat ]; then
+ rm -r /etc/xinetd.d/swat
+ fi
fi
/sbin/ldconfig
@@ -447,7 +448,7 @@ MANDIR_MACRO/man1/*
MANDIR_MACRO/man5/*
MANDIR_MACRO/man7/*
MANDIR_MACRO/man8/*
-%attr(755,root,root) %dir /var/cache/samba
+%attr(755,root,root) %dir /var/lib/samba
%dir /var/log/samba
%dir /var/run/samba
%attr(1777,root,root) %dir /var/spool/samba