Mercurial > trustbridge
view packaging/linux-installer-uninstall.inc @ 1160:a974b61a5cce
(issue108) Add missing license headers
author | Andre Heinecke <andre.heinecke@intevation.de> |
---|---|
date | Thu, 18 Sep 2014 18:00:34 +0200 |
parents | a72d59f8c3ea |
children | c13ac2c9851d |
line wrap: on
line source
#-*-sh-*- ###INCLUDE:linux-installer-uninstall.l10n-de rm_empty_dirs() { # Args: $1 - DIRECTORY # # Recursively remove DIRECTORY and all it _parent_ directories as # long as they are empty. local directory="$1" while [ -d "$directory" -a -z "$(ls 2>/dev/null -A "$directory")" ] ; do getxt "Deleting empty directory '%s' ...\n" "$directory" rmdir "$directory" directory=`dirname "$directory"` done } rm_files() { for file in "$@" ; do if [ -e "$file" ] ; then getxt "Deleting '%s' ...\n" "$file" rm "$file" fi done } remove_cronjob() { setup_cronjob deinstall } deinstall_certs() { local cinst="${oldinstcfg[PREFIX]}/bin/cinst" local certlist=`ls 2>/dev/null -1 ${instdata_path}/list-installed.txt` getxt "Uninstalling certificates ...\n" if [ "$certlist" ] ; then getxt "Using certificate list '%s'.\n" "$certlist" if [ -x "$cinst" ] ; then "$cinst" "list=$certlist" "choices=uninstall" else getxt >&2 "WARNING: can't execute %s for certificate deinstallation.\n" "$cinst" fi else getxt "No certificate list found. Nothing to do.\n" fi } deinstall_etc() { getxt "Removing cron job ...\n" remove_cronjob # FIXME: delete all files created by the application. local tbcfg_files=( "${instcfg_path}/TrustBridge.ini" "${instcfg_path}/trustbridge-tray-starter.cfg" "$instcfg_file" ) getxt "Removing certificate lists from: %s:\n" "$instdata_path" rm_files "$instdata_path"/list-*.txt getxt "Removing PID file from: %s:\n" "$instdata_path" rm_files "$instdata_path"/*.pid rm_empty_dirs "$instdata_path" getxt "Removing configuration files:\n" rm_files "${tbcfg_files[@]}" rm_empty_dirs "$instcfg_path" getxt "Removing TrustBridge from autostart\n" rm_files "${autostart_path}/trustbridge.desktop" update-desktop-database 2>&1 || true getxt "Removing TrustBridge from start menu\n" rm_files "${startmenu_path}/trustbridge.desktop" } deinstall() { if [ "${oldinstcfg[PREFIX]}" ] ; then getxt "Really deinstall TrustBridge from '%s'? [y/n]\n" "${oldinstcfg[PREFIX]}" yorn || exit 0 deinstall_certs local deinstdir="${oldinstcfg[PREFIX]}/bin" getxt "Deinstalling from '%s'.\n" "${oldinstcfg[PREFIX]}" for file in $BINNAMES ; do local path="${deinstdir}/$file" getxt "Deleting '%s' ...\n" "$path" rm "$path" || getxt >&2 "WARNING: Could not delete: '%s'!\n" "$path" done rm_empty_dirs "$deinstdir" # images deinstdir="${oldinstcfg[PREFIX]}/share/doc/trustbridge/_images" for file in $HELPNAMES_IMG; do local path="${deinstdir}/$file" if [ -f "$path" ]; then getxt "Deleting '%s' ...\n" "$path" rm "$path" || getxt >&2 "WARNING: Could not delete: '%s'!\n" "$path" fi done rm_empty_dirs "$deinstdir" # Javascript sources deinstdir="${oldinstcfg[PREFIX]}/share/doc/trustbridge/_sources" for file in $HELPNAMES_SOURCES; do local path="${deinstdir}/$file" if [ -f "$path" ]; then getxt "Deleting '%s' ...\n" "$path" rm "$path" || getxt >&2 "WARNING: Could not delete: '%s'!\n" "$path" fi done rm_empty_dirs "$deinstdir" # Static files deinstdir="${oldinstcfg[PREFIX]}/share/doc/trustbridge/_static" for file in $HELPNAMES_STATIC; do local path="${deinstdir}/$file" if [ -f "$path" ]; then getxt "Deleting '%s' ...\n" "$path" rm "$path" || getxt >&2 "WARNING: Could not delete: '%s'!\n" "$path" fi done rm_empty_dirs "$deinstdir" # The actual html deinstdir="${oldinstcfg[PREFIX]}/share/doc/trustbridge" for file in $HELPNAMES; do local path="${deinstdir}/$file" if [ -f "$path" ]; then getxt "Deleting '%s' ...\n" "$path" rm "$path" || getxt >&2 "WARNING: Could not delete: '%s'!\n" "$path" fi done rm_empty_dirs "$deinstdir" deinstdir="${oldinstcfg[PREFIX]}/share/pixmaps/trustbridge" getxt "Deinstalling from '%s'.\n" "${oldinstcfg[PREFIX]}" for file in $ICONNAME; do local path="${deinstdir}/$file" getxt "Deleting '%s' ...\n" "$path" rm "$path" || getxt >&2 "WARNING: Could not delete: '%s'!\n" "$path" done deinstdir="${oldinstcfg[PREFIX]}/share/pixmaps/trustbridge" rm_empty_dirs "$deinstdir" deinstdir="${oldinstcfg[PREFIX]}/share/pixmaps" rm_empty_dirs "$deinstdir" deinstdir="${oldinstcfg[PREFIX]}/share" rm_empty_dirs "$deinstdir" deinstall_etc getxt "Deinstallation finished.\n" else getxt "No current installation found! No harm done.\n" fi }