diff packaging/linux-installer.inc.in @ 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 f5306f8c02f3
children 7bd1d723414d
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

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