POSTIN
/bin/sh
# Basic migration script for pre-2.2.1 users,
# since smb config moved from /etc to /etc/samba
# Let's create a proper /etc/samba/smbpasswd file
[ -f /etc/samba3/smbpasswd ] || {
echo "Creating password file for samba..."
touch /etc/samba3/smbpasswd
}
# And this too, in case we don't have smbd to create it for us
[ -f /var/cache/samba3/unexpected.tdb ] || {
touch /var/cache/samba3/unexpected.tdb
}
# Let's define the proper paths for config files
perl -pi -e 's/(\/etc\/)(smb)/\1samba3\/\2/' /etc/samba3/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/samba3/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/samba3/ ||: