Mercurial > trustbridge
comparison packaging/linux-installer.inc.in @ 752:96cac71834ba
Fixed errors when not all expected files exist on deinstallation.
author | Sascha Wilde <wilde@intevation.de> |
---|---|
date | Fri, 04 Jul 2014 17:49:26 +0200 |
parents | d8c8e14b9953 |
children | 7c1f34115ede |
comparison
equal
deleted
inserted
replaced
751:d8c8e14b9953 | 752:96cac71834ba |
---|---|
178 # Args: $1 - DIRECTORY | 178 # Args: $1 - DIRECTORY |
179 # | 179 # |
180 # Recursively remove DIRECTORY and all it _parent_ directories as | 180 # Recursively remove DIRECTORY and all it _parent_ directories as |
181 # long as they are empty. | 181 # long as they are empty. |
182 local directory="$1" | 182 local directory="$1" |
183 while [ "$directory" -a -z "$(ls -A "$directory")" ] ; do | 183 while [ -d "$directory" -a -z "$(ls 2>/dev/null -A "$directory")" ] ; do |
184 echo "Deleting empty directory '$directory' ..." | 184 echo "Deleting empty directory '$directory' ..." |
185 rmdir "$directory" | 185 rmdir "$directory" |
186 directory=`dirname "$directory"` | 186 directory=`dirname "$directory"` |
187 done | |
188 } | |
189 | |
190 rm_files() | |
191 { | |
192 for file in "$@" ; do | |
193 if [ -e "$file" ] ; then | |
194 echo "Deleting $file ..." | |
195 rm "$file" | |
196 fi | |
187 done | 197 done |
188 } | 198 } |
189 | 199 |
190 setup_cronjob() | 200 setup_cronjob() |
191 { | 201 { |
207 } | 217 } |
208 | 218 |
209 deinstall_certs() | 219 deinstall_certs() |
210 { | 220 { |
211 local cinst="${oldinstcfg[PREFIX]}/bin/cinst" | 221 local cinst="${oldinstcfg[PREFIX]}/bin/cinst" |
212 local certlist=`ls -1 ${instdata_path}/list-*.txt | sort -nr | head -n 1` | 222 local certlist=`ls 2>/dev/null -1 ${instdata_path}/list-*.txt | sort -nr | head -n 1` |
213 | 223 |
214 echo "Uninstalling certificates ..." | 224 echo "Uninstalling certificates ..." |
215 | 225 |
216 if [ "$certlist" ] ; then | 226 if [ "$certlist" ] ; then |
217 echo "Using certificate list '$certlist'." | 227 echo "Using certificate list '$certlist'." |
232 | 242 |
233 # FIXME: delete all files created by the application. | 243 # FIXME: delete all files created by the application. |
234 local tbcfg_files=( "${instcfg_path}/TrustBridge.ini" | 244 local tbcfg_files=( "${instcfg_path}/TrustBridge.ini" |
235 "${instcfg_path}/trustbridge-tray-starter.cfg" | 245 "${instcfg_path}/trustbridge-tray-starter.cfg" |
236 "$instcfg_file" ) | 246 "$instcfg_file" ) |
247 | |
237 echo "Removing certificate lists from: ${instdata_path}:" | 248 echo "Removing certificate lists from: ${instdata_path}:" |
238 for file in "$instdata_path"/list-*.txt ; do | 249 rm_files "$instdata_path"/list-*.txt |
239 echo "Deleting $file ..." | |
240 rm "$file" | |
241 done | |
242 rm_empty_dirs "$instdata_path" | 250 rm_empty_dirs "$instdata_path" |
243 | 251 |
244 echo "Removing configuration files:" | 252 echo "Removing configuration files:" |
245 for file in "${tbcfg_files[@]}" ; do | 253 rm_files "${tbcfg_files[@]}" |
246 echo "Deleting $file ..." | |
247 rm "$file" | |
248 done | |
249 rm_empty_dirs "$instcfg_path" | 254 rm_empty_dirs "$instcfg_path" |
250 } | 255 } |
251 | 256 |
252 deinstall() | 257 deinstall() |
253 { | 258 { |