summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZdenek Kabelac <zkabelac@redhat.com>2017-05-23 13:58:12 +0200
committerZdenek Kabelac <zkabelac@redhat.com>2017-05-23 14:02:41 +0200
commit1fe4f80e45a6bfcceed5aaab97fc0e27dfcf2b88 (patch)
treeff8f8cab5e608432ccfa8f8ac541b7b4a24256a3
parent57492a609410c39809960a6f32bf67e1eddb7064 (diff)
downloadlvm2-1fe4f80e45a6bfcceed5aaab97fc0e27dfcf2b88.tar.gz
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.
-rw-r--r--WHATS_NEW1
-rwxr-xr-xscripts/fsadm.sh9
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() {