From a552e338ab1f9e0212f448e877588859993fe515 Mon Sep 17 00:00:00 2001 From: Arjun Krishnan Date: Sat, 27 May 2017 18:32:08 -0600 Subject: [PATCH] ALLOW SETTING EMPTY LVMEXTENSIONS The variable LVMEXTENSION is set by default to something like "-disk". If you attempt to set an empty LVMEXTENSION using lvmsnapshot -e "" create Then the variable OPT_LVMEXTENSION will be empty when the command-line arguments are parsed. This means that the following test will fail if [ ! -z $OPT_LVMEXTENSION ]; then and LVMEXTENSION will continue to contain its default value. So I added an extra flag that ISSET_OPT_LVMEXTENSION to show that the argument was parsed. This allows for an empty LVMEXTENSION to be set using -e "" --- lvmsnapshot.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lvmsnapshot.sh b/lvmsnapshot.sh index 58d7d28..4d508fe 100755 --- a/lvmsnapshot.sh +++ b/lvmsnapshot.sh @@ -270,6 +270,7 @@ while getopts ':m:e:g:c:i:ndqh' OPTION ; do e) OPT_LVMEXTENSION=$OPTARG + ISSET_OPT_LVMEXTENSION="True" ;; c) @@ -341,7 +342,7 @@ if [ ! -z $OPT_MAPPERINDEX ]; then MAPPERINDEX=$OPT_MAPPERINDEX fi -if [ ! -z $OPT_LVMEXTENSION ]; then +if [ ! -z $ISSET_OPT_LVMEXTENSION ]; then LVMEXTENSION=$OPT_LVMEXTENSION fi @@ -541,4 +542,4 @@ else echo usage $EXIT_ERROR fi -exit $EXIT_SUCCESS \ No newline at end of file +exit $EXIT_SUCCESS