Updating watch file to support XZ tarball format and non-numeric versions.
[debian/lxdm.git] / debian / lxdm.postinst
CommitLineData
6da61772
DB
1#!/bin/sh
2# Debian lxdm package post-installation script
3# Based on xdm.postinst
4# Copyright 1998-2001, 2003, 2004 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# Acknowledgements to Stephen Early, Mark Eichin, and Manoj Srivastava.
8
9
10set -e
11
12# source debconf library
13. /usr/share/debconf/confmodule
14
15THIS_PACKAGE=lxdm
16
17DEFAULT_DISPLAY_MANAGER_FILE=/etc/X11/default-display-manager
18
19# debconf is not a registry, so we only fiddle with the default file if it
20# does not exist
21if ! [ -e "$DEFAULT_DISPLAY_MANAGER_FILE" ]; then
22 DEFAULT_DISPLAY_MANAGER=
23 if db_get shared/default-x-display-manager; then
24 DEFAULT_DISPLAY_MANAGER="$RET"
25 fi
26 if [ -n "$DEFAULT_DISPLAY_MANAGER" ]; then
27 DAEMON_NAME=
28 if db_get "$DEFAULT_DISPLAY_MANAGER"/daemon_name; then
29 DAEMON_NAME="$RET"
30 fi
31 if [ -z "$DAEMON_NAME" ]; then
32 # if we were unable to determine the name of the selected daemon (for
33 # instance, if the selected default display manager doesn't provide a
34 # daemon_name question), guess
35 DAEMON_NAME=$(which "$DEFAULT_DISPLAY_MANAGER" 2>/dev/null)
36 fi
37 if [ -n "$DAEMON_NAME" ]; then
38 echo "$DAEMON_NAME" > "$DEFAULT_DISPLAY_MANAGER_FILE"
39 fi
40 fi
41fi
42
43# Registering the init scripts or starting the daemon may cause output to
44# stdout, which can confuse debconf.
45db_stop
46
47# Remove alternative file if it's not a symlink, workaround for broken upgrade
48# See bug #616188
49if [ -f /etc/alternatives/lxdm.conf ] ; then
50 if [ ! -h "/etc/alternatives/lxdm.conf" ] ; then
51 rm "/etc/alternatives/lxdm.conf"
52 fi
53fi
54
55# Add /etc/lxdm/lxdm.conf from alternative of lxdm configuration
56if [ "$1" = configure ]; then
57 update-alternatives --install /etc/lxdm/default.conf \
58 lxdm.conf /etc/lxdm/lxdm.conf 50
59fi
60
61#DEBHELPER#
62
63exit 0