Sophie

Sophie

distrib > Mandriva > current > x86_64 > media > main-release > by-pkgid > a287f4b68d3f73cb0418c9985648abad > scriptlet

samba4-common-4.0.0-0.5.alpha11mdv2010.1.x86_64.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/samba4/smbpasswd ] || {
	echo "Creating password file for samba..."
	touch /etc/samba4/smbpasswd
}

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

# Let's define the proper paths for config files
perl -pi -e 's/(\/etc\/)(smb)/\1samba4\/\2/' /etc/samba4/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/samba4/ ||:

POSTUN

/bin/sh
if [ -f /etc/samba4/README.mdk.conf ];then rm -f /etc/samba4/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/samba4/smb.conf /etc/samba4/smb.conf.tomerge
	echo "Upgrade: merging previous smb.conf..."
	if [ -f /usr/share/samba4/smb.conf.clean ]; then
		cp /usr/share/samba4/smb.conf.clean /etc/samba4/smb.conf
		cp /usr/share/samba4/README.mdk.conf /etc/samba4/
		/usr/share/samba4/scripts/smb-migrate commit
	fi
fi