[voikko] fedora 7

Anssi Hannula anssi at mandriva.org
Sat Jul 21 21:53:45 EEST 2007


Sami Vento wrote:
> Tällähetkellä ei taida olla paljoa vaihtoehtoja, kuin tehdä openofficen 
> paketille triggeri openoffice-voikko -pakettiin. kun openofficen pakettia 
> asennetaan/päivitetään/poistetaan, niin voikko-paketti ajaisi jonkin 
> scriptin, joka tarkistaa, löytyykö unopkg vai ei. jollei, niin oletetaan, 
> että openoffice on poistettu. jos löytyy, niin sitten tarkistettaisiin, 
> löytyykö openoffice-voikko -lisäosaa. jos ei, niin asennetaan. Jos löytyy, 
> niin homma on kunnossa..

Tälläinen trigger-"ratkaisu" löytyy Mandrivan paketista:

> %pre %binpkg
> if ! [ -x %unopkg ]; then
> 	echo "ERROR: Compatible version of OpenOffice.org is not installed, aborting the"
> 	echo "       installation or upgrade of %{binname}!"
> 	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 %binpkg
> if [ -x %unopkg ]; then
> 	# make sure no other version is installed
> 	for pkg in $(%unopkg list --shared 2>/dev/null | sed -ne 's/^Name: \(oo2-voikko.*\|openoffice.org-voikko.*\|voikko.oxt\)/\1/p'); do
> 		%unopkg remove --shared $pkg
> 	done
> 	%unopkg add --shared %{_libdir}/%{binname}/%{unopkgname}
> fi
> 
> %triggerun %binpkg -- %ooname = %ooo_version
> # 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 %unopkg ]; then
> 		%unopkg remove --shared %{unopkgname} || true
> 	fi
> fi
> true
> 
> %triggerin %binpkg -- %ooname > %ooo_version
> # Executed just before OOo is being upgraded to an incompatible version.
> # Cannot be in preun for the same reason as above triggerun.
> if [ -x %unopkg ]; then
> 	%unopkg remove --shared %{unopkgname} || true
> fi

-- 
Anssi Hannula




More information about the voikko mailing list