]> sourceware.org Git - lvm2.git/commitdiff
fsadm: avoid hidden --yes
authorZdenek Kabelac <zkabelac@redhat.com>
Tue, 23 May 2017 11:58:12 +0000 (13:58 +0200)
committerZdenek Kabelac <zkabelac@redhat.com>
Tue, 23 May 2017 12:02:41 +0000 (14:02 +0200)
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
scripts/fsadm.sh

index 82397a9e09ebe523ef6b2a23233d3982975b78fe..f38c23ca2c6c5ac6a0d218170601c1579aad5cb5 100644 (file)
--- 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.
index bd54a264ab84a820cd402ee99789534f1fdb2116..ea14efed2955501e27fcbd8104a49b446b995372 100755 (executable)
@@ -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() {
This page took 0.045852 seconds and 5 git commands to generate.