#!/bin/sh set -e USER_TO_RUN_UNOPKG="root" AUX_SUDO_USER=$SUDO_USER SUDO_USER=$USER_TO_RUN_UNOPKG VERSION_WHICH_FIX_IT="4.4.13~rc6" case $1 in configure) echo " [ Salt LibreOffice ] : Testing if your libreoffice installation can be damaged" rc=0 dpkg --compare-versions $2 lt ${VERSION_WHICH_FIX_IT} || rc=1 # Quitar esta linea si hace falta rc=1 if [ ${rc} -eq 0 ] ; then echo " [ Salt Libreoffice addons may be broken ] ... Fixing it!" find /home/ -wholename "*.config/libreoffice" -xtype d -exec rm -rf {} \; || true else echo " [ Your installation seems to be correct ]" fi echo " [ Salt LibreOffice ] : Removing old salt plugins" echo " * The user is : $SUDO_USER" su $USER_TO_RUN_UNOPKG -c "unopkg remove --shared org.openoffice.Office.addon.salt.trad 1>/dev/null 2>/dev/null" || echo " * Already uninstalled: org.openoffice.Office.addon.salt.trad" su $USER_TO_RUN_UNOPKG -c "unopkg remove --shared org.openoffice.Office.addon.salt.util 1>/dev/null 2>/dev/null" || echo " * Already uninstalled: org.openoffice.Office.addon.salt.util" echo " [ Salt LibreOffice ] : Installing new libreoffice salt addon" su $USER_TO_RUN_UNOPKG -c "unopkg add -v --shared /usr/share/salt-libreoffice-addons/saltutil.oxt" 1>/dev/null 2>/dev/null || echo " * Something happens with : /usr/share/salt-libreoffice-addons/saltutil.oxt" su $USER_TO_RUN_UNOPKG -c "unopkg add -v --shared /usr/share/salt-libreoffice-addons/salttrad.oxt" 1>/dev/null 2>/dev/null || echo " * Something happens with : /usr/share/salt-libreoffice-addons/salttrad.oxt" echo " * Remember open-close libreoffice at the first time" ;; *) echo " [ Salt LibreOffice ] : Nothing to do" ;; esac SUDO_USER=$AUX_SUDO_USER #DEBHELPER#