From 287eb3ebcc51583a55f7921455a3e0ff24db3bcd Mon Sep 17 00:00:00 2001 From: Danil Semelenov Date: Wed, 17 Dec 2014 16:40:09 +0300 Subject: [PATCH] Add parted error status suppressing --- common.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/common.sh b/common.sh index e6dde15..5634b79 100644 --- a/common.sh +++ b/common.sh @@ -82,7 +82,7 @@ select-drive() { return fi - local parted_output=`sudo LC_ALL=POSIX parted -ls 2>&1` + local parted_output=`sudo LC_ALL=POSIX parted -ls 2>&1 || :` local exclude_drive_paths=(`mounted-drive-path /`) exclude_drive_paths+=(`echo "$parted_output" | grep -oP "(?<=^Warning: Unable to open ).*(?= read-write )" || :`) @@ -112,7 +112,8 @@ select-drive() { } detect-drive-name() { - drive_name=`sudo LC_ALL=POSIX parted -s $drive_path print 2>/dev/null | parse-drive-name` + local parted_output=`sudo LC_ALL=POSIX parted -s $drive_path print 2>/dev/null || :` + drive_name=`echo "$parted_output" | parse-drive-name` } partition-path() {