Mercurial > trustbridge
diff 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 |
line wrap: on
line diff
--- a/packaging/linux-installer.inc.in Fri Jul 04 17:27:55 2014 +0200 +++ b/packaging/linux-installer.inc.in Fri Jul 04 17:49:26 2014 +0200 @@ -180,13 +180,23 @@ # Recursively remove DIRECTORY and all it _parent_ directories as # long as they are empty. local directory="$1" - while [ "$directory" -a -z "$(ls -A "$directory")" ] ; do + while [ -d "$directory" -a -z "$(ls 2>/dev/null -A "$directory")" ] ; do echo "Deleting empty directory '$directory' ..." rmdir "$directory" directory=`dirname "$directory"` done } +rm_files() +{ + for file in "$@" ; do + if [ -e "$file" ] ; then + echo "Deleting $file ..." + rm "$file" + fi + done +} + setup_cronjob() { # FIXME: handle case of system wide installation. @@ -209,7 +219,7 @@ deinstall_certs() { local cinst="${oldinstcfg[PREFIX]}/bin/cinst" - local certlist=`ls -1 ${instdata_path}/list-*.txt | sort -nr | head -n 1` + local certlist=`ls 2>/dev/null -1 ${instdata_path}/list-*.txt | sort -nr | head -n 1` echo "Uninstalling certificates ..." @@ -234,18 +244,13 @@ local tbcfg_files=( "${instcfg_path}/TrustBridge.ini" "${instcfg_path}/trustbridge-tray-starter.cfg" "$instcfg_file" ) + echo "Removing certificate lists from: ${instdata_path}:" - for file in "$instdata_path"/list-*.txt ; do - echo "Deleting $file ..." - rm "$file" - done + rm_files "$instdata_path"/list-*.txt rm_empty_dirs "$instdata_path" echo "Removing configuration files:" - for file in "${tbcfg_files[@]}" ; do - echo "Deleting $file ..." - rm "$file" - done + rm_files "${tbcfg_files[@]}" rm_empty_dirs "$instcfg_path" }