2 # Debian lightdm package pre-removal script
4 # Copyright 2001 Branden Robinson.
5 # Licensed under the GNU General Public License, version 2. See the file
6 # /usr/share/common-licenses/GPL or <http://www.gnu.org/copyleft/gpl.txt>.
7 # Acknowlegements to Stephen Early, Mark Eichin, and Manoj Srivastava.
8 # based on gdm pre-removal script
13 DAEMON=/usr/sbin/lightdm
15 DEFAULT_DISPLAY_MANAGER_FILE=/etc/X11/default-display-manager
17 if [ "$1" = "remove" ] || [ "$1" = "deconfigure" ]; then
18 if [ -e /usr/share/debconf/confmodule ]; then
19 . /usr/share/debconf/confmodule
20 # disown this question
21 db_unregister shared/default-x-display-manager
22 # does the question still exist?
23 if db_get shared/default-x-display-manager; then
24 db_metaget shared/default-x-display-manager owners
25 db_subst shared/default-x-display-manager choices "$RET"
26 db_get shared/default-x-display-manager
27 # are we removing the currently selected display manager?
28 if [ "$THIS_PACKAGE" = "$RET" ]; then
29 if [ -e "$DEFAULT_DISPLAY_MANAGER_FILE" ]; then
30 if db_get "$RET"/daemon_name; then
31 if [ "$(cat $DEFAULT_DISPLAY_MANAGER_FILE)" = "$RET" ]; then
32 rm "$DEFAULT_DISPLAY_MANAGER_FILE"
35 if [ "$(cat $DEFAULT_DISPLAY_MANAGER_FILE)" = "$DAEMON" ]; then
36 rm "$DEFAULT_DISPLAY_MANAGER_FILE"
40 # ask the user to choose a new default
41 db_fset shared/default-x-display-manager seen false
42 db_input critical shared/default-x-display-manager || true
44 # if the display manager file doesn't exist, write it with the path
45 # to the new default display manager
46 if [ ! -e $DEFAULT_DISPLAY_MANAGER_FILE ]; then
47 db_get shared/default-x-display-manager
48 db_get "$RET"/daemon_name
49 echo "$RET" > "$DEFAULT_DISPLAY_MANAGER_FILE"