Sophie

Sophie

distrib > Mandriva > 10.0 > i586 > media > main > by-pkgid > f44ba104888e348e60d983eea33154b5 > scriptlet

samba-common-3.0.2a-3mdk.i586.rpm

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/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

# 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/ ||:

POSTUN

/bin/sh
if [ -f /etc/samba/README.mdk.conf ];then rm -f /etc/samba/README.mdk.conf;fi

Triggers

samba-common < 3.0.1-3mdk

/bin/sh
# (sb) merge any existing smb.conf with new syntax file
if [ $1 = 2 ]; then
	# (sb) save existing smb.conf for merge
	echo "Upgrade: copy smb.conf to smb.conf.tomerge for merging..."
	cp -f /etc/samba/smb.conf /etc/samba/smb.conf.tomerge
	echo "Upgrade: merging previous smb.conf..."
	if [ -f /usr/share/samba/smb.conf.clean ]; then
		cp /usr/share/samba/smb.conf.clean /etc/samba/smb.conf
		cp /usr/share/samba/README.mdk.conf /etc/samba/
		/usr/share/samba/scripts/smb-migrate commit
	fi
fi