changeset 1040:43734932e2ea

(issue100) Fall back to system wide deinstallation when no local installation is found
author Andre Heinecke <andre.heinecke@intevation.de>
date Thu, 04 Sep 2014 15:55:31 +0200
parents 069f5e5344f6
children 6235b11a22a0
files packaging/linux-installer.inc.in packaging/linux-installer.l10n-de
diffstat 2 files changed, 13 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/packaging/linux-installer.inc.in	Thu Sep 04 15:27:02 2014 +0200
+++ b/packaging/linux-installer.inc.in	Thu Sep 04 15:55:31 2014 +0200
@@ -175,6 +175,16 @@
     instdata_path="${DATAPATH}"
     autostart_path=${XDG_CONFIG_HOME:-~/.config/autostart}
     startmenu_path=${XDG_DATA_HOME:-~/.local/share/applications}
+    if [ $DEINSTALL -eq 1 ] ; then
+        if [ ! -r ${instcfg_path}/${INSTCFGNAME} ]; then
+            if [ -r ${SYSCFGPATH}/${INSTCFGNAME} ]; then
+                # Fall back to system uninstallation if no user config found
+                SYSINST=1
+                init_vars
+                check_priv
+            fi
+        fi
+    fi
   fi
   instcfg_file="${instcfg_path}/${INSTCFGNAME}"
   extra_bin_path=`mktemp --tmpdir -d tmpbin.XXXXXXXXXX`
@@ -217,7 +227,7 @@
 check_priv()
 {
   if [ $SYSINST -eq 1 -a "$UID" -ne 0 ] ; then
-      fatal "System wide installation requires root privileges!\n"
+      fatal "System wide installation or deinstallation requires root privileges!\n"
   fi
 }
 
@@ -495,8 +505,8 @@
 trap cleanup EXIT
 
 parse_args "$@"
+check_priv
 init_vars
-check_priv
 read_oldinstcfg
 
 cat <<EOF
--- a/packaging/linux-installer.l10n-de	Thu Sep 04 15:27:02 2014 +0200
+++ b/packaging/linux-installer.l10n-de	Thu Sep 04 15:55:31 2014 +0200
@@ -40,7 +40,7 @@
   ["Setting up autostart ...\n"]="Konfiguriere autostart ...\n"
   ["Setting up cronjob ...\n"]="Konfiguriere den Cron-Job ...\n"
   ["Setting up start menu entries ...\n"]="Konfiguriere Startmenü-Einträge...\n"
-  ["System wide installation requires root privileges!\n"]="Für die systemweite Installation werden root-Rechte benötigt!\n"
+  ["System wide installation or deinstallation requires root privileges!\n"]="Für die systemweite Installation werden root-Rechte benötigt!\n"
   ["Uninstalling certificates ...\n"]="Deinstalliere Zertifikate ...\n"
   ["Usage: %s [OPTION]...\n"]="Aufruf:  %s [OPTION]...\n"
   ["Using certificate list '%s'.\n"]="Die Zertifikatsliste '%s' wird verwendet.\n"

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