~ken-vandine/gdm/ubuntu_transition_from_lightdm

« back to all changes in this revision

Viewing changes to debian/gdm.prerm

  • Committer: Jeremy Bicha
  • Date: 2017-04-26 11:02:52 UTC
  • Revision ID: jbicha@ubuntu.com-20170426110252-of979orglkl75xgt
Tags: 3.24.1-0ubuntu1
Update to current artful package

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/bin/bash
2
 
# Debian gdm package pre-removal script
3
 
# Copyright 2001 Branden Robinson.
4
 
# Licensed under the GNU General Public License, version 2.  See the file
5
 
# /usr/share/common-licenses/GPL or <http://www.gnu.org/copyleft/gpl.txt>.
6
 
# Acknowlegements to Stephen Early, Mark Eichin, and Manoj Srivastava.
7
 
 
8
 
set -e
9
 
 
10
 
THIS_PACKAGE=gdm
11
 
DEFAULT_DISPLAY_MANAGER_FILE=/etc/X11/default-display-manager
12
 
 
13
 
if [ "$1" = "remove" -o "$1" = "deconfigure" ]; then
14
 
  if [ -e /usr/share/debconf/confmodule ]; then
15
 
    . /usr/share/debconf/confmodule
16
 
    # disown this question
17
 
    db_unregister shared/default-x-display-manager || true
18
 
    # does the question still exist?
19
 
    if db_get shared/default-x-display-manager; then
20
 
      db_metaget shared/default-x-display-manager owners
21
 
      db_subst shared/default-x-display-manager choices "$RET"
22
 
      db_get shared/default-x-display-manager
23
 
      # are we removing the currently selected display manager?
24
 
      if [ "$THIS_PACKAGE" = "$RET" ]; then
25
 
        if [ -e "$DEFAULT_DISPLAY_MANAGER_FILE" ]; then
26
 
          db_get "$RET"/daemon_name
27
 
          if [ "$(cat $DEFAULT_DISPLAY_MANAGER_FILE)" = "$RET" ]; then
28
 
            rm "$DEFAULT_DISPLAY_MANAGER_FILE"
29
 
          fi
30
 
        fi
31
 
        # ask the user to choose a new default
32
 
        db_fset shared/default-x-display-manager seen false
33
 
        db_input critical shared/default-x-display-manager || true
34
 
        db_go
35
 
        # if the display manager file doesn't exist, write it with the path
36
 
        # to the new default display manager
37
 
        if [ ! -e $DEFAULT_DISPLAY_MANAGER_FILE ]; then
38
 
          db_get shared/default-x-display-manager
39
 
          echo "Please be sure to run \"dpkg-reconfigure $RET\"."
40
 
          db_get "$RET"/daemon_name
41
 
          echo "$RET" > "$DEFAULT_DISPLAY_MANAGER_FILE"
42
 
        fi
43
 
      fi
44
 
    fi
45
 
  fi
46
 
fi
47
 
 
48
 
if [ "$1" = "remove" ]; then
49
 
  if [ -x /etc/init.d/gdm ]; then
50
 
    nostop=
51
 
    for hostname in "" "localhost" "$(hostname)" "$(hostname -f)"; do
52
 
      if echo $DISPLAY | grep -q "^$hostname:0.*"; then
53
 
        nostop=yes
54
 
      fi
55
 
    done
56
 
    if [ -z $nostop ]; then
57
 
      service gdm stop
58
 
    fi
59
 
  fi
60
 
fi
61
 
 
62
 
#DEBHELPER#
63
 
 
64
 
exit 0