2 # Debian lightdm package pre-removal script
3 # © 2010 Yves-Alexis Perez, using lightdm script which is
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.
12 DEFAULT_DISPLAY_MANAGER_FILE=/etc/X11/default-display-manager
14 if [ "$1" = "remove" -o "$1" = "deconfigure" ]; then
15 if [ -e /usr/share/debconf/confmodule ]; then
16 . /usr/share/debconf/confmodule
17 # disown this question
18 db_unregister shared/default-x-display-manager || true
19 # does the question still exist?
20 if db_get shared/default-x-display-manager; then
21 db_metaget shared/default-x-display-manager owners
22 db_subst shared/default-x-display-manager choices "$RET"
23 db_get shared/default-x-display-manager
24 # are we removing the currently selected display manager?
25 if [ "$THIS_PACKAGE" = "$RET" ]; then
26 if [ -e "$DEFAULT_DISPLAY_MANAGER_FILE" ]; then
27 db_get "$RET"/daemon_name
28 if [ "$(cat $DEFAULT_DISPLAY_MANAGER_FILE)" = "$RET" ]; then
29 rm "$DEFAULT_DISPLAY_MANAGER_FILE"
32 # ask the user to choose a new default
33 db_fset shared/default-x-display-manager seen false
34 db_input critical shared/default-x-display-manager || true
36 # if the display manager file doesn't exist, write it with the path
37 # to the new default display manager
38 if [ ! -e $DEFAULT_DISPLAY_MANAGER_FILE ]; then
39 db_get shared/default-x-display-manager
40 echo "Please be sure to run \"dpkg-reconfigure $RET\"."
41 db_get "$RET"/daemon_name
42 echo "$RET" > "$DEFAULT_DISPLAY_MANAGER_FILE"
49 if [ "$1" = "remove" ]; then
50 if [ -x /etc/init.d/lightdm ]; then
52 for hostname in "" "localhost" "$(hostname)" "$(hostname -f)"; do
53 if echo $DISPLAY | grep -q "^$hostname:0.*"; then
57 if [ -z $nostop ]; then
58 invoke-rc.d lightdm stop