Sophie

Sophie

distrib > Mageia > 5 > x86_64 > media > nonfree-updates > by-pkgid > ebc2d97e9acc7ea0390f702ebdb13b2f > scriptlet

x11-driver-video-fglrx-15.302-4.mga5.nonfree.x86_64.rpm

PREIN

/bin/sh
# Handle alternatives-era /etc/ati directory
# It may confuse rpm due to it containing %config files
if [ -L /etc/ati ]; then
	rm /etc/ati
fi

PREUN

/bin/sh
/usr/share/rpm-helper/del-service fglrx $1 atieventsd

POSTIN

/bin/sh
# Migrate from pre-alternatives files
if [ ! -L /usr/share/applications/mandriva-amdcccle.desktop -a -e /usr/share/applications/mandriva-amdcccle.desktop ]; then
	rm -f /usr/share/applications/mandriva-amdcccle.desktop
fi

/usr/sbin/update-alternatives \
	--install /etc/ld.so.conf.d/GL.conf gl_conf /etc/ld.so.conf.d/GL/ati.conf 1000 \
	--slave /etc/X11/XvMCConfig xvmcconfig /etc/fglrx/XvMCConfig \
	--slave /usr/lib64/libAMDXvBA.cap lib64AMDXvBA_cap /usr/lib64/fglrx/libAMDXvBA.cap \
	--slave /usr/lib/libAMDXvBA.cap libAMDXvBA_cap /usr/lib64/fglrx/libAMDXvBA.cap \
	--slave /usr/lib64/xorg/extra-modules xorg_extra_modules /usr/lib64/fglrx/xorg

# Alternative for PowerXpress intel (switchable graphics)
# This is a separate alternative so that this situation can be differentiated
# from standard intel configuration by tools (e.g. so that radeon driver won't
# be loaded despite fglrx not being configured anymore).
/usr/sbin/update-alternatives \
	--install /etc/ld.so.conf.d/GL.conf gl_conf /etc/fglrx/pxpress-free.ld.so.conf 50

if [ "$(readlink -e /etc/ld.so.conf.d/GL.conf)" = "/etc/ld.so.conf.d/GL/ati-hd2000.conf" ]; then
	# Switch from the obsolete hd2000 branch:
	/usr/sbin/update-alternatives --set gl_conf /etc/ld.so.conf.d/GL/ati.conf
fi
# When upgrading from alternatives setup, rpm may consider /etc/ati/atiogl.xml
# to exist due to the symlink, even when we remove it in %pre:
if [ -e /etc/ati/atiogl.xml.rpmnew -a ! -e /etc/ati/atiogl.xml ]; then
	mv /etc/ati/atiogl.xml.rpmnew /etc/ati/atiogl.xml
	echo "Moved /etc/ati/atiogl.xml.rpmnew back to /etc/ati/atiogl.xml."
fi

# Call /sbin/ldconfig explicitely due to alternatives
/sbin/ldconfig -X
/usr/share/rpm-helper/add-service fglrx $1 atieventsd 


# Ghost file created as suggested by AMD.
touch /etc/ati/atiapfuser.blb

# Clear driver version numbers from amdpcsdb as suggested by AMD.
# (fixes version display in amdcccle after upgrade)
amdconfig --del-pcs-key=LDC,ReleaseVersion &>/dev/null || :
amdconfig --del-pcs-key=LDC,Catalyst_Version &>/dev/null || :

POSTUN

/bin/sh
if [ ! -f /etc/ld.so.conf.d/GL/ati.conf ]; then
  /usr/sbin/update-alternatives --remove gl_conf /etc/ld.so.conf.d/GL/ati.conf
fi
if [ ! -f /etc/fglrx/pxpress-free.ld.so.conf ]; then
  /usr/sbin/update-alternatives --remove gl_conf /etc/fglrx/pxpress-free.ld.so.conf
fi
# Call /sbin/ldconfig explicitely due to alternatives
/sbin/ldconfig -X

POSTTRANS

/bin/sh
# RPM seems to leave out the active /etc/fglrx* directory, likely due to
# it being confused with the /etc/ati symlink. We have to clean up ourself:
for dir in /etc/fglrx /etc/fglrx-hd2000; do
	if [ -d $dir ]; then
		for file in $dir/*; do
			case "$(basename $file)" in
			control | signature | logo_mask.xbm.example | logo.xbm.example)
				# non-config files, rpm would normally remove
				rm $file;;
			authatieventsd.sh | fglrxprofiles.csv | fglrxrc | atiogl.xml)
				# config files, check for modifications
				case "$(stat -c%s $file)" in
				545 | 838 | 2769 | 10224 | 11018)
					rm $file;;
				*)
					echo "Saving $file as /etc/ati/$(basename $file).rpmsave."
					mv $file /etc/ati/$(basename $file).rpmsave;;
				esac
				;;
			esac
		done
		[ $(ls -c $dir | wc -l) -eq 0 ] && rm -r $dir
	fi
done
true