#!/bin/awk -f # RPM filetriggers handler for OpenOffice.org extensions BEGIN { # look up the identifiers of currently installed extensions while ("@UNOPKG@ list --shared" | getline) { if (/^Identifier:/) cur_ident = $2 else if (/^ URL:/) { sub("^.*/","") ident[$0] = cur_ident } } FS="/" } /^\+/ { # installation or upgrade if (ident[$NF]) removals[$NF]=1 sub("^\\+","") installs[$0]=1 } (/^-/ && ident[$NF]) { # removal or upgrade removals[$NF]=1 clean_cache=1 } END { for (extension in removals) system("@UNOPKG@ remove --shared " ident[extension] "&>/dev/null") if (clean_cache) system("@UNOPKG@ list --shared &>/dev/null") for (extension in installs) system("@UNOPKG@ add --shared " extension "&>/dev/null") }