migratekde3: Refresh script (a bit) to be accorded with the changes made for the starttde and the r14-xdg-update script

Signed-off-by: Matías Fonzo <selk@dragora.org>
(cherry picked from commit 5ae691eb44)
pull/182/head
Matías Fonzo 4 years ago committed by Michele Calgaro
parent 313064bbff
commit 94f0f4dbce
Signed by: MicheleC
GPG Key ID: 2A75B7CA8ADED5CF

@ -38,24 +38,25 @@
Wait_For_Response () { Wait_For_Response () {
unset response unset response
# -r Backslash does not act as an escape character.
# -p Display "PROMPT" without a trailing newline, before attempting to read any input.
while true; do while true; do
read -r -p "$1 (y/n): " yn printf "%s" "$1 (y/n): " > /dev/tty
case $yn in IFS= read -r ANSWER < /dev/tty || exit 1;
[Yy]* ) response=y; break;; case $ANSWER in
[Nn]* ) response=n; break;; y* | Y* ) response=y; break;;
* ) echo "Please answer yes (y/Y) or no (n/N).";; n* | N* ) response=n; break;;
* ) echo "Please answer yes (y/Y) or no (n/N)." > /dev/tty;;
esac esac
done done
unset ANSWER
} }
Proceed_From_Response () { Proceed_From_Response () {
if [ "$response" = "n" -o "$response" = "N" ]; then if [ "$response" = "n" ]; then
echo "Exiting." echo "Exiting."
echo echo
exit 0 exit 0
else else
unset response
echo "Continuing." echo "Continuing."
echo echo
fi fi
@ -107,28 +108,20 @@ fi
# To determine that location use the following method rather than presuming # To determine that location use the following method rather than presuming
# the existence of $TDEDIR. That environment variable might not be # the existence of $TDEDIR. That environment variable might not be
# defined or defined to point to KDE4 binaries. # defined or defined to point to KDE4 binaries.
BIN_DIR="`dirname \`readlink -f $0\``" BIN_DIR="$(dirname -- "$0")"
if [ -x $BIN_DIR/tde-config ]; then if [ -x ${BIN_DIR}/tde-config ]; then
TDE_VERSION="`$BIN_DIR/tde-config --version | grep TDE | awk '{print $2}'`" TDE_VERSION="$( ${BIN_DIR}/tde-config --version | sed -n 's|^TDE: ||p' )"
TDEDIR="${BIN_DIR%/bin}"
echo "Trinity Desktop Environment version is $TDE_VERSION" 1>&2 echo "Trinity Desktop Environment version is $TDE_VERSION" 1>&2
export TDEDIR=${BIN_DIR%/bin}
echo "Trinity Desktop Environment base directory is $TDEDIR" 1>&2 echo "Trinity Desktop Environment base directory is $TDEDIR" 1>&2
else else
# This might be a Trinity version before kde-config was renamed to tde-config.
# Don't use kde-config because of a bug that always creates a $TDEHOME directory.
if [ -x $BIN_DIR/konqueror ]; then
TDE_VERSION="`$BIN_DIR/konqueror --version | grep KDE | awk '{print $2}'`"
echo "Trinity Desktop Environment version is $TDE_VERSION" 1>&2
export TDEDIR=${BIN_DIR%/bin}
echo "Trinity Desktop Environment base directory is $TDEDIR" 1>&2
else
echo "Unable to determine the TDE bin directory, where this script should be installed." echo "Unable to determine the TDE bin directory, where this script should be installed."
echo "This script should be installed in the same directory." echo "This script should be installed in the same directory."
echo "Exiting." echo "Exiting."
exit 1 exit 1
fi
fi fi
unset BIN_DIR unset BIN_DIR TDE_VERSION
export TDEDIR
# Trap when the user runs this script while in a Trinity session. # Trap when the user runs this script while in a Trinity session.
# Most files can be updated "live" but some can't, such as kdeglobals. # Most files can be updated "live" but some can't, such as kdeglobals.
@ -469,8 +462,6 @@ unset LINK_NAME
unset AVAILABLE unset AVAILABLE
unset PROFILE_SIZE unset PROFILE_SIZE
unset REMAINING_SPACE unset REMAINING_SPACE
unset BIN_DIR
unset TDE_VERSION
unset TDEHOME_LINK unset TDEHOME_LINK
unset CACHE_DIR unset CACHE_DIR
unset SOCKET_DIR unset SOCKET_DIR

Loading…
Cancel
Save