From 408dddc9691230c1ad9aa50a2e74d5fc2c577b68 Mon Sep 17 00:00:00 2001 From: makigumo Date: Tue, 9 Apr 2019 21:52:56 +0200 Subject: [PATCH 1/2] security-fixes.sh: require a terminal to run --- security_fixes.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/security_fixes.sh b/security_fixes.sh index b642edf..fe54569 100644 --- a/security_fixes.sh +++ b/security_fixes.sh @@ -18,6 +18,7 @@ # You can download the latest version of this script from: # https://github.com/MiSTer-devel/Scripts_MiSTer +# Version 1.2.5 - 2019-04-08 - Allow to run from any terminal, not only SSH. # Version 1.2.4 - 2019-04-08 - Refined the check for standard root password. # Version 1.2.3 - 2019-04-04 - Refined the check for standard root password. # Version 1.2.2 - 2019-04-03 - Updated openssl deb package URL. @@ -38,10 +39,10 @@ then echo "on a MiSTer system." exit 1 fi -if [ "$SSH_CLIENT" == "" ] +if [ "$(tty)" == "not a tty" ] then echo "This script must be run" - echo "from a SSH terminal" + echo "from a SSH/UART terminal" echo "because it will ask" echo "some questions." exit 2 @@ -396,4 +397,4 @@ fi echo "" echo "Done!" echo "You can reboot now for actually applying changes." -exit 0 \ No newline at end of file +exit 0 From e92b6a724b7d9712fcd2f7c21c7f1c6f826849a3 Mon Sep 17 00:00:00 2001 From: makigumo Date: Wed, 10 Apr 2019 12:46:32 +0200 Subject: [PATCH 2/2] more idiomatic check for terminal --- security_fixes.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/security_fixes.sh b/security_fixes.sh index fe54569..78161f9 100644 --- a/security_fixes.sh +++ b/security_fixes.sh @@ -39,7 +39,7 @@ then echo "on a MiSTer system." exit 1 fi -if [ "$(tty)" == "not a tty" ] +if [[ ! (-t 0 && -t 1 && -t 2) ]] then echo "This script must be run" echo "from a SSH/UART terminal"