From 8442373ccda1ebc4d007c36fa55fb4af604d5d6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nagy=20K=C3=A1roly=20G=C3=A1briel?= Date: Sun, 1 Nov 2015 18:23:27 +0100 Subject: [PATCH] lib/libsde.in: enhanced to read the correct $SDESETTINGS even under sudo. --- lib/libsde.in | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/libsde.in b/lib/libsde.in index be2fac0..a779f6b 100644 --- a/lib/libsde.in +++ b/lib/libsde.in @@ -2,7 +2,7 @@ # This copyright note is auto-generated by ./scripts/Create-CopyPatch. # # Filename: lib/libsde.in -# Copyright (C) 2006 - 2010 The OpenSDE Project +# Copyright (C) 2006 - 2015 The OpenSDE Project # # More information can be found in the files COPYING and README. # @@ -23,8 +23,14 @@ sdever=$("$SDEROOT/lib/version.sh") # default settings # -[ -n "$SDESETTINGS" ] || SDESETTINGS="$HOME/.sde/settings" -export SDESETTINGS +if [ -z "$SDESETTINGS" ]; then + if [ -n "$SUDO_USER" ]; then + SDESETTINGS="$( getent passwd $SUDO_USER | cut -d: -f6)/.sde/settings" + else + SDESETTINGS="$HOME/.sde/settings" + fi + export SDESETTINGS +fi if [ ! -e "$SDESETTINGS" ]; then mkdir -p "${SDESETTINGS%/*}"