]> rtime.felk.cvut.cz Git - sojka/lightdm.git/blob - debian/config-error-dialog.sh
Show warning dialog instead of interrupted login if syntax error in ~/.profile etc
[sojka/lightdm.git] / debian / config-error-dialog.sh
1 # Copyright (C) 2014 Canonical Ltd
2 # Author: Gunnar Hjalmarsson <gunnarhj@ubuntu.com>
3 #
4 # This program is free software: you can redistribute it and/or modify it under
5 # the terms of the GNU General Public License as published by the Free Software
6 # Foundation, version 3 of the License.
7 #
8 # See http://www.gnu.org/copyleft/gpl.html the full text of the license.
9
10 # This file may be sourced by the function source_with_error_check() in
11 # /usr/sbin/lightdm-session
12
13 export TEXTDOMAIN=lightdm
14 . /usr/bin/gettext.sh
15
16 if $SYNTAX; then
17         PARA1=$(eval_gettext 'The configuration file $CONFIG_FILE contains
18 invalid syntax and could not be loaded:')
19 else
20         PARA1=$(eval_gettext 'Error found when loading $CONFIG_FILE:')
21 fi
22
23 PARA2=$(gettext 'As a result the session will not be configured correctly.
24 You should fix the problem as soon as feasible.')
25
26 TEXT="$PARA1\n\n$(fold -s $ERR)\n\n$PARA2"
27
28 if [ -x /usr/bin/kdialog ]; then
29         TEXT_FILE=$(mktemp --tmpdir config-err-kdialog-XXXXXX)
30         echo -n "$TEXT" > "$TEXT_FILE"
31         kdialog --textbox "$TEXT_FILE" 500 300
32         rm -f "$TEXT_FILE"
33 elif [ -x /usr/bin/zenity ]; then
34         zenity --warning --no-wrap --text="$TEXT"
35 fi