[PATCH 1 of 4] Added certificate deinstallation

Wald Commits scm-commit at wald.intevation.org
Wed Jul 2 19:32:34 CEST 2014


# HG changeset patch
# User Sascha Wilde <wilde at intevation.de>
# Date 1404310758 -7200
# Node ID e71c59b16eee1929de1530261dcef769d0c0aae3
# Parent  acbe7542328333a7b09362c25a34d97a466a79b0
Added certificate deinstallation.

diff -r acbe75423283 -r e71c59b16eee packaging/linux-installer.inc.in
--- a/packaging/linux-installer.inc.in	Wed Jul 02 15:12:25 2014 +0200
+++ b/packaging/linux-installer.inc.in	Wed Jul 02 16:19:18 2014 +0200
@@ -13,7 +13,7 @@
 BINNAMES="###BINNAMES###"
 
 declare -A instcfg oldinstcfg
-declare inst_default_prefix instcfg_file
+declare inst_default_prefix instcfg_path instcfg_file
 instcfg=(
   [TIMESTMP]=`date -u +%Y%m%d%H%M%S`
   [VERSION]='@PROJECT_VERSION@'
@@ -133,11 +133,13 @@
 {
   if [ $SYSINST -eq 1 ] ; then
       inst_default_prefix="$SYSDEFAULT_PREFIX"
-      instcfg_file="${SYSCFGPATH}/${INSTCFGNAME}"
+      instcfg_path="${SYSCFGPATH}"
+
   else
     inst_default_prefix="$DEFAULT_PREFIX"
-    instcfg_file="${CFGPATH}/${INSTCFGNAME}"
+    instcfg_path="${CFGPATH}"
   fi
+    instcfg_file="${instcfg_path}/${INSTCFGNAME}"
 }
 
 write_instcfg()
@@ -166,11 +168,31 @@
   fi
 }
 
+deinstall_certs()
+{
+  local cinst="${oldinstcfg[PREFIX]}/bin/cinst"
+  local certlist=`ls -1  ${instcfg_path}/list-*.txt | sort -nr | head -n 1`
+
+  echo "Uninstalling certificates ..."
+  
+  if [ "$certlist" ] ; then
+      echo "Using certificate list '$certlist'."
+      if [ -x $cinst ] ; then
+          "$cinst" "list=$certlist" "choices=uninstall"
+      else
+        echo >&2 "WARNING: can't execute $cinst for certificate deinstallation."
+      fi
+  else
+    echo "No certificate list found.  Nothing to do."
+  fi
+}
+
 deinstall()
 {
   if [ "${oldinstcfg[PREFIX]}" ] ; then
       echo "Really deinstall TrustBridge from '${oldinstcfg[PREFIX]}'?"
       yorn || exit 0
+      deinstall_certs
       local deinstdir="${oldinstcfg[PREFIX]}/bin"
       echo "Deinstalling from '${oldinstcfg[PREFIX]}'."
       for file in $BINNAMES ; do


More information about the Trustbridge-commits mailing list