[PATCH 2 of 2] Simply autostart creation by initializing the path in init_vars

Wald Commits scm-commit at wald.intevation.org
Mon Jul 14 13:21:22 CEST 2014


# HG changeset patch
# User Andre Heinecke <andre.heinecke at intevation.de>
# Date 1405336877 -7200
# Node ID 2fb539d4b1ff7e1c04dc912260e0f9900d7363f6
# Parent  d92264e9e08f195c58131e87ffeb2e38379da81e
Simply autostart creation by initializing the path in init_vars

diff -r d92264e9e08f -r 2fb539d4b1ff packaging/linux-installer.inc.in
--- a/packaging/linux-installer.inc.in	Mon Jul 14 13:20:55 2014 +0200
+++ b/packaging/linux-installer.inc.in	Mon Jul 14 13:21:17 2014 +0200
@@ -139,10 +139,12 @@
       inst_default_prefix="$SYSDEFAULT_PREFIX"
       instcfg_path="${SYSCFGPATH}"
       instdata_path="${SYSDATAPATH}"
+      autostart_path="$(getent passwd "${SUDO_USER}" | cut -d ':' -f 6)/.config/autostart"
   else
     inst_default_prefix="$DEFAULT_PREFIX"
     instcfg_path="${CFGPATH}"
     instdata_path="${DATAPATH}"
+    autostart_path=${XDG_CONFIG_HOME:-~/.config/autostart}
   fi
     instcfg_file="${instcfg_path}/${INSTCFGNAME}"
 }
@@ -267,13 +269,7 @@
   rm_empty_dirs "$instcfg_path"
 
   echo "Removing TrustBridge from autostart"
-  if [ "${SUDO_USER+X}" ] ; then
-    homedir=$(getent passwd "${SUDO_USER}" | cut -d ':' -f 6)
-    rm_files "${homedir}/.config/autostart/tustbridge.desktop"
-  else
-    config_home=${XDG_CONFIG_HOME:-~/.config}
-    rm_files "${config_home}/autostart/tustbridge.desktop"
-  fi
+  rm_files "${autostart_path}/tustbridge.desktop"
 }
 
 deinstall()
@@ -312,25 +308,14 @@
 setup_autostart()
 {
   # Supported desktop environments: Unity, GNOME, XFCE, LXDE, KDE
+  # System wide installation with a nonstandard XDG_CONFIG_HOME or KDEHOME is not
+  # respected with regards to autostart.
+  if [ ! -d "${autostart_path}" ]; then
+    install -d "${autostart_path}" || \
+      fatal "Failed to create autostart directory: '${autostart_path}'"
+  fi
 
-  if [ $SYSINST -eq 1 -a "${SUDO_USER+X}" ] ; then
-    homedir=$(getent passwd "${SUDO_USER}" | cut -d ':' -f 6)
-    install -d "${instcfg[PREFIX]}" || fatal "Could not create '${instcfg[PREFIX]}'!"
-    if [ ! -d "${homedir}/.config/autostart/" ]; then
-      install -d "${homedir}/.config/autostart/" || \
-        fatal "Failed to create autostart directory: '${homedir}/.config/autostart/'"
-    fi
-    write_autostart "${homedir}/.config/autostart/tustbridge.desktop"
-    # System wide installation with a nonstandard XDG_CONFIG_HOME or KDEHOME is not
-    # respected with regards to autostart.
-  else
-    config_home=${XDG_CONFIG_HOME:-~/.config}
-    if [ ! -d "${config_home}/autostart" ]; then
-      install -d "${config_home}/autostart" || \
-        fatal "Failed to create autostart directory: '${config_home}/autostart'"
-    fi
-    write_autostart "${config_home}/autostart/tustbridge.desktop"
-  fi
+  write_autostart "${autostart_path}/tustbridge.desktop"
 }
 
 #======================================================================


More information about the Trustbridge-commits mailing list