Browse Source

lib/libsde.in: enhanced to read the correct $SDESETTINGS even under sudo.

master
Nagy Károly Gábriel 9 years ago
parent
commit
8442373ccd
1 changed files with 9 additions and 3 deletions
  1. +9
    -3
      lib/libsde.in

+ 9
- 3
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%/*}"

Loading…
Cancel
Save