1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00

a few cleanups in output from spec file

(This used to be commit 757b8a3405)
This commit is contained in:
Gerald Carter 2003-10-10 17:57:53 +00:00
parent fec4b31bc1
commit ea2be3871c

View File

@ -196,6 +196,9 @@ find $RPM_BUILD_ROOT -name "*.old" -exec rm -f {} \;
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,31 +206,30 @@ if [ "$1" -eq "1" ]; then
/sbin/chkconfig winbind off
fi
echo "Looking for old /etc/smb.conf..."
##
## 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
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
@ -237,9 +239,7 @@ 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
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"
@ -271,28 +271,35 @@ fi
if [ -d /var/lock/samba ]; then
rm -rf /var/lock/samba
fi
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.
# (always keep an existing PAM config file)
if [ ! -f /etc/pam.d/samba ]; then
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
@ -300,16 +307,18 @@ else
echo "Installing non-stack version of /etc/pam.d/samba..."
rm -f /etc/samba/samba.stack
fi
fi
## call ldconfig to create the version symlink for libsmbclient.so
/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!
# 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
fi
@ -337,23 +346,19 @@ if [ $1 = 0 ] ; then
if [ -e /var/cache/samba/messages.tdb ]; then
rm -f /var/cache/samba/messages.tdb
fi
# Remove winbind nss client symlink
if [ -L /lib/libnss_winbind.so.2 ]; then
rm -f /lib/libnss_winbind.so.2
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
@ -367,6 +372,7 @@ if [ $1 = 0 ] ; then
sed -e '/^[:space:]*swat.*$/d' /etc/inetd.conf > $tmpfile
mv $tmpfile inetd.conf
fi
# preserve services permissions.
cp -p /etc/services $tmpfile
sed -e '/^[:space:]*swat.*$/d' /etc/services > $tmpfile