summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatías Fonzo <selk@dragora.org>2020-03-23 18:16:50 -0300
committerMatías Fonzo <selk@dragora.org>2020-03-24 17:15:05 -0300
commit5ae691eb44a0f9a6e41b3bd1a4c7eeda4b66d935 (patch)
tree74d789ef4547b41fb3bc6af023cf5268ece03476
parent5499505b47f785c6095073a34bf2b7b8bd73b7f7 (diff)
downloadtdebase-5ae691eb44a0f9a6e41b3bd1a4c7eeda4b66d935.tar.gz
tdebase-5ae691eb44a0f9a6e41b3bd1a4c7eeda4b66d935.zip
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>
-rwxr-xr-xmigratekde347
1 files changed, 19 insertions, 28 deletions
diff --git a/migratekde3 b/migratekde3
index eff7f182e..ea2334bd4 100755
--- a/migratekde3
+++ b/migratekde3
@@ -38,24 +38,25 @@
Wait_For_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
- read -r -p "$1 (y/n): " yn
- case $yn in
- [Yy]* ) response=y; break;;
- [Nn]* ) response=n; break;;
- * ) echo "Please answer yes (y/Y) or no (n/N).";;
+ printf "%s" "$1 (y/n): " > /dev/tty
+ IFS= read -r ANSWER < /dev/tty || exit 1;
+ case $ANSWER in
+ y* | Y* ) response=y; break;;
+ n* | N* ) response=n; break;;
+ * ) echo "Please answer yes (y/Y) or no (n/N)." > /dev/tty;;
esac
done
+unset ANSWER
}
Proceed_From_Response () {
-if [ "$response" = "n" -o "$response" = "N" ]; then
+if [ "$response" = "n" ]; then
echo "Exiting."
echo
exit 0
else
+ unset response
echo "Continuing."
echo
fi
@@ -107,28 +108,20 @@ fi
# To determine that location use the following method rather than presuming
# the existence of $TDEDIR. That environment variable might not be
# defined or defined to point to KDE4 binaries.
-BIN_DIR="`dirname \`readlink -f $0\``"
-if [ -x $BIN_DIR/tde-config ]; then
- TDE_VERSION="`$BIN_DIR/tde-config --version | grep TDE | awk '{print $2}'`"
+BIN_DIR="$(dirname -- "$0")"
+if [ -x ${BIN_DIR}/tde-config ]; then
+ 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
- export TDEDIR=${BIN_DIR%/bin}
echo "Trinity Desktop Environment base directory is $TDEDIR" 1>&2
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 "This script should be installed in the same directory."
- echo "Exiting."
- exit 1
- fi
+ 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 "Exiting."
+ exit 1
fi
-unset BIN_DIR
+unset BIN_DIR TDE_VERSION
+export TDEDIR
# 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.
@@ -469,8 +462,6 @@ unset LINK_NAME
unset AVAILABLE
unset PROFILE_SIZE
unset REMAINING_SPACE
-unset BIN_DIR
-unset TDE_VERSION
unset TDEHOME_LINK
unset CACHE_DIR
unset SOCKET_DIR