From ab0666a79313cc1b5e6ae7f71d566b31fb12c5b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sl=C3=A1vek=20Banko?= Date: Thu, 26 Jun 2014 01:13:08 +0200 Subject: [PATCH] Fixes for kdm-trinity and tdm-trinity on Debian and Ubuntu + remove kdm-trinity.conf during upgrade to tdm-trinity + remove tdm-trinity.conf when remove tdm-trinity + stop kdm-trinity during upgrade to tdm-trinity + start tdm-trinity during install tdm-trinity + stop tdm-trinity when remove tdm-trinity --- .../rename-meta/debian/kdm-trinity.preinst | 21 ++++++++++------- .../lenny/tdebase/debian/tdm-trinity.postinst | 2 +- debian/lenny/tdebase/debian/tdm-trinity.prerm | 23 +++++++++++-------- .../rename-meta/debian/kdm-trinity.preinst | 21 ++++++++++------- .../tdebase/debian/tdm-trinity.postinst | 2 +- .../squeeze/tdebase/debian/tdm-trinity.prerm | 23 +++++++++++-------- .../rename-meta/debian/kdm-trinity.preinst | 21 ++++++++++------- .../tdebase/debian/tdm-trinity.postinst | 2 +- .../maverick/tdebase/debian/tdm-trinity.prerm | 23 +++++++++++-------- 9 files changed, 84 insertions(+), 54 deletions(-) diff --git a/debian/lenny/metapackages/rename-meta/debian/kdm-trinity.preinst b/debian/lenny/metapackages/rename-meta/debian/kdm-trinity.preinst index 391d99542..f083d696c 100644 --- a/debian/lenny/metapackages/rename-meta/debian/kdm-trinity.preinst +++ b/debian/lenny/metapackages/rename-meta/debian/kdm-trinity.preinst @@ -14,15 +14,14 @@ fi # remove former service if [ -e /etc/init.d/kdm-trinity ]; then - REMOVING=yes - rm -f /etc/init.d/kdm-trinity + REMOVING=yes fi if [ -n "$REMOVING" ]; then - # is there an kdm process running? - if start-stop-daemon --stop --quiet --signal 0 --name kdm-trinity; then + # is there an kdm-trinity process running? + if start-stop-daemon --stop --quiet --signal 0 --exec /opt/trinity/bin/kdm; then # any children? - PARENTS=$(pidof /usr/bin/kdm-trinity || true) + PARENTS=$(pidof /opt/trinity/bin/kdm || true) CHILDREN= if [ -n "$PARENTS" ]; then for PROCESS in $PARENTS; do @@ -39,11 +38,11 @@ if [ -n "$REMOVING" ]; then if [ -n "$CHILDREN" ]; then if [ -n "$HAVE_DEBCONF" ]; then # ask the question - db_input high kdm/stop_running_server_with_children || true + db_input high kdm-trinity/stop_running_server_with_children || true db_go # what did the user say? ANSWER= - if db_get kdm/stop_running_server_with_children; then + if db_get kdm-trinity/stop_running_server_with_children; then ANSWER="$RET" fi if [ "$ANSWER" = "true" ]; then @@ -51,7 +50,7 @@ if [ -n "$REMOVING" ]; then 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 + db_fset kdm-trinity/stop_running_server_with_children seen false fi else STOP=yes @@ -68,6 +67,12 @@ if [ -n "$STOP" ]; then fi fi +if [ -n "$REMOVING" ]; then + rm -f /etc/init.d/kdm-trinity + [ ! -e /etc/init/kdm-trinity.conf ] || \ + rm -f /etc/init/kdm-trinity.conf +fi + DEFAULT_DISPLAY_MANAGER_FILE=/etc/X11/default-display-manager diff --git a/debian/lenny/tdebase/debian/tdm-trinity.postinst b/debian/lenny/tdebase/debian/tdm-trinity.postinst index fa0266639..dff8f8efb 100644 --- a/debian/lenny/tdebase/debian/tdm-trinity.postinst +++ b/debian/lenny/tdebase/debian/tdm-trinity.postinst @@ -63,7 +63,7 @@ for HOST in "" \ 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 +if start-stop-daemon --stop --quiet --signal 0 --pid /var/run/tdm.pid --exec /opt/trinity/bin/tdm; then NOSTART=yes fi # or if the options file says not to diff --git a/debian/lenny/tdebase/debian/tdm-trinity.prerm b/debian/lenny/tdebase/debian/tdm-trinity.prerm index 1ca8de60e..6247adb1f 100644 --- a/debian/lenny/tdebase/debian/tdm-trinity.prerm +++ b/debian/lenny/tdebase/debian/tdm-trinity.prerm @@ -24,14 +24,13 @@ if [ -e /usr/share/debconf/confmodule ]; then fi case "$1" in - # we NEVER want to unconditionally stop tdm; see below + # we NEVER want to unconditionally stop tdm-trinity; see below upgrade|failed-upgrade) REMOVING= ;; remove|deconfigure) REMOVING=yes - rm -f /etc/init.d/tdm-trinity ;; *) @@ -41,16 +40,16 @@ case "$1" in esac STOP= -# are we supposed to restart on upgrade? if REMOVING tdm, we don't care what +# are we supposed to restart on upgrade? if REMOVING tdm-trinity, we don't care what # the user says, we have to stop the daemon if grep -qs ^restart-on-upgrade /etc/trinity/tdm/tdm.options || [ -n "$REMOVING" ]; then # is there an tdm process running? - if start-stop-daemon --stop --quiet --signal 0 --name tdm-trinity; then + if start-stop-daemon --stop --quiet --signal 0 --exec /opt/trinity/bin/tdm; then # any children? - PARENTS=$(pidof /usr/bin/tdm-trinity || true) + PARENTS=$(pidof /opt/trinity/bin/tdm || true) CHILDREN= - if [ -n "$PARENTS" ]; then + if [ -n "$PARENTS" ]; then for PROCESS in $PARENTS; do # make sure we got numbers back [ $PROCESS -eq $PROCESS ] 2> /dev/null || @@ -65,11 +64,11 @@ if grep -qs ^restart-on-upgrade /etc/trinity/tdm/tdm.options || if [ -n "$CHILDREN" ]; then if [ -n "$HAVE_DEBCONF" ]; then # ask the question - db_input high tdm/stop_running_server_with_children || true + db_input high tdm-trinity/stop_running_server_with_children || true db_go # what did the user say? ANSWER= - if db_get tdm/stop_running_server_with_children; then + if db_get tdm-trinity/stop_running_server_with_children; then ANSWER="$RET" fi if [ "$ANSWER" = "true" ]; then @@ -77,7 +76,7 @@ if grep -qs ^restart-on-upgrade /etc/trinity/tdm/tdm.options || fi # forget that we have seen the question; this is the sort of # non-configuration question that should be asked every time - db_fset tdm/stop_running_server_with_children seen false + db_fset tdm-trinity/stop_running_server_with_children seen false fi else STOP=yes @@ -98,6 +97,12 @@ else fi fi +if [ -n "$REMOVING" ]; then + rm -f /etc/init.d/tdm-trinity + [ ! -e /etc/init/tdm-trinity.conf ] || \ + rm -f /etc/init/tdm-trinity.conf +fi + DEFAULT_DISPLAY_MANAGER_FILE=/etc/X11/default-display-manager if [ "$1" = "remove" -o "$1" = "deconfigure" ]; then diff --git a/debian/squeeze/metapackages/rename-meta/debian/kdm-trinity.preinst b/debian/squeeze/metapackages/rename-meta/debian/kdm-trinity.preinst index 391d99542..f083d696c 100644 --- a/debian/squeeze/metapackages/rename-meta/debian/kdm-trinity.preinst +++ b/debian/squeeze/metapackages/rename-meta/debian/kdm-trinity.preinst @@ -14,15 +14,14 @@ fi # remove former service if [ -e /etc/init.d/kdm-trinity ]; then - REMOVING=yes - rm -f /etc/init.d/kdm-trinity + REMOVING=yes fi if [ -n "$REMOVING" ]; then - # is there an kdm process running? - if start-stop-daemon --stop --quiet --signal 0 --name kdm-trinity; then + # is there an kdm-trinity process running? + if start-stop-daemon --stop --quiet --signal 0 --exec /opt/trinity/bin/kdm; then # any children? - PARENTS=$(pidof /usr/bin/kdm-trinity || true) + PARENTS=$(pidof /opt/trinity/bin/kdm || true) CHILDREN= if [ -n "$PARENTS" ]; then for PROCESS in $PARENTS; do @@ -39,11 +38,11 @@ if [ -n "$REMOVING" ]; then if [ -n "$CHILDREN" ]; then if [ -n "$HAVE_DEBCONF" ]; then # ask the question - db_input high kdm/stop_running_server_with_children || true + db_input high kdm-trinity/stop_running_server_with_children || true db_go # what did the user say? ANSWER= - if db_get kdm/stop_running_server_with_children; then + if db_get kdm-trinity/stop_running_server_with_children; then ANSWER="$RET" fi if [ "$ANSWER" = "true" ]; then @@ -51,7 +50,7 @@ if [ -n "$REMOVING" ]; then 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 + db_fset kdm-trinity/stop_running_server_with_children seen false fi else STOP=yes @@ -68,6 +67,12 @@ if [ -n "$STOP" ]; then fi fi +if [ -n "$REMOVING" ]; then + rm -f /etc/init.d/kdm-trinity + [ ! -e /etc/init/kdm-trinity.conf ] || \ + rm -f /etc/init/kdm-trinity.conf +fi + DEFAULT_DISPLAY_MANAGER_FILE=/etc/X11/default-display-manager diff --git a/debian/squeeze/tdebase/debian/tdm-trinity.postinst b/debian/squeeze/tdebase/debian/tdm-trinity.postinst index fa0266639..dff8f8efb 100644 --- a/debian/squeeze/tdebase/debian/tdm-trinity.postinst +++ b/debian/squeeze/tdebase/debian/tdm-trinity.postinst @@ -63,7 +63,7 @@ for HOST in "" \ 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 +if start-stop-daemon --stop --quiet --signal 0 --pid /var/run/tdm.pid --exec /opt/trinity/bin/tdm; then NOSTART=yes fi # or if the options file says not to diff --git a/debian/squeeze/tdebase/debian/tdm-trinity.prerm b/debian/squeeze/tdebase/debian/tdm-trinity.prerm index 1ca8de60e..6247adb1f 100644 --- a/debian/squeeze/tdebase/debian/tdm-trinity.prerm +++ b/debian/squeeze/tdebase/debian/tdm-trinity.prerm @@ -24,14 +24,13 @@ if [ -e /usr/share/debconf/confmodule ]; then fi case "$1" in - # we NEVER want to unconditionally stop tdm; see below + # we NEVER want to unconditionally stop tdm-trinity; see below upgrade|failed-upgrade) REMOVING= ;; remove|deconfigure) REMOVING=yes - rm -f /etc/init.d/tdm-trinity ;; *) @@ -41,16 +40,16 @@ case "$1" in esac STOP= -# are we supposed to restart on upgrade? if REMOVING tdm, we don't care what +# are we supposed to restart on upgrade? if REMOVING tdm-trinity, we don't care what # the user says, we have to stop the daemon if grep -qs ^restart-on-upgrade /etc/trinity/tdm/tdm.options || [ -n "$REMOVING" ]; then # is there an tdm process running? - if start-stop-daemon --stop --quiet --signal 0 --name tdm-trinity; then + if start-stop-daemon --stop --quiet --signal 0 --exec /opt/trinity/bin/tdm; then # any children? - PARENTS=$(pidof /usr/bin/tdm-trinity || true) + PARENTS=$(pidof /opt/trinity/bin/tdm || true) CHILDREN= - if [ -n "$PARENTS" ]; then + if [ -n "$PARENTS" ]; then for PROCESS in $PARENTS; do # make sure we got numbers back [ $PROCESS -eq $PROCESS ] 2> /dev/null || @@ -65,11 +64,11 @@ if grep -qs ^restart-on-upgrade /etc/trinity/tdm/tdm.options || if [ -n "$CHILDREN" ]; then if [ -n "$HAVE_DEBCONF" ]; then # ask the question - db_input high tdm/stop_running_server_with_children || true + db_input high tdm-trinity/stop_running_server_with_children || true db_go # what did the user say? ANSWER= - if db_get tdm/stop_running_server_with_children; then + if db_get tdm-trinity/stop_running_server_with_children; then ANSWER="$RET" fi if [ "$ANSWER" = "true" ]; then @@ -77,7 +76,7 @@ if grep -qs ^restart-on-upgrade /etc/trinity/tdm/tdm.options || fi # forget that we have seen the question; this is the sort of # non-configuration question that should be asked every time - db_fset tdm/stop_running_server_with_children seen false + db_fset tdm-trinity/stop_running_server_with_children seen false fi else STOP=yes @@ -98,6 +97,12 @@ else fi fi +if [ -n "$REMOVING" ]; then + rm -f /etc/init.d/tdm-trinity + [ ! -e /etc/init/tdm-trinity.conf ] || \ + rm -f /etc/init/tdm-trinity.conf +fi + DEFAULT_DISPLAY_MANAGER_FILE=/etc/X11/default-display-manager if [ "$1" = "remove" -o "$1" = "deconfigure" ]; then diff --git a/ubuntu/maverick/metapackages/rename-meta/debian/kdm-trinity.preinst b/ubuntu/maverick/metapackages/rename-meta/debian/kdm-trinity.preinst index 391d99542..f083d696c 100644 --- a/ubuntu/maverick/metapackages/rename-meta/debian/kdm-trinity.preinst +++ b/ubuntu/maverick/metapackages/rename-meta/debian/kdm-trinity.preinst @@ -14,15 +14,14 @@ fi # remove former service if [ -e /etc/init.d/kdm-trinity ]; then - REMOVING=yes - rm -f /etc/init.d/kdm-trinity + REMOVING=yes fi if [ -n "$REMOVING" ]; then - # is there an kdm process running? - if start-stop-daemon --stop --quiet --signal 0 --name kdm-trinity; then + # is there an kdm-trinity process running? + if start-stop-daemon --stop --quiet --signal 0 --exec /opt/trinity/bin/kdm; then # any children? - PARENTS=$(pidof /usr/bin/kdm-trinity || true) + PARENTS=$(pidof /opt/trinity/bin/kdm || true) CHILDREN= if [ -n "$PARENTS" ]; then for PROCESS in $PARENTS; do @@ -39,11 +38,11 @@ if [ -n "$REMOVING" ]; then if [ -n "$CHILDREN" ]; then if [ -n "$HAVE_DEBCONF" ]; then # ask the question - db_input high kdm/stop_running_server_with_children || true + db_input high kdm-trinity/stop_running_server_with_children || true db_go # what did the user say? ANSWER= - if db_get kdm/stop_running_server_with_children; then + if db_get kdm-trinity/stop_running_server_with_children; then ANSWER="$RET" fi if [ "$ANSWER" = "true" ]; then @@ -51,7 +50,7 @@ if [ -n "$REMOVING" ]; then 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 + db_fset kdm-trinity/stop_running_server_with_children seen false fi else STOP=yes @@ -68,6 +67,12 @@ if [ -n "$STOP" ]; then fi fi +if [ -n "$REMOVING" ]; then + rm -f /etc/init.d/kdm-trinity + [ ! -e /etc/init/kdm-trinity.conf ] || \ + rm -f /etc/init/kdm-trinity.conf +fi + DEFAULT_DISPLAY_MANAGER_FILE=/etc/X11/default-display-manager diff --git a/ubuntu/maverick/tdebase/debian/tdm-trinity.postinst b/ubuntu/maverick/tdebase/debian/tdm-trinity.postinst index b0caf668a..d41437889 100644 --- a/ubuntu/maverick/tdebase/debian/tdm-trinity.postinst +++ b/ubuntu/maverick/tdebase/debian/tdm-trinity.postinst @@ -63,7 +63,7 @@ for HOST in "" \ 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 +if start-stop-daemon --stop --quiet --signal 0 --pid /var/run/tdm.pid --exec /opt/trinity/bin/tdm; then NOSTART=yes fi # or if the options file says not to diff --git a/ubuntu/maverick/tdebase/debian/tdm-trinity.prerm b/ubuntu/maverick/tdebase/debian/tdm-trinity.prerm index 1ca8de60e..6247adb1f 100644 --- a/ubuntu/maverick/tdebase/debian/tdm-trinity.prerm +++ b/ubuntu/maverick/tdebase/debian/tdm-trinity.prerm @@ -24,14 +24,13 @@ if [ -e /usr/share/debconf/confmodule ]; then fi case "$1" in - # we NEVER want to unconditionally stop tdm; see below + # we NEVER want to unconditionally stop tdm-trinity; see below upgrade|failed-upgrade) REMOVING= ;; remove|deconfigure) REMOVING=yes - rm -f /etc/init.d/tdm-trinity ;; *) @@ -41,16 +40,16 @@ case "$1" in esac STOP= -# are we supposed to restart on upgrade? if REMOVING tdm, we don't care what +# are we supposed to restart on upgrade? if REMOVING tdm-trinity, we don't care what # the user says, we have to stop the daemon if grep -qs ^restart-on-upgrade /etc/trinity/tdm/tdm.options || [ -n "$REMOVING" ]; then # is there an tdm process running? - if start-stop-daemon --stop --quiet --signal 0 --name tdm-trinity; then + if start-stop-daemon --stop --quiet --signal 0 --exec /opt/trinity/bin/tdm; then # any children? - PARENTS=$(pidof /usr/bin/tdm-trinity || true) + PARENTS=$(pidof /opt/trinity/bin/tdm || true) CHILDREN= - if [ -n "$PARENTS" ]; then + if [ -n "$PARENTS" ]; then for PROCESS in $PARENTS; do # make sure we got numbers back [ $PROCESS -eq $PROCESS ] 2> /dev/null || @@ -65,11 +64,11 @@ if grep -qs ^restart-on-upgrade /etc/trinity/tdm/tdm.options || if [ -n "$CHILDREN" ]; then if [ -n "$HAVE_DEBCONF" ]; then # ask the question - db_input high tdm/stop_running_server_with_children || true + db_input high tdm-trinity/stop_running_server_with_children || true db_go # what did the user say? ANSWER= - if db_get tdm/stop_running_server_with_children; then + if db_get tdm-trinity/stop_running_server_with_children; then ANSWER="$RET" fi if [ "$ANSWER" = "true" ]; then @@ -77,7 +76,7 @@ if grep -qs ^restart-on-upgrade /etc/trinity/tdm/tdm.options || fi # forget that we have seen the question; this is the sort of # non-configuration question that should be asked every time - db_fset tdm/stop_running_server_with_children seen false + db_fset tdm-trinity/stop_running_server_with_children seen false fi else STOP=yes @@ -98,6 +97,12 @@ else fi fi +if [ -n "$REMOVING" ]; then + rm -f /etc/init.d/tdm-trinity + [ ! -e /etc/init/tdm-trinity.conf ] || \ + rm -f /etc/init/tdm-trinity.conf +fi + DEFAULT_DISPLAY_MANAGER_FILE=/etc/X11/default-display-manager if [ "$1" = "remove" -o "$1" = "deconfigure" ]; then