[PATCH] (issue142) Only remove certificates if requested

Wald Commits scm-commit at wald.intevation.org
Mon Sep 22 12:38:06 CEST 2014


# HG changeset patch
# User Andre Heinecke <andre.heinecke at intevation.de>
# Date 1411382283 -7200
# Node ID 59b3c22a404c5a4faafff8fb073b609a586d84e7
# Parent  53a02fbe2fc99d0c0c2c5f8238a7c830c23d2b27
(issue142) Only remove certificates if requested

    Leave the TrustBridge.ini and the list-installed.txt around otherwise.

diff -r 53a02fbe2fc9 -r 59b3c22a404c packaging/linux-installer-uninstall.inc
--- a/packaging/linux-installer-uninstall.inc	Mon Sep 22 11:51:59 2014 +0200
+++ b/packaging/linux-installer-uninstall.inc	Mon Sep 22 12:38:03 2014 +0200
@@ -31,23 +31,27 @@
   setup_cronjob deinstall
 }
 
-deinstall_certs()
+deinstall_certs_and_config()
 {
   local cinst="${oldinstcfg[PREFIX]}/bin/trustbridge-certificate-installer"
   local certlist=`ls 2>/dev/null -1  ${instdata_path}/list-installed.txt`
 
   getxt "Uninstalling certificates ...\n"
 
-  if [ "$certlist" ] ; then
+  if [ -f "$certlist" ] ; then
       getxt "Using certificate list '%s'.\n" "$certlist"
       if [ -x "$cinst" ] ; then
           "$cinst" "list=$certlist" "choices=uninstall"
       else
         getxt >&2 "WARNING: can't execute %s for certificate deinstallation.\n" "$cinst"
       fi
+      rm_files "$certlist"
   else
     getxt "No certificate list found.  Nothing to do.\n"
   fi
+
+  rm_files "${instcfg_path}/TrustBridge.ini"
+  rm_empty_dirs "$instcfg_path"
 }
 
 deinstall_etc()
@@ -55,22 +59,20 @@
   getxt "Removing cron job ...\n"
   remove_cronjob
 
-  # FIXME (issue133): delete all files created by the application.
-  local tbcfg_files=( "${instcfg_path}/TrustBridge.ini"
-                      "${instcfg_path}/trustbridge-tray-starter.cfg"
+  getxt "Removing certificate lists from: %s:\n" "$instdata_path"
+  rm_files "$instdata_path"/list-2*.txt
+
+  local tbcfg_files=( "${instcfg_path}/trustbridge-tray-starter.cfg"
                       "$instcfg_file" )
 
-  getxt "Removing certificate lists from: %s:\n" "$instdata_path"
-  rm_files "$instdata_path"/list-*.txt
+  getxt "Removing configuration files:\n"
+  rm_files "${tbcfg_files[@]}"
+  rm_empty_dirs "$instcfg_path"
 
   getxt "Removing PID file from: %s:\n" "$instdata_path"
   rm_files "$instdata_path"/*.pid
   rm_empty_dirs "$instdata_path"
 
-  getxt "Removing configuration files:\n"
-  rm_files "${tbcfg_files[@]}"
-  rm_empty_dirs "$instcfg_path"
-
   getxt "Removing TrustBridge from autostart\n"
   rm_files "${autostart_path}/trustbridge.desktop"
   update-desktop-database 2>&1 || true
@@ -84,7 +86,11 @@
   if [ "${oldinstcfg[PREFIX]}" ] ; then
       getxt "Really deinstall TrustBridge from '%s'? [y/n]\n" "${oldinstcfg[PREFIX]}"
       yorn || exit 0
-      deinstall_certs
+      local certlist=`ls 2>/dev/null -1  ${instdata_path}/list-installed.txt`
+      if [ -f "$certlist" ] ; then
+        getxt "Do you also want to remove the certificates installed by TrustBridge? [y/n]\n"
+        yorn && deinstall_certs_and_config
+      fi
       local deinstdir="${oldinstcfg[PREFIX]}/bin"
       getxt "Deinstalling from '%s'.\n" "${oldinstcfg[PREFIX]}"
       for file in $BINNAMES ; do
diff -r 53a02fbe2fc9 -r 59b3c22a404c packaging/linux-installer-uninstall.l10n-de
--- a/packaging/linux-installer-uninstall.l10n-de	Mon Sep 22 11:51:59 2014 +0200
+++ b/packaging/linux-installer-uninstall.l10n-de	Mon Sep 22 12:38:03 2014 +0200
@@ -16,4 +16,5 @@
   ["Using certificate list '%s'.\n"]="Die Zertifikatsliste '%s' wird verwendet.\n"
   ["WARNING: Could not delete: '%s'!\n"]="WARNUNG: Konnte '%s' nicht löschen!\n"
   ["WARNING: can't execute %s for certificate deinstallation.\n"]="WARNUNG: '%s' kann nicht zum deinstallieren der Zertifikate ausgeführt werden.\n"
+  ["Do you also want to remove the certificates installed by TrustBridge? [y/n]\n"]="Sollen die von TrustBridge installierten Zertifikate auch entfernt werden? [j\n]\n"
 )


More information about the Trustbridge-commits mailing list