File: postinst

package info (click to toggle)
wdm 1.20-15
  • links: PTS
  • area: main
  • in suites: woody
  • size: 1,628 kB
  • ctags: 434
  • sloc: ansic: 1,901; sh: 733; makefile: 469; perl: 29
file content (85 lines) | stat: -rw-r--r-- 2,280 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#!/bin/sh
# Debian wdm package post-installation script
# Copyright 2001 Branden Robinson.
# Licensed under the GNU General Public License, version 2.  See the file
# /usr/share/common-licenses/GPL or <http://www.gnu.org/copyleft/gpl.txt>.

set -e

# source debconf library
. /usr/share/debconf/confmodule

THIS_PACKAGE=wdm
THIS_DISPLAY_MANAGER=/usr/bin/X11/wdm
DEFAULT_DISPLAY_MANAGER_FILE=/etc/X11/default-display-manager

message () {
  # pretty-print messages of arbitrary length
  echo "$*" | fold -s -w ${COLUMNS:-80} >&2;
}

message_nonl () {
  # pretty-print messages of arbitrary length (no trailing newline)
  echo -n "$*" | fold -s -w ${COLUMNS:-80} >&2;
}

errormsg () {
  # exit script with error
  message "$*"
  exit 1;
}

# debconf is not a registry, so we only fiddle with the default file if it
# does not exist
if [ ! -e $DEFAULT_DISPLAY_MANAGER_FILE ]; then
  db_get shared/default-x-display-manager
  if [ "$RET" = "$THIS_PACKAGE" ]; then
    echo "$THIS_DISPLAY_MANAGER" > $DEFAULT_DISPLAY_MANAGER_FILE
  fi
fi

NOSTART=
WDM_RUNNING=
# don't start wdm if we are upgrading without stopping it
if [ -e /var/run/wdm.upgrade ]; then
  NOSTART=yes
fi
# or if we're currently in X on the display it attempts to manage by default
for HOSTNAME in "" "localhost" "$(hostname)" "$(hostname -f)"; do
  if echo $DISPLAY | grep -q "^$HOSTNAME:0.*"; then
    NOSTART=yes
  fi
done
# or if it's already running
if start-stop-daemon --stop --quiet --signal 0 --pid /var/run/wdm.pid --exec /usr/bin/X11/wdm; then
  NOSTART=yes
  WDM_RUNNING=yes
fi
# or if the options file says not to
if ! grep -qs ^restart-on-upgrade /etc/X11/wdm/wdm.options; then
  NOSTART=yes
fi

if [ -n "$WDM_RUNNING" ]; then
  if [ -d /var/state/wdm ]; then
    message "Note: obsolete directory /var/state/wdm cannot be removed" \
            "because wdm is still running.  Reinstall the wdm package" \
            "(or remove the directory manually) when wdm is not running."
  fi
else
  if [ -d /var/state/wdm ]; then
    rm -r /var/state/wdm
  fi
fi

update_wdm_wmlist
update-rc.d wdm defaults 99 01 > /dev/null 2>&1

# redirect stdout to /dev/tty so debconf doesn't choke on it
[ -n "$NOSTART" ] || /etc/init.d/wdm start > /dev/tty || true

#DEBHELPER#

exit 0

# vim:set ai et sts=2 sw=2 tw=0: