From dc647fd5af8a48c5fa421456bdf52194303a1412 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sl=C3=A1vek=20Banko?= Date: Sun, 15 Sep 2013 01:40:28 +0200 Subject: Fix former service and diverts in rename-meta on Debian and Ubuntu --- .../rename-meta/debian/kdesudo-trinity.preinst | 13 ++ .../rename-meta/debian/kdm-trinity.postinst | 89 ------------- .../rename-meta/debian/kdm-trinity.preinst | 146 +++++++++++++++++++++ .../debian/kio-umountwrapper-trinity.preinst | 22 ++++ 4 files changed, 181 insertions(+), 89 deletions(-) create mode 100644 debian/wheezy/metapackages/rename-meta/debian/kdesudo-trinity.preinst delete mode 100644 debian/wheezy/metapackages/rename-meta/debian/kdm-trinity.postinst create mode 100644 debian/wheezy/metapackages/rename-meta/debian/kdm-trinity.preinst create mode 100644 debian/wheezy/metapackages/rename-meta/debian/kio-umountwrapper-trinity.preinst (limited to 'debian/wheezy/metapackages/rename-meta') diff --git a/debian/wheezy/metapackages/rename-meta/debian/kdesudo-trinity.preinst b/debian/wheezy/metapackages/rename-meta/debian/kdesudo-trinity.preinst new file mode 100644 index 000000000..12e16e22d --- /dev/null +++ b/debian/wheezy/metapackages/rename-meta/debian/kdesudo-trinity.preinst @@ -0,0 +1,13 @@ +#! /bin/sh + +set -e + +package_name=kdesudo-trinity + +divert=`dpkg-divert --listpackage "/opt/trinity/bin/kdesu"` +if [ -n "$divert" ] && [ "$divert" = $package_name ]; then + dpkg-divert --package $package_name --rename --remove \ + /opt/trinity/bin/kdesu +fi + +exit 0 diff --git a/debian/wheezy/metapackages/rename-meta/debian/kdm-trinity.postinst b/debian/wheezy/metapackages/rename-meta/debian/kdm-trinity.postinst deleted file mode 100644 index e026f2bfe..000000000 --- a/debian/wheezy/metapackages/rename-meta/debian/kdm-trinity.postinst +++ /dev/null @@ -1,89 +0,0 @@ -#! /bin/sh -# postinst script for kdm-trinity -# -# see: dh_installdeb(1) - -set -e - -# debconf may not be available if some massive purging is going on -HAVE_DEBCONF= -if [ -e /usr/share/debconf/confmodule ]; then - . /usr/share/debconf/confmodule - HAVE_DEBCONF=yes -fi - -DEFAULT_DISPLAY_MANAGER_FILE=/etc/X11/default-display-manager - - if [ -n "$HAVE_DEBCONF" ]; then - # disown this question - db_unregister shared/default-x-display-manager || true - # does the question still exist? - if db_get shared/default-x-display-manager; then - if db_metaget shared/default-x-display-manager owners; then - # FIXME - redo this part uses shell-lib.sh from xfree86 - #observe "X display managers now available are \"$OWNERS\"" - db_subst shared/default-x-display-manager choices "$RET" - fi - DEFAULT_DISPLAY_MANAGER= - if db_get shared/default-x-display-manager; then - DEFAULT_DISPLAY_MANAGER="$RET" - fi - # are we removing the currently selected display manager? - if [ -n "$DEFAULT_DISPLAY_MANAGER" ]; then - if [ "kdm-trinity" = "$DEFAULT_DISPLAY_MANAGER" ]; then - if [ -e "$DEFAULT_DISPLAY_MANAGER_FILE" ]; then - if db_get "$DEFAULT_DISPLAY_MANAGER/daemon_name"; then - # does the display manager file reference the current default? if - # so, remove it because it will now be wrong - if [ -n "$RET" ]; then - if [ "$(cat "$DEFAULT_DISPLAY_MANAGER_FILE")" = "$RET" ]; then - rm "$DEFAULT_DISPLAY_MANAGER_FILE" - fi - fi - fi - fi - # ask the user to choose a new default - db_fset shared/default-x-display-manager seen false - db_input critical shared/default-x-display-manager || true - db_go - # if the default display manager file doesn't exist, write it with - # the path to the new 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 - # FIXME - redo this part uses shell-lib.sh from xfree86 - #warn "new default display manager has been selected; please be" \ - # "sure to run \"dpkg-reconfigure $RET\" to ensure that it" \ - # "is configured" - 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 - echo "$DAEMON_NAME" > "$DEFAULT_DISPLAY_MANAGER_FILE" - fi - fi - fi - fi - fi - fi - fi - -exit 0 - diff --git a/debian/wheezy/metapackages/rename-meta/debian/kdm-trinity.preinst b/debian/wheezy/metapackages/rename-meta/debian/kdm-trinity.preinst new file mode 100644 index 000000000..391d99542 --- /dev/null +++ b/debian/wheezy/metapackages/rename-meta/debian/kdm-trinity.preinst @@ -0,0 +1,146 @@ +#! /bin/sh +# preinst script for kdm-trinity +# +# see: dh_installdeb(1) + +set -e + +# debconf may not be available if some massive purging is going on +HAVE_DEBCONF= +if [ -e /usr/share/debconf/confmodule ]; then + . /usr/share/debconf/confmodule + HAVE_DEBCONF=yes +fi + +# remove former service +if [ -e /etc/init.d/kdm-trinity ]; then + REMOVING=yes + rm -f /etc/init.d/kdm-trinity +fi + +if [ -n "$REMOVING" ]; then + # is there an kdm process running? + if start-stop-daemon --stop --quiet --signal 0 --name kdm-trinity; then + # any children? + PARENTS=$(pidof /usr/bin/kdm-trinity || true) + CHILDREN= + if [ -n "$PARENTS" ]; then + for PROCESS in $PARENTS; do + # make sure we got numbers back + [ $PROCESS -eq $PROCESS ] 2> /dev/null || + exit + # FIXME - redo this part uses shell-lib.sh from xfree86 + # die "pidof returned non-numeric value" + # we could use grep -q here if ps would ignore SIGPIPE :-P + if (ps axj | grep "^ *$PROCESS" > /dev/null 2>&1); then + CHILDREN=yes + fi + done + if [ -n "$CHILDREN" ]; then + if [ -n "$HAVE_DEBCONF" ]; then + # ask the question + db_input high kdm/stop_running_server_with_children || true + db_go + # what did the user say? + ANSWER= + if db_get kdm/stop_running_server_with_children; then + ANSWER="$RET" + fi + if [ "$ANSWER" = "true" ]; then + STOP=yes + fi + # forget that we have seen the question; this is the sort of + # non-configuration question that should be asked every time + db_fset kdm/stop_running_server_with_children seen false + fi + else + STOP=yes + fi + fi + fi +fi + +if [ -n "$STOP" ]; then + if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then + invoke-rc.d kdm-trinity stop || true + else + /etc/init.d/kdm-trinity stop || true + fi +fi + + +DEFAULT_DISPLAY_MANAGER_FILE=/etc/X11/default-display-manager + + if [ -n "$HAVE_DEBCONF" ]; then + # disown this question + db_unregister shared/default-x-display-manager || true + # does the question still exist? + if db_get shared/default-x-display-manager; then + if db_metaget shared/default-x-display-manager owners; then + # FIXME - redo this part uses shell-lib.sh from xfree86 + #observe "X display managers now available are \"$OWNERS\"" + db_subst shared/default-x-display-manager choices "$RET" + fi + DEFAULT_DISPLAY_MANAGER= + if db_get shared/default-x-display-manager; then + DEFAULT_DISPLAY_MANAGER="$RET" + fi + # are we removing the currently selected display manager? + if [ -n "$DEFAULT_DISPLAY_MANAGER" ]; then + if [ "kdm-trinity" = "$DEFAULT_DISPLAY_MANAGER" ]; then + if [ -e "$DEFAULT_DISPLAY_MANAGER_FILE" ]; then + if db_get "$DEFAULT_DISPLAY_MANAGER/daemon_name"; then + # does the display manager file reference the current default? if + # so, remove it because it will now be wrong + if [ -n "$RET" ]; then + if [ "$(cat "$DEFAULT_DISPLAY_MANAGER_FILE")" = "$RET" ]; then + rm "$DEFAULT_DISPLAY_MANAGER_FILE" + fi + fi + fi + fi + # ask the user to choose a new default + db_fset shared/default-x-display-manager seen false + db_input critical shared/default-x-display-manager || true + db_go + # if the default display manager file doesn't exist, write it with + # the path to the new 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 + # FIXME - redo this part uses shell-lib.sh from xfree86 + #warn "new default display manager has been selected; please be" \ + # "sure to run \"dpkg-reconfigure $RET\" to ensure that it" \ + # "is configured" + 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 + echo "$DAEMON_NAME" > "$DEFAULT_DISPLAY_MANAGER_FILE" + fi + fi + fi + fi + fi + fi + fi + +exit 0 + diff --git a/debian/wheezy/metapackages/rename-meta/debian/kio-umountwrapper-trinity.preinst b/debian/wheezy/metapackages/rename-meta/debian/kio-umountwrapper-trinity.preinst new file mode 100644 index 000000000..b7af2273b --- /dev/null +++ b/debian/wheezy/metapackages/rename-meta/debian/kio-umountwrapper-trinity.preinst @@ -0,0 +1,22 @@ +#! /bin/sh + +set -e + +package_name=kio-umountwrapper-trinity + +divert=`dpkg-divert --listpackage "/opt/trinity/share/apps/konqueror/servicemenus/media_safelyremove.desktop"` +if [ -n "$divert" ] && [ "$divert" = $package_name ]; then + dpkg-divert --package $package_name --remove --rename /opt/trinity/share/apps/konqueror/servicemenus/media_safelyremove.desktop +fi + +divert=`dpkg-divert --listpackage "/opt/trinity/share/apps/dolphin/servicemenus/media_safelyremove.desktop"` +if [ -n "$divert" ] && [ "$divert" = $package_name ]; then + dpkg-divert --package $package_name --remove --rename /opt/trinity/share/apps/dolphin/servicemenus/media_safelyremove.desktop +fi + +divert=`dpkg-divert --listpackage "/opt/trinity/share/apps/d3lphin/servicemenus/media_safelyremove.desktop"` +if [ -n "$divert" ] && [ "$divert" = $package_name ]; then + dpkg-divert --package $package_name --remove --rename /opt/trinity/share/apps/d3lphin/servicemenus/media_safelyremove.desktop +fi + +exit 0 -- cgit v1.2.1