Sophie

Sophie

distrib > Mandriva > 9.0 > x86_64 > media > main > by-pkgid > c64dca6fdad4c7162fbcdc5723e8c77a > scriptlet

samba-common-2.2.7a-10mdk.x86_64.rpm

PREUN

/bin/sh

if [ $1 = 0 ] ; then
    for n in /etc/samba/codepages/*; do
        if [ "$n" != "/etc/samba/codepages/src" ]; then
            rm -rf $n
        fi
    done
fi

POSTIN

/bin/sh
# Basic migration script for pre-2.2.1 users,
# since smb config moved from /etc to /etc/samba

mkdir -p /etc/samba
for s in smb.conf smbusers smbpasswd printers.def secrets.tdb lmhosts; do
[ -f /etc/$s ] && {
        cp -f /etc/$s /etc/$s.OLD
        mv -f /etc/$s /etc/samba/
}
done

# Migrate tdb's from /var/lock/samba (taken from official samba spec file):
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 (modified from version in off. samba spec:
for TDB in brlock unexpected locking messages; do
        if [ -e /var/cache/samba/$TDB.tdb ]; then
                rm -f /var/cache/samba/$TDB.tdb;
        fi;
done

if [ -d /var/lock/samba ]; then
        rm -rf /var/lock/samba
fi
# Make a symlink on /usr/lib/smbwrapper.so in /usr/bin
# to fix smbsh problem (another way to do that, anyone???)

ln -sf /usr/lib64/smbwrapper.so /usr/bin/smbwrapper.so

# Let's create a proper /etc/samba/smbpasswd file
[ -f /etc/samba/smbpasswd ] || {
	echo "Creating password file for samba..."
	touch /etc/samba/smbpasswd
}

# And this too, in case we don't have smbd to create it for us
[ -f /var/cache/samba/unexpected.tdb ] || {
	touch /var/cache/samba/unexpected.tdb
}

# Let's define the proper paths for config files
perl -pi -e 's/(\/etc\/)(smb)/\1samba\/\2/' /etc/samba/smb.conf

# Let's replace lpstat with cups in older smb.conf:
echo "Updating samba printing configuration if necessary..."
perl -pi -e 's/= lpstat/= cups/' /etc/samba/smb.conf

# Fix the logrotate.d file from smb and nmb to smbd and nmbd
if [ -f /etc/logrotate.d/samba ]; then
        perl -pi -e 's/smb /smbd /' /etc/logrotate.d/samba
        perl -pi -e 's/nmb /nmbd /' /etc/logrotate.d/samba
fi

# And not loose our machine account SID
[ -f /etc/MACHINE.SID ] && mv -f /etc/MACHINE.SID /etc/samba/ ||: