summaryrefslogtreecommitdiff
path: root/debian/lightdm-session
diff options
context:
space:
mode:
authorGunnar Hjalmarsson <gunnarhj@ubuntu.com>2014-10-20 17:58:19 +0200
committerGunnar Hjalmarsson <gunnarhj@ubuntu.com>2014-10-20 17:58:19 +0200
commit436d20ea571fe17d7a92cafdf84c685c7a83519a (patch)
treecf074897f73cf1d334d683b388bf06cc543a5532 /debian/lightdm-session
parent78dd3bd3f75c759ca4ed06eaa4823483fd9783b3 (diff)
downloadlightdm-436d20ea571fe17d7a92cafdf84c685c7a83519a.tar.gz
Warning dialog instead of interrupted login if syntax error in ~/.profile etc.
Diffstat (limited to 'debian/lightdm-session')
-rw-r--r--debian/lightdm-session23
1 files changed, 21 insertions, 2 deletions
diff --git a/debian/lightdm-session b/debian/lightdm-session
index 2a86cbf6..172af59e 100644
--- a/debian/lightdm-session
+++ b/debian/lightdm-session
@@ -20,11 +20,30 @@ errormsg () {
exit 1
}
+# temporary storage of error messages
+ERR=$(mktemp --tmpdir config-err-XXXXXX)
+
+source_with_error_check () {
+ CONFIG_FILE="$1"
+ if sh -n "$CONFIG_FILE" 2>"$ERR"; then
+ echo "Loading $CONFIG_FILE";
+ . "$CONFIG_FILE" 2>"$ERR"
+ if [ -s "$ERR" ]; then
+ SYNTAX=false
+ . /usr/lib/lightdm/config-error-dialog.sh
+ fi
+ else
+ SYNTAX=true
+ . /usr/lib/lightdm/config-error-dialog.sh
+ fi
+ cat "$ERR" >>/dev/stderr
+ truncate -s 0 "$ERR"
+}
+
# Load profile
for file in "/etc/profile" "$HOME/.profile" "/etc/xprofile" "$HOME/.xprofile"; do
if [ -f "$file" ]; then
- echo "Loading profile from $file";
- . "$file"
+ source_with_error_check "$file"
fi
done