From: Petr Rockai Date: Wed, 3 Oct 2007 15:00:51 +0000 (+0000) Subject: a) use dmsetup version to check for dmsetup, but if it fails, set X-Git-Tag: v2_02_91~3945 X-Git-Url: https://sourceware.org/git/?a=commitdiff_plain;h=06f595c3c3b538c3f6039b9ce9b19c97807da8a7;p=lvm2.git a) use dmsetup version to check for dmsetup, but if it fails, set 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 --- diff --git a/scripts/lvm_dump.sh b/scripts/lvm_dump.sh index dbff14e32..dac9634ee 100755 --- a/scripts/lvm_dump.sh +++ b/scripts/lvm_dump.sh @@ -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