comparison packaging/linux-installer-uninstall.inc @ 1178:59b3c22a404c

(issue142) Only remove certificates if requested Leave the TrustBridge.ini and the list-installed.txt around otherwise.
author Andre Heinecke <andre.heinecke@intevation.de>
date Mon, 22 Sep 2014 12:38:03 +0200
parents c8f698ca6355
children 55c13de88b1e
comparison
equal deleted inserted replaced
1177:53a02fbe2fc9 1178:59b3c22a404c
29 remove_cronjob() 29 remove_cronjob()
30 { 30 {
31 setup_cronjob deinstall 31 setup_cronjob deinstall
32 } 32 }
33 33
34 deinstall_certs() 34 deinstall_certs_and_config()
35 { 35 {
36 local cinst="${oldinstcfg[PREFIX]}/bin/trustbridge-certificate-installer" 36 local cinst="${oldinstcfg[PREFIX]}/bin/trustbridge-certificate-installer"
37 local certlist=`ls 2>/dev/null -1 ${instdata_path}/list-installed.txt` 37 local certlist=`ls 2>/dev/null -1 ${instdata_path}/list-installed.txt`
38 38
39 getxt "Uninstalling certificates ...\n" 39 getxt "Uninstalling certificates ...\n"
40 40
41 if [ "$certlist" ] ; then 41 if [ -f "$certlist" ] ; then
42 getxt "Using certificate list '%s'.\n" "$certlist" 42 getxt "Using certificate list '%s'.\n" "$certlist"
43 if [ -x "$cinst" ] ; then 43 if [ -x "$cinst" ] ; then
44 "$cinst" "list=$certlist" "choices=uninstall" 44 "$cinst" "list=$certlist" "choices=uninstall"
45 else 45 else
46 getxt >&2 "WARNING: can't execute %s for certificate deinstallation.\n" "$cinst" 46 getxt >&2 "WARNING: can't execute %s for certificate deinstallation.\n" "$cinst"
47 fi 47 fi
48 rm_files "$certlist"
48 else 49 else
49 getxt "No certificate list found. Nothing to do.\n" 50 getxt "No certificate list found. Nothing to do.\n"
50 fi 51 fi
52
53 rm_files "${instcfg_path}/TrustBridge.ini"
54 rm_empty_dirs "$instcfg_path"
51 } 55 }
52 56
53 deinstall_etc() 57 deinstall_etc()
54 { 58 {
55 getxt "Removing cron job ...\n" 59 getxt "Removing cron job ...\n"
56 remove_cronjob 60 remove_cronjob
57 61
58 # FIXME (issue133): delete all files created by the application. 62 getxt "Removing certificate lists from: %s:\n" "$instdata_path"
59 local tbcfg_files=( "${instcfg_path}/TrustBridge.ini" 63 rm_files "$instdata_path"/list-2*.txt
60 "${instcfg_path}/trustbridge-tray-starter.cfg" 64
65 local tbcfg_files=( "${instcfg_path}/trustbridge-tray-starter.cfg"
61 "$instcfg_file" ) 66 "$instcfg_file" )
62 67
63 getxt "Removing certificate lists from: %s:\n" "$instdata_path" 68 getxt "Removing configuration files:\n"
64 rm_files "$instdata_path"/list-*.txt 69 rm_files "${tbcfg_files[@]}"
70 rm_empty_dirs "$instcfg_path"
65 71
66 getxt "Removing PID file from: %s:\n" "$instdata_path" 72 getxt "Removing PID file from: %s:\n" "$instdata_path"
67 rm_files "$instdata_path"/*.pid 73 rm_files "$instdata_path"/*.pid
68 rm_empty_dirs "$instdata_path" 74 rm_empty_dirs "$instdata_path"
69
70 getxt "Removing configuration files:\n"
71 rm_files "${tbcfg_files[@]}"
72 rm_empty_dirs "$instcfg_path"
73 75
74 getxt "Removing TrustBridge from autostart\n" 76 getxt "Removing TrustBridge from autostart\n"
75 rm_files "${autostart_path}/trustbridge.desktop" 77 rm_files "${autostart_path}/trustbridge.desktop"
76 update-desktop-database 2>&1 || true 78 update-desktop-database 2>&1 || true
77 79
82 deinstall() 84 deinstall()
83 { 85 {
84 if [ "${oldinstcfg[PREFIX]}" ] ; then 86 if [ "${oldinstcfg[PREFIX]}" ] ; then
85 getxt "Really deinstall TrustBridge from '%s'? [y/n]\n" "${oldinstcfg[PREFIX]}" 87 getxt "Really deinstall TrustBridge from '%s'? [y/n]\n" "${oldinstcfg[PREFIX]}"
86 yorn || exit 0 88 yorn || exit 0
87 deinstall_certs 89 local certlist=`ls 2>/dev/null -1 ${instdata_path}/list-installed.txt`
90 if [ -f "$certlist" ] ; then
91 getxt "Do you also want to remove the certificates installed by TrustBridge? [y/n]\n"
92 yorn && deinstall_certs_and_config
93 fi
88 local deinstdir="${oldinstcfg[PREFIX]}/bin" 94 local deinstdir="${oldinstcfg[PREFIX]}/bin"
89 getxt "Deinstalling from '%s'.\n" "${oldinstcfg[PREFIX]}" 95 getxt "Deinstalling from '%s'.\n" "${oldinstcfg[PREFIX]}"
90 for file in $BINNAMES ; do 96 for file in $BINNAMES ; do
91 local path="${deinstdir}/$file" 97 local path="${deinstdir}/$file"
92 getxt "Deleting '%s' ...\n" "$path" 98 getxt "Deleting '%s' ...\n" "$path"

http://wald.intevation.org/projects/trustbridge/