Commit 8e3cf250 authored by Vitaly Lipatov's avatar Vitaly Lipatov

use isatty instead tty -s

parent 3314e4dd
...@@ -314,7 +314,7 @@ for opt in "$@" ; do ...@@ -314,7 +314,7 @@ for opt in "$@" ; do
done done
# if input is not console, get pkg from it too # if input is not console, get pkg from it too
if ! tty -s ; then if ! isatty ; then
for opt in $(cat) ; do for opt in $(cat) ; do
check_filenames $opt check_filenames $opt
done done
......
...@@ -18,18 +18,28 @@ ...@@ -18,18 +18,28 @@
# #
# copied from /etc/init.d/outformat (ALT Linux) # copied from /etc/init.d/outformat (ALT Linux)
isatty() isatty()
{ {
# Set a sane TERM required for tput # check stdout
[ -n "$TERM" ] || TERM=dumb # CHECKME: use tty -s?
export TERM test -t 1
}
isatty2()
{
# check stderr # check stderr
test -t 2 test -t 2
} }
check_tty() check_tty()
{ {
isatty || return isatty2 || return
# Set a sane TERM required for tput
[ -n "$TERM" ] || TERM=dumb
export TERM
which tput >/dev/null 2>/dev/null || return which tput >/dev/null 2>/dev/null || return
# FreeBSD does not support tput -S # FreeBSD does not support tput -S
echo | tput -S >/dev/null 2>/dev/null || return echo | tput -S >/dev/null 2>/dev/null || return
...@@ -230,7 +240,7 @@ set_eatmydata() ...@@ -230,7 +240,7 @@ set_eatmydata()
# use if possible # use if possible
which eatmydata >/dev/null 2>/dev/null || return which eatmydata >/dev/null 2>/dev/null || return
SUDO="$SUDO eatmydata" SUDO="$SUDO eatmydata"
tty -s && echo "Uwaga! eatmydata is installed, we will use it for disable all sync operations." >&2 isatty && echo "Uwaga! eatmydata is installed, we will use it for disable all sync operations." >&2
return 0 return 0
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment