diff options
Diffstat (limited to 'packaging')
-rw-r--r-- | packaging/RedHat/samba.spec.tmpl | 174 |
1 files changed, 90 insertions, 84 deletions
diff --git a/packaging/RedHat/samba.spec.tmpl b/packaging/RedHat/samba.spec.tmpl index ee0b43c017..7afb30bb31 100644 --- a/packaging/RedHat/samba.spec.tmpl +++ b/packaging/RedHat/samba.spec.tmpl @@ -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,113 +206,119 @@ 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 +## +## 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 + 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 + 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 + 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 + 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 + # + # 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=`echo $i | sed -e's|var\/lock\/samba|var\/cache\/samba|'` + echo "Moving $i to $newname" + mv $i $newname + fi + done -# Remove the transient tdb files. -if [ -e /var/cache/samba/brlock.tdb ]; then - rm -f /var/cache/samba/brlock.tdb -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 -fi + if [ -e /var/cache/samba/unexpected.tdb ]; then + rm -f /var/cache/samba/unexpected.tdb + fi -if [ -e /var/cache/samba/connections.tdb ]; then - rm -f /var/cache/samba/connections.tdb -fi + if [ -e /var/cache/samba/connections.tdb ]; then + rm -f /var/cache/samba/connections.tdb + fi -if [ -e /var/cache/samba/locking.tdb ]; then - rm -f /var/cache/samba/locking.tdb -fi + if [ -e /var/cache/samba/locking.tdb ]; then + rm -f /var/cache/samba/locking.tdb + fi -if [ -e /var/cache/samba/messages.tdb ]; then - rm -f /var/cache/samba/messages.tdb -fi + if [ -e /var/cache/samba/messages.tdb ]; then + rm -f /var/cache/samba/messages.tdb + fi -if [ -d /var/lock/samba ]; then - rm -rf /var/lock/samba + 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. -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 -else - echo "Installing non-stack version of /etc/pam.d/samba..." - rm -f /etc/samba/samba.stack +# (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 + 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,45 +346,42 @@ 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 + + if [ -e /var/cache/samba ]; then + rm -rf /var/cache/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 |