diff options
author | Gunnar Hjalmarsson <gunnarhj@ubuntu.com> | 2014-10-20 17:58:19 +0200 |
---|---|---|
committer | Gunnar Hjalmarsson <gunnarhj@ubuntu.com> | 2014-10-20 17:58:19 +0200 |
commit | 436d20ea571fe17d7a92cafdf84c685c7a83519a (patch) | |
tree | cf074897f73cf1d334d683b388bf06cc543a5532 /debian | |
parent | 78dd3bd3f75c759ca4ed06eaa4823483fd9783b3 (diff) | |
download | lightdm-git-436d20ea571fe17d7a92cafdf84c685c7a83519a.tar.gz |
Warning dialog instead of interrupted login if syntax error in ~/.profile etc.
Diffstat (limited to 'debian')
-rw-r--r-- | debian/config-error-dialog.sh | 35 | ||||
-rw-r--r-- | debian/lightdm-session | 23 | ||||
-rw-r--r-- | debian/lightdm.install | 1 | ||||
-rw-r--r-- | debian/patches/05_translate_debian_files.patch | 7 |
4 files changed, 61 insertions, 5 deletions
diff --git a/debian/config-error-dialog.sh b/debian/config-error-dialog.sh new file mode 100644 index 00000000..da62087d --- /dev/null +++ b/debian/config-error-dialog.sh @@ -0,0 +1,35 @@ +# Copyright (C) 2014 Canonical Ltd +# Author: Gunnar Hjalmarsson <gunnarhj@ubuntu.com> +# +# This program is free software: you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free Software +# Foundation, version 3 of the License. +# +# See http://www.gnu.org/copyleft/gpl.html the full text of the license. + +# This file may be sourced by the function source_with_error_check() in +# /usr/sbin/lightdm-session + +export TEXTDOMAIN=lightdm +. /usr/bin/gettext.sh + +if $SYNTAX; then + PARA1=$(eval_gettext 'The configuration file $CONFIG_FILE contains +invalid syntax and could not be loaded:') +else + PARA1=$(eval_gettext 'Error found when loading $CONFIG_FILE:') +fi + +PARA2=$(gettext 'As a result the session will not be configured correctly. +You should fix the problem as soon as feasible.') + +TEXT="$PARA1\n\n$(fold -s $ERR)\n\n$PARA2" + +if [ -x /usr/bin/kdialog ]; then + TEXT_FILE=$(mktemp --tmpdir config-err-kdialog-XXXXXX) + echo -n "$TEXT" > "$TEXT_FILE" + kdialog --textbox "$TEXT_FILE" 500 300 + rm -f "$TEXT_FILE" +elif [ -x /usr/bin/zenity ]; then + zenity --warning --no-wrap --text="$TEXT" +fi 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 diff --git a/debian/lightdm.install b/debian/lightdm.install index 1da4aeb9..27d46b65 100644 --- a/debian/lightdm.install +++ b/debian/lightdm.install @@ -9,6 +9,7 @@ etc/lightdm/lightdm.conf usr/share/doc/lightdm/ etc/lightdm/keys.conf usr/share/doc/lightdm/ etc/apparmor.d debian/lightdm-session usr/sbin +debian/config-error-dialog.sh usr/lib/lightdm debian/guest-session-auto.sh usr/lib/lightdm debian/lightdm-greeter-session usr/lib/lightdm debian/source_lightdm.py usr/share/apport/package-hooks diff --git a/debian/patches/05_translate_debian_files.patch b/debian/patches/05_translate_debian_files.patch index 382192c5..5c322aa8 100644 --- a/debian/patches/05_translate_debian_files.patch +++ b/debian/patches/05_translate_debian_files.patch @@ -3,12 +3,13 @@ Description: Grab translatable strings from debian/* files Forwarded: not-needed Author: Gunnar Hjalmarsson <gunnarhj@ubuntu.com> ---- lightdm.orig/po/POTFILES.in 2014-01-23 19:17:23.143894000 +0100 -+++ lightdm/po/POTFILES.in 2014-07-24 23:28:19.519106226 +0200 -@@ -1,5 +1,7 @@ +--- lightdm.orig/po/POTFILES.in 2014-09-30 05:00:39.000000000 +0200 ++++ lightdm/po/POTFILES.in 2014-10-19 18:08:09.576134427 +0200 +@@ -1,5 +1,8 @@ # List of source files containing translatable strings. # Please keep this file sorted alphabetically. [encoding: UTF-8] ++debian/config-error-dialog.sh +debian/guest-account.sh +debian/guest-session-auto.sh src/lightdm.c |