fdb0e239d4213ed73b528edf638a1d5cdb72efeb

Author
Marc Cornellà <marc.cornella@live.com>
Committer
Marc Cornellà <marc.cornella@live.com>
Date

Message

Merge pull request #4507 from WhyEee/fix-no-tput

Fix install.sh/upgrade.sh for tput-less systems

Diff

 1diff --git a/tools/install.sh b/tools/install.sh
 2index dd9c4f842ffb4798313015becefd8781f93a4997..e659050257e50e49d14b1c7f64b0e0d4cae1c4ab 100755
 3--- a/tools/install.sh
 4+++ b/tools/install.sh
 5@@ -1,9 +1,8 @@
 6 function main() {
 7 # Use colors, but only if connected to a terminal, and that terminal
 8 # supports them.
 9-tput=$(which tput)
10-if [ -n "$tput" ]; then
11-    ncolors=$($tput colors)
12+if which tput >/dev/null 2>&1; then
13+    ncolors=$(tput colors)
14 fi
15 if [ -t 1 ] && [ -n "$ncolors" ] && [ "$ncolors" -ge 8 ]; then
16   RED="$(tput setaf 1)"
17diff --git a/tools/upgrade.sh b/tools/upgrade.sh
18index 6e9696202b3e97350142987bd3fa0f78194ccb4a..fe8fbadcae9f1aa635a032e006ae1b6af1d26517 100644
19--- a/tools/upgrade.sh
20+++ b/tools/upgrade.sh
21@@ -1,8 +1,7 @@
22 
23 # Use colors, but only if connected to a terminal, and that terminal
24 # supports them.
25-tput=$(which tput)
26-if [ -n "$tput" ]; then
27+if which tput >/dev/null 2>&1; then
28     ncolors=$(tput colors)
29 fi
30 if [ -t 1 ] && [ -n "$ncolors" ] && [ "$ncolors" -ge 8 ]; then