From 1fe4f80e45a6bfcceed5aaab97fc0e27dfcf2b88 Mon Sep 17 00:00:00 2001 From: Zdenek Kabelac Date: Tue, 23 May 2017 13:58:12 +0200 Subject: [PATCH] fsadm: avoid hidden --yes When 'fsadm' was running without terminal (i.e. pipe), it's been automatically working like in '--yes'. Detect terminal and only accept empty "" input in this mode. --- WHATS_NEW | 1 + scripts/fsadm.sh | 9 +++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/WHATS_NEW b/WHATS_NEW index 82397a9e0..f38c23ca2 100644 --- a/WHATS_NEW +++ b/WHATS_NEW @@ -1,5 +1,6 @@ Version 2.02.172 - =============================== + Stop using '--yes' mode when fsadm runs without terminal. Extend validation of filesystems resized by fsadm. Enhance lvconvert automatic settings of possible (raid) LV types. Allow lvchange to change properties on a thin pool data sub LV. diff --git a/scripts/fsadm.sh b/scripts/fsadm.sh index bd54a264a..ea14efed2 100755 --- a/scripts/fsadm.sh +++ b/scripts/fsadm.sh @@ -401,10 +401,15 @@ yes_no() { while read -r -s -n 1 ANS ; do case "$ANS" in - "y" | "Y" | "") echo y ; return 0 ;; - "n" | "N") echo n ; return 1 ;; + "y" | "Y" ) echo y ; return 0 ;; + "" ) if [ -t 1 ] ; then + echo y ; return 0 + fi ;; esac done + + echo n + return 1 } try_umount() { -- 2.43.5