diff options
author | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2012-09-10 16:16:32 -0500 |
---|---|---|
committer | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2012-09-10 16:16:32 -0500 |
commit | 02dc85a95b228b7242b0d11ea35619faad96db03 (patch) | |
tree | e161ba877a0720bbdf7818bdec06eb239d8ad271 /ubuntu/precise/tdebase/debian/tdm-trinity.postinst | |
parent | 6f2c7dc70e77d2f768d687838b6cc9f7632f609e (diff) | |
download | tde-packaging-02dc85a95b228b7242b0d11ea35619faad96db03.tar.gz tde-packaging-02dc85a95b228b7242b0d11ea35619faad96db03.zip |
Split precise from maverick
Diffstat (limited to 'ubuntu/precise/tdebase/debian/tdm-trinity.postinst')
-rw-r--r-- | ubuntu/precise/tdebase/debian/tdm-trinity.postinst | 125 |
1 files changed, 125 insertions, 0 deletions
diff --git a/ubuntu/precise/tdebase/debian/tdm-trinity.postinst b/ubuntu/precise/tdebase/debian/tdm-trinity.postinst new file mode 100644 index 000000000..5f1aab168 --- /dev/null +++ b/ubuntu/precise/tdebase/debian/tdm-trinity.postinst @@ -0,0 +1,125 @@ +#! /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 + DEFAULT_DISPLAY_MANAGER= + 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 + +# restarting the daemon may cause output to stdout +db_stop + +# don't start tdm if we are upgrading without stopping it +NOSTART= +if [ -e /var/run/tdm-trinity.upgrade ]; then + 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 +if start-stop-daemon --stop --quiet --signal 0 --pid /var/run/tdm.pid --name tdm-trinity; then + NOSTART=yes +fi +# or if the options file says not to +if ! grep -qs ^restart-on-upgrade /etc/trinity/tdm/tdm.options; then + NOSTART=yes +fi + + +# md5sum of the stock Xservers shipped with KDE 3.3.2, which shipped with Sarge +SARGEXSERVERS=d3ab063f564492e0e31830f56ccd350e + +CONFIGLEVEL=`grep -s ^ConfigVersion= /etc/trinity/tdm/tdmrc | sed s/^ConfigVersion=//` + +if [ -e /etc/trinity/tdm/tdmrc ]; then + if dpkg --compare-versions "$CONFIGLEVEL" ge "2.3"; then + TDMRCUPDATED=yes + fi +fi + +if [ -e /etc/trinity/tdm/Xservers ]; then + if [ `md5sum /etc/trinity/tdm/Xservers | sed s/\ .*$//` = $SARGEXSERVERS ]; then + XSERVERSUNCHANGED=yes + fi +fi + +# With KDE 3.4, /etc/trinity/tdm/Xservers is no longer required, so we remove it, if +# the user has updated their tdmrc (if they haven't, tdm notices and keeps using +# Xservers), and if it wasn't touched, i.e. there are no local changes the user +# will want to merge into tdmrc. + +case "$1" in + + configure) + + 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." + fi + + rm -f /etc/init.d/tdm-trinity + ln -s /lib/init/upstart-job /etc/init.d/tdm-trinity + + ;; + + abort-upgrade|abort-remove|abort-deconfigure) + ;; + + *) + echo "postinst called with unknown argument \`$1'" >&2 + exit 1 + ;; + +esac + +exit 0 |