[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[lvm-devel] [PATCH 8/9] Support for noninteractive shell invocation of fsadm



try to distinguish between the case of  using interactive shell and non
interactive running - different combinations of  '-y' and '-p' option
needs to be used.

Signed-off-by: Zdenek Kabelac <zkabelac redhat com>
---
 scripts/fsadm.sh |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/scripts/fsadm.sh b/scripts/fsadm.sh
index 79bac51..945089a 100644
--- a/scripts/fsadm.sh
+++ b/scripts/fsadm.sh
@@ -402,7 +402,11 @@ check() {
 	detect_mounted && error "Cannot fsck device \"$VOLUME\", filesystem is mounted on $MOUNTED"
 	case "$FSTYPE" in
 	  "xfs") dry $XFS_CHECK "$VOLUME" ;;
-	  *) dry $FSCK $YES "$VOLUME" ;;
+	  *)    # check if executed from interactive shell environment
+		case "$-" in
+		  *i*) dry $FSCK $YES $FORCE "$VOLUME" ;;
+		  *) dry $FSCK $FORCE -p "$VOLUME" ;;
+		esac
 	esac
 }
 
-- 
1.7.3.1


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]