| 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 |
|
| 10 |
set -e |
| 11 |
|
| 12 |
# source debconf library |
| 13 |
. /usr/share/debconf/confmodule |
| 14 |
|
| 15 |
THIS_PACKAGE=lxdm |
| 16 |
|
| 17 |
DEFAULT_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 |
| 21 |
if ! [ -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 |
| 41 |
fi |
| 42 |
|
| 43 |
# Registering the init scripts or starting the daemon may cause output to |
| 44 |
# stdout, which can confuse debconf. |
| 45 |
db_stop || true |
| 46 |
|
| 47 |
if [ "$1" = "configure" ]; |
| 48 |
then |
| 49 |
invoke-rc.d dbus reload || true |
| 50 |
|
| 51 |
# set default-display-manager systemd service link according to our config (stolen from lightdm) |
| 52 |
if [ -e "$DEFAULT_DISPLAY_MANAGER_FILE" -a -d /etc/systemd/system/ ]; then |
| 53 |
SERVICE=/lib/systemd/system/$(basename $(cat "$DEFAULT_DISPLAY_MANAGER_FILE")).service |
| 54 |
if [ -e "$SERVICE" ]; then |
| 55 |
ln -sf "$SERVICE" /etc/systemd/system/display-manager.service |
| 56 |
else |
| 57 |
echo "ERROR: $SERVICE is the selected default display manager but does not exist" >&2 |
| 58 |
fi |
| 59 |
fi |
| 60 |
fi |
| 61 |
|
| 62 |
# Remove alternative file if it's not a symlink, workaround for broken upgrade |
| 63 |
# See bug #616188 |
| 64 |
if [ -f /etc/alternatives/lxdm.conf ] ; then |
| 65 |
if [ ! -h "/etc/alternatives/lxdm.conf" ] ; then |
| 66 |
rm "/etc/alternatives/lxdm.conf" |
| 67 |
fi |
| 68 |
fi |
| 69 |
|
| 70 |
# Add /etc/lxdm/lxdm.conf from alternative of lxdm configuration |
| 71 |
if [ "$1" = configure ]; then |
| 72 |
update-alternatives --install /etc/lxdm/default.conf \ |
| 73 |
lxdm.conf /etc/lxdm/lxdm.conf 50 |
| 74 |
fi |
| 75 |
|
| 76 |
#DEBHELPER# |
| 77 |
|
| 78 |
exit 0 |