mrrfv / open-android-backup

Back up your device without vendor lock-ins, using insecure software or root. Supports encryption and compression out of the box. Works cross-platform.
http://openandroidbackup.me/
GNU General Public License v3.0
674 stars 37 forks source link

Foreground color isn't reset #65

Closed lemzwerg closed 1 year ago

lemzwerg commented 1 year ago

[31e87001903269c1b5189f9290dd60b6631628d7]

System info

Available disk space: ­– Operating system: openSUSE Leap 15.4 (GNU/Linux)

The backup script sets the foreground color of the console to yellow for logging messages, which is nice. However, after exiting, the color isn't properly reset and stays yellow. In case it matters, I use KDE's 'konsole' application version 21.12.3 together with 'newt' version 0.52.20 (which is quite an old version that comes with this openSUSE version). Maybe this is a bug in newt? Anyway, I suggest to explicitly reset the color.

mrrfv commented 1 year ago

Could you please try going to the functions directory in the project files, editing the cecho function in helper.sh so it calls tput sgr0 instead of tput init and running the script again? This patch could fix the problem. Let me know if it helped so I can update the code in the repo.

https://github.com/mrrfv/open-android-backup/blob/7237267e0842afdc63ef8c60c01164d8bf2a8df4/functions/helper.sh#L13-L20

lemzwerg commented 1 year ago

I applied

diff --git a/functions/helper.sh b/functions/helper.sh
index c39436b..07a0d7c 100644
--- a/functions/helper.sh
+++ b/functions/helper.sh
@@ -13,7 +13,7 @@ function wait_for_enter() {
 # "cecho" makes output messages yellow, if possible
 function cecho() {
   if tty -s; then
-    echo "$(tput setaf 11)$1$(tput init)"
+    echo "$(tput setaf 11)$1$(tput sgr0)"
   else
     echo "$1"
   fi

and it doesn't help.

lemzwerg commented 1 year ago

I have to correct myself – I was fooled by #67. It works, thanks :slightly_smiling_face: