]> sourceware.org Git - lvm2.git/commitdiff
a) use dmsetup version to check for dmsetup, but if it fails, set
authorPetr Rockai <prockai@redhat.com>
Wed, 3 Oct 2007 15:00:51 +0000 (15:00 +0000)
committerPetr Rockai <prockai@redhat.com>
Wed, 3 Oct 2007 15:00:51 +0000 (15:00 +0000)
DMSETUP=: to disable dmsetup checks (but let the script run
nevertheless); warn the user if this is the case
b) put the non-root and dmsetup warnings both at start and end of
output

scripts/lvm_dump.sh

index dbff14e3204ae71bfbe45e66de8ad6f55e58d1db..dac9634eea7b63ae41076afcad27582fb08fcfb0 100755 (executable)
@@ -44,7 +44,7 @@ die() {
 }
 
 "$LVM" version >& /dev/null || die 2 "Could not run lvm binary '$LVM'"
-"$DMSETUP" help >& /dev/null || die 2 "Fatal: could not run dmsetup binary '$DMSETUP'"
+"$DMSETUP" version >& /dev/null || DMSETUP=:
 
 function usage {
        echo "$0 [options]"
@@ -99,7 +99,16 @@ log() {
        eval "$@"
 }
 
-echo " "
+warnings() {
+       if test "$UID" != "0" && test "$EUID" != "0"; then
+               myecho "WARNING! Running as non-privileged user, dump is likely incomplete!"
+       elif test "$DMSETUP" = ":"; then
+               myecho "WARNING! Could not run dmsetup, dump is likely incomplete."
+       fi
+}
+
+warnings
+
 myecho "Creating dump directory: $dir"
 echo " "
 
@@ -211,16 +220,15 @@ fi
 if test -z "$userdir"; then
        lvm_dump="$dirbase.tgz"
        myecho "Creating report tarball in $HOME/$lvm_dump..."
+fi
+
+warnings
+
+if test -z "$userdir"; then
        cd "$HOME"
        "$TAR" czf "$lvm_dump" "$dirbase" 2>/dev/null
        "$RM" -rf "$dir"
 fi
 
-if test "$UID" != "0" && test "$EUID" != "0"; then
-       myecho
-       myecho "WARNING! Running as non-privileged user, dump is likely incomplete!"
-       myecho
-fi
-
 exit 0
 
This page took 0.030433 seconds and 5 git commands to generate.