You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
161 lines
5.2 KiB
161 lines
5.2 KiB
14 years ago
|
#! /bin/sh
|
||
|
|
||
|
set -e
|
||
|
|
||
|
# source debconf library
|
||
|
. /usr/share/debconf/confmodule
|
||
|
|
||
|
# debconf is not a registry, so we only fiddle with the default file if it
|
||
|
# does not exist
|
||
|
DEFAULT_DISPLAY_MANAGER_FILE=/etc/X11/default-display-manager
|
||
|
if [ ! -e "$DEFAULT_DISPLAY_MANAGER_FILE" ]; then
|
||
13 years ago
|
DEFAULT_DISPLAY_MANAGER=
|
||
14 years ago
|
if db_get shared/default-x-display-manager; then
|
||
|
DEFAULT_DISPLAY_MANAGER="$RET"
|
||
|
fi
|
||
|
if [ -n "$DEFAULT_DISPLAY_MANAGER" ]; then
|
||
|
DAEMON_NAME=
|
||
|
if db_get "$DEFAULT_DISPLAY_MANAGER"/daemon_name; then
|
||
|
DAEMON_NAME="$RET"
|
||
|
fi
|
||
|
if [ ! -n "$DAEMON_NAME" ]; then
|
||
|
# if we were unable to determine the name of the selected daemon (for
|
||
|
# instance, if the selected default display manager doesn't provide a
|
||
|
# daemon_name question), guess
|
||
|
DAEMON_NAME=$(which "$DEFAULT_DISPLAY_MANAGER" 2>/dev/null)
|
||
|
if [ ! -n "$DAEMON_NAME" ]; then
|
||
|
echo .
|
||
|
# FIXME - redo this part uses shell-lib.sh from xfree86
|
||
|
#warn "unable to determine path to default X display manager" \
|
||
|
# "$DEFAULT_DISPLAY_MANAGER; not updating" \
|
||
|
# "$DEFAULT_DISPLAY_MANAGER_FILE"
|
||
|
fi
|
||
|
fi
|
||
|
if [ -n "$DAEMON_NAME" ]; then
|
||
|
# FIXME - redo this part uses shell-lib.sh from xfree86
|
||
|
#observe "committing change of default X display manager"
|
||
|
echo "$DAEMON_NAME" > "$DEFAULT_DISPLAY_MANAGER_FILE"
|
||
|
fi
|
||
|
fi
|
||
|
fi
|
||
|
|
||
|
# remove the displaced old default display manager file if it exists
|
||
|
if [ -e "$DEFAULT_DISPLAY_MANAGER_FILE.dpkg-tmp" ]; then
|
||
|
rm "$DEFAULT_DISPLAY_MANAGER_FILE.dpkg-tmp"
|
||
|
fi
|
||
|
|
||
10 years ago
|
# set default-display-manager systemd service link according to our config
|
||
|
DEFAULT_SERVICE=/etc/systemd/system/display-manager.service
|
||
|
if [ "$1" = configure ] && [ -d /etc/systemd/system/ ]; then
|
||
|
if [ -e "$DEFAULT_DISPLAY_MANAGER_FILE" ]; then
|
||
|
SERVICE=/lib/systemd/system/$(basename $(cat "$DEFAULT_DISPLAY_MANAGER_FILE")).service
|
||
|
if [ -h "$DEFAULT_SERVICE" ] && [ $(readlink "$DEFAULT_SERVICE") = /dev/null ]; then
|
||
|
echo "Display manager service is masked" >&2
|
||
|
elif [ -e "$SERVICE" ]; then
|
||
|
ln -sf "$SERVICE" "$DEFAULT_SERVICE"
|
||
|
else
|
||
|
echo "WARNING: $SERVICE is the selected default display manager but does not exist" >&2
|
||
|
rm -f "$DEFAULT_SERVICE"
|
||
|
fi
|
||
|
else
|
||
|
rm -f "$DEFAULT_SERVICE"
|
||
|
fi
|
||
|
fi
|
||
|
|
||
14 years ago
|
# restarting the daemon may cause output to stdout
|
||
|
db_stop
|
||
|
|
||
13 years ago
|
# don't start tdm if we are upgrading without stopping it
|
||
14 years ago
|
NOSTART=
|
||
13 years ago
|
if [ -e /var/run/tdm-trinity.upgrade ]; then
|
||
14 years ago
|
NOSTART=yes
|
||
|
fi
|
||
|
# or if we're currently in X on the display it attempts to manage by default
|
||
|
for HOST in "" \
|
||
|
"localhost" \
|
||
|
"$(hostname 2> /dev/null)" \
|
||
|
"$(hostname -f 2> /dev/null)"; do
|
||
|
if echo "$DISPLAY" | grep -q "^$HOST:0.*"; then
|
||
|
NOSTART=yes
|
||
|
break
|
||
|
fi
|
||
|
done
|
||
|
# or if it's already running
|
||
9 years ago
|
if start-stop-daemon --stop --quiet --signal 0 --pidfile /var/run/tdm.pid --exec /opt/trinity/bin/tdm; then
|
||
14 years ago
|
NOSTART=yes
|
||
|
fi
|
||
|
# or if the options file says not to
|
||
13 years ago
|
if ! grep -qs ^restart-on-upgrade /etc/trinity/tdm/tdm.options; then
|
||
14 years ago
|
NOSTART=yes
|
||
|
fi
|
||
|
|
||
|
|
||
|
# md5sum of the stock Xservers shipped with KDE 3.3.2, which shipped with Sarge
|
||
|
SARGEXSERVERS=d3ab063f564492e0e31830f56ccd350e
|
||
|
|
||
13 years ago
|
CONFIGLEVEL=`grep -s ^ConfigVersion= /etc/trinity/tdm/tdmrc | sed s/^ConfigVersion=//`
|
||
14 years ago
|
|
||
13 years ago
|
if [ -e /etc/trinity/tdm/tdmrc ]; then
|
||
14 years ago
|
if dpkg --compare-versions "$CONFIGLEVEL" ge "2.3"; then
|
||
13 years ago
|
TDMRCUPDATED=yes
|
||
14 years ago
|
fi
|
||
|
fi
|
||
|
|
||
13 years ago
|
if [ -e /etc/trinity/tdm/Xservers ]; then
|
||
|
if [ `md5sum /etc/trinity/tdm/Xservers | sed s/\ .*$//` = $SARGEXSERVERS ]; then
|
||
14 years ago
|
XSERVERSUNCHANGED=yes
|
||
|
fi
|
||
|
fi
|
||
|
|
||
11 years ago
|
# From KDE 3.4, /etc/trinity/tdm/Xservers is no longer required, so we remove it, if
|
||
13 years ago
|
# the user has updated their tdmrc (if they haven't, tdm notices and keeps using
|
||
14 years ago
|
# Xservers), and if it wasn't touched, i.e. there are no local changes the user
|
||
13 years ago
|
# will want to merge into tdmrc.
|
||
14 years ago
|
|
||
|
case "$1" in
|
||
|
|
||
|
configure)
|
||
|
|
||
13 years ago
|
if [ ! -z $TDMRCUPDATED ] && [ ! -z $XSERVERSUNCHANGED ]; then
|
||
|
echo "Removing obsolete /etc/trinity/tdm/Xservers (detected no user changes)."
|
||
|
rm -f /etc/trinity/tdm/Xservers
|
||
|
elif [ ! -z $TDMRCUPDATED ] && [ -e /etc/trinity/tdm/Xservers ]; then
|
||
|
echo "Note that /etc/trinity/tdm/Xservers is no longer used by TDM."
|
||
|
echo "You must merge your changes (if any) into /etc/trinity/tdm/tdmrc manually."
|
||
|
echo "Otherwise, /etc/trinity/tdm/Xservers is safe to remove."
|
||
14 years ago
|
fi
|
||
|
|
||
13 years ago
|
rm -f /etc/init.d/tdm-trinity
|
||
|
ln -s /lib/init/upstart-job /etc/init.d/tdm-trinity
|
||
14 years ago
|
|
||
|
;;
|
||
|
|
||
|
abort-upgrade|abort-remove|abort-deconfigure)
|
||
|
;;
|
||
|
|
||
|
*)
|
||
|
echo "postinst called with unknown argument \`$1'" >&2
|
||
|
exit 1
|
||
|
;;
|
||
|
|
||
|
esac
|
||
|
|
||
10 years ago
|
# Upstart is not active?
|
||
9 years ago
|
UPSTART_DIVERT=`dpkg-divert --listpackage /sbin/initctl`
|
||
10 years ago
|
UPSTART_ACTIVE=`dbus-send --system --print-reply --dest=com.ubuntu.Upstart /com/ubuntu/Upstart org.freedesktop.DBus.Properties.Get string:com.ubuntu.Upstart0_6 string:version 2>/dev/null || true`
|
||
9 years ago
|
if [ -z "$UPSTART_DIVERT" ] && [ -z "$UPSTART_ACTIVE" ]; then
|
||
10 years ago
|
echo "Upstart is not active - masking initctl" >&2
|
||
|
dpkg-divert --local --rename --add /sbin/initctl
|
||
|
ln -s /bin/true /sbin/initctl
|
||
|
fi
|
||
|
|
||
10 years ago
|
#DEBHELPER#
|
||
|
|
||
10 years ago
|
# Upstart is not active?
|
||
9 years ago
|
if [ -z "$UPSTART_DIVERT" ] && [ -z "$UPSTART_ACTIVE" ]; then
|
||
10 years ago
|
rm /sbin/initctl
|
||
|
dpkg-divert --local --rename --remove /sbin/initctl
|
||
|
fi
|
||
|
|
||
14 years ago
|
exit 0
|