Sophie

Sophie

distrib > Mandriva > current > x86_64 > by-pkgid > 4e3692b19ed9cf0e380a5b27bdef2dad > scriptlet

openoffice.org-voikko-3.1-4mdv2010.1.x86_64.rpm

PREIN

/bin/sh
if ! [ -x /usr/lib64/ooo/program/unopkg ]; then
	echo "ERROR: Compatible version of OpenOffice.org is not installed, aborting the"
	echo "       installation or upgrade of openoffice.org-voikko!"
	exit 1
fi

# (anssi) Map of triggercity:
# Note that installation of voikko implies automatic uninstallation of old
# versions for the compatible instance of openoffice.org.
# Upgrade of openoffice.org-voikko:
# - TRIGGERUN of old version is run, but $1 = 1 and $2 = 1, thus no action is
#   taken
# - POSTTRANS of new version installs new version
# Upgrade of openoffice.org to a compatible version:
# - TRIGGERUN is run, but $1 = 1 and $2 = 1, thus no action is taken
# Upgrade of openoffice.org and openoffice.org-voikko to a compatible version:
# - TRIGGERUN of old version is run, but $1 = 1 and $2 = 1, thus no action is
#   taken
# - TRIGGERUN of old version is run again, but $1 = 1 and $2 = 1, thus no
#   action is taken
# - POSTTRANS of new version installs new version
# Upgrade of openoffice.org and openoffice.org-voikko to an incompatible
# version:
# - TRIGGERIN of old version removes old version
# - TRIGGERUN of old version is run, but $1 = 1 and $2 = 1, thus no action is
#   taken
# - openoffice.org files are replaced with new versions
# - POSTTRANS of new version installs new version
# Upgrade of openoffice.org to an incompatible version, with
# openoffice.org-voikko being removed:
# - TRIGGERIN removes voikko
# - TRIGGERUN is run, but $1 = 1 and $2 = 1, thus no action is taken
# - openoffice.org files are replaced with new versions
# Downgrade of openoffice.org-voikko:
# - TRIGGERUN of new version is run, but $1 = 1 and $2 = 1, thus no action is
#   taken
# - POSTTRANS of old version installs old version
# Removal of openoffice.org-voikko:
# - TRIGGERUN removes voikko as $1 = 0 and $2 = 1
# Removal of openoffice.org and openoffice.org-voikko
# - TRIGGERUN removes voikko as $1 = 1 and $2 = 0
# - openoffice.org files are removed
#

# Posttrans is used instead of post to allow upgrade from old
# openoffice.org-voikko with preun that would remove the new version installed
# in post, without adding triggers for that.

POSTTRANS

/bin/sh
if [ -x /usr/lib64/ooo/program/unopkg ]; then
	# unopkg writes into $HOME
	TMP_HOME=$(mktemp -t -d openoffice.org-voikko.XXXXXX) || exit 1
	export HOME=$TMP_HOME
	# make sure no other version is installed
	for pkg in $(/usr/lib64/ooo/program/unopkg list --shared 2>/dev/null | sed -ne 's/^Identifier: \(org.puimula.ooovoikko\)/\1/p'); do
		/usr/lib64/ooo/program/unopkg remove --shared $pkg
	# empty line due to macro expansion
	done
	/usr/lib64/ooo/program/unopkg add --shared /usr/lib64/openoffice.org-voikko/voikko.oxt
	rm -rf $TMP_HOME
fi

Triggers

openoffice.org-common = 1:3.2

/bin/sh
# Preun script cannot be used for this as rpm doesn't honor Requires(preun),
# but just removes OOo before preun would be run.
# Executed just before OOo or voikko is being completely removed. Does not run
# on normal upgrades.
if [ $1 -eq 0 ] || [ $2 -eq 0 ]; then
	if [ -x /usr/lib64/ooo/program/unopkg ]; then
		# unopkg writes into $HOME
		TMP_HOME=$(mktemp -t -d openoffice.org-voikko.XXXXXX) || exit 1
		export HOME=$TMP_HOME
		/usr/lib64/ooo/program/unopkg remove --shared org.puimula.ooovoikko
		# get rid of cache:
		/usr/lib64/ooo/program/unopkg list --shared &>/dev/null
		rm -rf $TMP_HOME
	fi
fi
true

openoffice.org-common > 1:3.2

/bin/sh
# Executed just before OOo is being upgraded to an incompatible version.
# Cannot be in preun for the same reason as above triggerun.
if [ -x /usr/lib64/ooo/program/unopkg ]; then
	# unopkg writes into $HOME
	TMP_HOME=$(mktemp -t -d openoffice.org-voikko.XXXXXX) || exit 1
	export HOME=$TMP_HOME
	/usr/lib64/ooo/program/unopkg remove --shared org.puimula.ooovoikko
	# get rid of cache:
	/usr/lib64/ooo/program/unopkg list --shared &>/dev/null
	rm -rf $TMP_HOME
fi