summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGunnar Hjalmarsson <gunnarhj@ubuntu.com>2014-10-21 13:37:06 +0200
committerGunnar Hjalmarsson <gunnarhj@ubuntu.com>2014-10-21 13:37:06 +0200
commitbeae37608b78d8fb4a657065d8cce84911a31d27 (patch)
tree0835827379d497b853de6e93cdda41d2c290183d
parente6af09ddde06ff1659c74726633443e6cfdb048b (diff)
downloadlightdm-git-beae37608b78d8fb4a657065d8cce84911a31d27.tar.gz
Show warning dialog instead of interrupted login if syntax error in ~/.profile etc
-rw-r--r--debian/config-error-dialog.sh35
-rw-r--r--debian/lightdm-session23
-rw-r--r--debian/lightdm.install1
-rw-r--r--debian/patches/05_translate_debian_files.patch15
-rw-r--r--debian/patches/05_translate_guest_session_dialog.patch15
-rw-r--r--debian/patches/series2
6 files changed, 73 insertions, 18 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 726383b7..bd159b7d 100644
--- a/debian/lightdm.install
+++ b/debian/lightdm.install
@@ -10,6 +10,7 @@ etc/lightdm/keys.conf usr/share/doc/lightdm/
etc/apparmor.d
debian/lightdm-session usr/sbin
debian/guest-account 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
new file mode 100644
index 00000000..a68b5c6f
--- /dev/null
+++ b/debian/patches/05_translate_debian_files.patch
@@ -0,0 +1,15 @@
+Description: Grab translatable strings from debian/* files
+ This is done as an Ubuntu patch, since debian/* files are not included upstream.
+Forwarded: not-needed
+Author: Gunnar Hjalmarsson <gunnarhj@ubuntu.com>
+
+--- lightdm.orig/po/POTFILES.in 2014-09-30 05:00:39.000000000 +0200
++++ lightdm/po/POTFILES.in 2014-10-21 13:27:49.948251829 +0200
+@@ -1,5 +1,7 @@
+ # List of source files containing translatable strings.
+ # Please keep this file sorted alphabetically.
+ [encoding: UTF-8]
++debian/config-error-dialog.sh
++debian/guest-session-auto.sh
+ src/lightdm.c
+ src/dm-tool.c
diff --git a/debian/patches/05_translate_guest_session_dialog.patch b/debian/patches/05_translate_guest_session_dialog.patch
deleted file mode 100644
index 398a4a12..00000000
--- a/debian/patches/05_translate_guest_session_dialog.patch
+++ /dev/null
@@ -1,15 +0,0 @@
-Description: Grab translatable strings from debian/guest-session-auto.sh
- This is done as an Ubuntu patch, since debian/guest-session-auto.sh
- is not an upstream file.
-Forwarded: not-needed
-Author: Gunnar Hjalmarsson <gunnarhj@ubuntu.com>
-
---- lightdm.orig/po/POTFILES.in 2014-01-24 14:44:56.240966000 +0100
-+++ lightdm/po/POTFILES.in 2014-01-24 15:09:58.651191195 +0100
-@@ -1,5 +1,6 @@
- # List of source files containing translatable strings.
- # Please keep this file sorted alphabetically.
- [encoding: UTF-8]
-+debian/guest-session-auto.sh
- src/lightdm.c
- src/dm-tool.c
diff --git a/debian/patches/series b/debian/patches/series
index 4d371dde..4bb2ea00 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,3 +1,3 @@
01_transition_ubuntu2d_ubuntu_desktop.patch
04_language_handling.patch
-05_translate_guest_session_dialog.patch
+05_translate_debian_files.patch