#!/bin/sh # prerm script for salt-ooo-addons # # see: dh_installdeb(1) set -e # summary of how this script can be called: # * `remove' # * `upgrade' # * `failed-upgrade' # * `remove' `in-favour' # * `deconfigure' `in-favour' # `removing' # # for details, see http://www.debian.org/doc/debian-policy/ or # the debian-policy package clean_old_salts() { FILES_TO_FURGATE="salt.zip saltutil.zip" DIRECTORY_IS="/var/spool/libreoffice/uno_packages/cache/uno_packages/" # Workaround to solve some upgrade problems # test if directory exists and contains some files. if [ -d "$DIRECTORY_IS" ] ; then # If the files and directory exists: for f in $FILES_TO_FURGATE ; do AUX=$(find $DIRECTORY_IS -xtype d -name "$f") if [ -n "$AUX" ] ; then DIRTY_FILE="$(dirname "$AUX" | sed "s%_$%%")" rm -rf "$DIRTY_FILE" "$(dirname "$AUX"/)" fi echo "$f is cleaning" done fi } case "$1" in remove|upgrade|deconfigure) echo "Prerm nuevo $1" clean_old_salts /usr/lib/libreoffice/program/unopkg remove -v --shared salt.zip|| true /usr/lib/libreoffice/program/unopkg remove -v --shared saltutil.zip || true ;; failed-upgrade) echo "Prerm failed upgrade" clean_old_salts /usr/lib/libreoffice/program/unopkg remove -v --shared salt.zip|| true /usr/lib/libreoffice/program/unopkg remove -v --shared saltutil.zip || true ;; *) echo "prerm called with unknown argument \`$1'" >&2 exit 1 ;; esac # dh_installdeb will replace this with shell code automatically # generated by other debhelper scripts. #DEBHELPER# exit 0