]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
install-deps.sh: check if have access to stdout 19645/head
authorKefu Chai <kchai@redhat.com>
Thu, 28 Dec 2017 02:18:11 +0000 (10:18 +0800)
committerKefu Chai <kchai@redhat.com>
Sat, 30 Dec 2017 15:20:07 +0000 (23:20 +0800)
$- is "hB" if launched via command line, and it is "himBH" only when
we are actually *in* an interactive shell. so checking "test -t 1" is
what we want.

Signed-off-by: Kefu Chai <kchai@redhat.com>
install-deps.sh

index 336a156dfd7d8cabe8dbc153fbe729ebae51e7fd..ef55b056a9479c1a7e172ed5574f1d28c38f64cf 100755 (executable)
@@ -80,10 +80,9 @@ function ensure_decent_gcc_on_rh {
     local expected=5.1
     local dts_ver=$1
     if version_lt $old $expected; then
-       case $- in
-           *i*)
-               # interactive shell
-               cat <<EOF
+       if test -t 1; then
+           # interactive shell
+           cat <<EOF
 Your GCC is too old. Please run following command to add DTS to your environment:
 
 scl enable devtoolset-7 bash
@@ -94,12 +93,10 @@ source scl_source enable devtoolset-7
 
 see https://www.softwarecollections.org/en/scls/rhscl/devtoolset-7/ for more details.
 EOF
-           ;;
-           *)
-               # non-interactive shell
-               source /opt/rh/devtoolset-$dts_ver/enable
-               ;;
-       esac
+       else
+           # non-interactive shell
+           source /opt/rh/devtoolset-$dts_ver/enable
+       fi
     fi
 }