From: Zdenek Kabelac Date: Tue, 23 May 2017 11:58:12 +0000 (+0200) Subject: fsadm: avoid hidden --yes X-Git-Tag: v2_02_172~149 X-Git-Url: https://sourceware.org/git/?a=commitdiff_plain;h=1fe4f80e45a6bfcceed5aaab97fc0e27dfcf2b88;p=lvm2.git 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. --- 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() {