Mercurial > trustbridge
comparison packaging/linux-installer.inc.in @ 723:e71c59b16eee
Added certificate deinstallation.
author | Sascha Wilde <wilde@intevation.de> |
---|---|
date | Wed, 02 Jul 2014 16:19:18 +0200 |
parents | acbe75423283 |
children | d280e2d39d5a |
comparison
equal
deleted
inserted
replaced
711:acbe75423283 | 723:e71c59b16eee |
---|---|
11 SYSINST=0 | 11 SYSINST=0 |
12 DEINSTALL=0 | 12 DEINSTALL=0 |
13 BINNAMES="###BINNAMES###" | 13 BINNAMES="###BINNAMES###" |
14 | 14 |
15 declare -A instcfg oldinstcfg | 15 declare -A instcfg oldinstcfg |
16 declare inst_default_prefix instcfg_file | 16 declare inst_default_prefix instcfg_path instcfg_file |
17 instcfg=( | 17 instcfg=( |
18 [TIMESTMP]=`date -u +%Y%m%d%H%M%S` | 18 [TIMESTMP]=`date -u +%Y%m%d%H%M%S` |
19 [VERSION]='@PROJECT_VERSION@' | 19 [VERSION]='@PROJECT_VERSION@' |
20 [PREFIX]='' | 20 [PREFIX]='' |
21 ) | 21 ) |
131 | 131 |
132 init_vars() | 132 init_vars() |
133 { | 133 { |
134 if [ $SYSINST -eq 1 ] ; then | 134 if [ $SYSINST -eq 1 ] ; then |
135 inst_default_prefix="$SYSDEFAULT_PREFIX" | 135 inst_default_prefix="$SYSDEFAULT_PREFIX" |
136 instcfg_file="${SYSCFGPATH}/${INSTCFGNAME}" | 136 instcfg_path="${SYSCFGPATH}" |
137 | |
137 else | 138 else |
138 inst_default_prefix="$DEFAULT_PREFIX" | 139 inst_default_prefix="$DEFAULT_PREFIX" |
139 instcfg_file="${CFGPATH}/${INSTCFGNAME}" | 140 instcfg_path="${CFGPATH}" |
140 fi | 141 fi |
142 instcfg_file="${instcfg_path}/${INSTCFGNAME}" | |
141 } | 143 } |
142 | 144 |
143 write_instcfg() | 145 write_instcfg() |
144 { | 146 { |
145 install -d `dirname "$instcfg_file"` | 147 install -d `dirname "$instcfg_file"` |
164 if [ $SYSINST -eq 1 -a "$UID" -ne 0 ] ; then | 166 if [ $SYSINST -eq 1 -a "$UID" -ne 0 ] ; then |
165 fatal "System wide installation requires root privileges!" | 167 fatal "System wide installation requires root privileges!" |
166 fi | 168 fi |
167 } | 169 } |
168 | 170 |
171 deinstall_certs() | |
172 { | |
173 local cinst="${oldinstcfg[PREFIX]}/bin/cinst" | |
174 local certlist=`ls -1 ${instcfg_path}/list-*.txt | sort -nr | head -n 1` | |
175 | |
176 echo "Uninstalling certificates ..." | |
177 | |
178 if [ "$certlist" ] ; then | |
179 echo "Using certificate list '$certlist'." | |
180 if [ -x $cinst ] ; then | |
181 "$cinst" "list=$certlist" "choices=uninstall" | |
182 else | |
183 echo >&2 "WARNING: can't execute $cinst for certificate deinstallation." | |
184 fi | |
185 else | |
186 echo "No certificate list found. Nothing to do." | |
187 fi | |
188 } | |
189 | |
169 deinstall() | 190 deinstall() |
170 { | 191 { |
171 if [ "${oldinstcfg[PREFIX]}" ] ; then | 192 if [ "${oldinstcfg[PREFIX]}" ] ; then |
172 echo "Really deinstall TrustBridge from '${oldinstcfg[PREFIX]}'?" | 193 echo "Really deinstall TrustBridge from '${oldinstcfg[PREFIX]}'?" |
173 yorn || exit 0 | 194 yorn || exit 0 |
195 deinstall_certs | |
174 local deinstdir="${oldinstcfg[PREFIX]}/bin" | 196 local deinstdir="${oldinstcfg[PREFIX]}/bin" |
175 echo "Deinstalling from '${oldinstcfg[PREFIX]}'." | 197 echo "Deinstalling from '${oldinstcfg[PREFIX]}'." |
176 for file in $BINNAMES ; do | 198 for file in $BINNAMES ; do |
177 local path="${deinstdir}/$file" | 199 local path="${deinstdir}/$file" |
178 echo "Deleting '$path' ..." | 200 echo "Deleting '$path' ..." |