[PATCH] (issue100) Fall back to system wide deinstallation when no local installation is found

Wald Commits scm-commit at wald.intevation.org
Thu Sep 4 15:56:13 CEST 2014


# HG changeset patch
# User Andre Heinecke <andre.heinecke at intevation.de>
# Date 1409838931 -7200
# Node ID 43734932e2ea648ea136582d9259245bc2467127
# Parent  069f5e5344f63f7765d2e0e391a5b898c91ff8b2
(issue100) Fall back to system wide deinstallation when no local installation is found

diff -r 069f5e5344f6 -r 43734932e2ea packaging/linux-installer.inc.in
--- 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
diff -r 069f5e5344f6 -r 43734932e2ea packaging/linux-installer.l10n-de
--- 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"


More information about the Trustbridge-commits mailing list