Followup-For: Bug #679717

Hi,

unopkg can be really nasty :-) The HOME=$INSTDIR workaround requires the
$INSTDIR to actually exist, otherwise it will fall back to /root and
create the libreoffice/3 tree there ...

I'm attaching a patch that unifies and simplifies the creation and
removal of $INSTDIR in all three maintainer scripts. Previously there
was a possibility to create/remove INSTDIR several times per script,
leaving tempdirs behind or running unopkg without existing HOME=$INSTDIR.
Now the package nearly passes the piuparts test.

But there is still an unowned file being left after purge:

0m40.6s ERROR: FAIL: Package purging left files on system:
  /usr/lib/ure/share/config/     not owned
  /usr/lib/ure/share/config/javasettingsunopkginstall.xml        not owned

which is probably a different issue.

Andreas

Attachment: accessodf_0.1-1.3.log.gz
Description: GNU Zip compressed data

diffstat for accessodf-0.1 accessodf-0.1

 changelog |   12 +++++++++++-
 postinst  |    6 +++---
 preinst   |    6 ++----
 prerm     |    4 ++--
 4 files changed, 18 insertions(+), 10 deletions(-)

diff -Nru accessodf-0.1/debian/changelog accessodf-0.1/debian/changelog
--- accessodf-0.1/debian/changelog	2012-11-02 12:33:21.000000000 +0100
+++ accessodf-0.1/debian/changelog	2013-01-16 05:57:15.000000000 +0100
@@ -1,8 +1,18 @@
+accessodf (0.1-1.4) unstable; urgency=low
+
+  * Non-maintainer upload.
+  * {pre,post}inst, prerm: Simplify and unify the creation and removal of
+    $INSTDIR. The temporary HOME=$INSTDIR needs to exist otherwise unopkg will
+    fall back to /root/ and create a libreoffice/3/ hierarchy there.
+    (Closes: #679717)
+
+ -- Andreas Beckmann <deb...@abeckmann.de>  Wed, 16 Jan 2013 05:57:15 +0100
+
 accessodf (0.1-1.3) unstable; urgency=low
 
   * Non-maintainer upload.
   * oops, forgot a unopkg in preinst, thanks Andreas Beckmann
-    (closes: #679717) 
+    (closes: #679717)
 
  -- Rene Engelhard <r...@rene-engelhard.de>  Fri, 02 Nov 2012 12:32:50 +0100
 
diff -Nru accessodf-0.1/debian/postinst accessodf-0.1/debian/postinst
--- accessodf-0.1/debian/postinst	2012-10-23 19:53:33.000000000 +0200
+++ accessodf-0.1/debian/postinst	2013-01-16 05:52:25.000000000 +0100
@@ -9,17 +9,17 @@
 
 add_extension() {
     echo -n "Adding extension $1..."
-    INSTDIR=`mktemp -d`
     HOME=$INSTDIR unopkg add --shared $1 \
         "-env:UserInstallation=file:///$INSTDIR" \
         '-env:UNO_JAVA_JFW_INSTALL_DATA=$ORIGIN/../share/config/javasettingsunopkginstall.xml' \
         "-env:JFW_PLUGIN_DO_NOT_CHECK_ACCESSIBILITY=1"
-    if [ -n $INSTDIR ]; then rm -rf $INSTDIR; fi
     echo " done."
 }
 
-if [ "$1" = "configure" -o "$1" = "upgrade" ]; then
+if [ "$1" = "configure" ]; then
+    INSTDIR=`mktemp -d`
     add_extension /usr/share/accessodf/AccessODF.oxt
+    rm -rf $INSTDIR
 fi
 
 #DEBHELPER#
diff -Nru accessodf-0.1/debian/preinst accessodf-0.1/debian/preinst
--- accessodf-0.1/debian/preinst	2012-11-02 12:32:32.000000000 +0100
+++ accessodf-0.1/debian/preinst	2013-01-16 05:52:26.000000000 +0100
@@ -7,19 +7,16 @@
 set -e
 
 flush_unopkg_cache() {
-	INSTDIR=`mktemp -d`
         HOME=$INSTDIR unopkg list --shared "-env:JFW_PLUGIN_DO_NOT_CHECK_ACCESSIBILITY=1" > /dev/null 2>&1
 }
 
 remove_extension() {
-  INSTDIR=`mktemp -d`
   if HOME=$INSTDIR unopkg list --shared $1 >/dev/null; then
     echo -n "Removing extension $1..."
     HOME=$INSTDIR unopkg remove --shared $1 \
       "-env:UserInstallation=file://$INSTDIR" \
       '-env:UNO_JAVA_JFW_INSTALL_DATA=$ORIGIN/../share/config/javasettingsunopkginstall.xml' \
       "-env:JFW_PLUGIN_DO_NOT_CHECK_ACCESSIBILITY=1"
-    if [ -n $INSTDIR ]; then rm -rf $INSTDIR; fi
     echo " done."
     flush_unopkg_cache
   fi
@@ -27,13 +24,14 @@
 
 case "$1" in
     upgrade|install)
-	INSTDIR=`mktemp -d`
+        INSTDIR=`mktemp -d`
         echo Removing old accessodf extensions.
         id=" "
         while [ "$id" != ""  ]; do
             id=`HOME=$INSTDIR unopkg list --shared | egrep '^(Name|Identifier):.*accessodf' | cut -d":" -f2 | head -n 1`
             if [ "$id" != "" ]; then remove_extension $id; fi
         done
+        rm -rf $INSTDIR
     ;;
 esac
 
diff -Nru accessodf-0.1/debian/prerm accessodf-0.1/debian/prerm
--- accessodf-0.1/debian/prerm	2012-10-23 19:48:44.000000000 +0200
+++ accessodf-0.1/debian/prerm	2013-01-16 05:51:52.000000000 +0100
@@ -10,14 +10,12 @@
 }
 
 remove_extension() {
-    INSTDIR=`mktemp -d`
     if HOME=$INSTDIR unopkg list --shared $1 >/dev/null; then
         echo -n "Removing extension $1..."
         HOME=$INSTDIR unopkg remove --shared $1 \
         "-env:UserInstallation=file://$INSTDIR" \
         '-env:UNO_JAVA_JFW_INSTALL_DATA=$ORIGIN/../share/config/javasettingsunopkginstall.xml' \
         "-env:JFW_PLUGIN_DO_NOT_CHECK_ACCESSIBILITY=1"
-    if [ -n $INSTDIR ]; then rm -rf $INSTDIR; fi
     echo " done."
     flush_unopkg_cache
     fi
@@ -25,7 +23,9 @@
 
 case "$1" in
     remove)
+        INSTDIR=`mktemp -d`
         remove_extension be.docarch.accessodf.ooo.accessodfaddon
+        rm -rf $INSTDIR
     ;;
 esac
 

Reply via email to