On Fri, May 7, 2010 at 12:28 PM, <apevec@gmail.com> wrote:
From: Alan Pevec <apevec@redhat.com>
Resolves: rhbz#583658
Signed-off-by: Alan Pevec <apevec@redhat.com>
---
tools/livecd-iso-to-disk.sh | 13 +++++++++++++
1 files changed, 13 insertions(+), 0 deletions(-)
diff --git a/tools/livecd-iso-to-disk.sh b/tools/livecd-iso-to-disk.sh
index 3a4726d..f4d0855 100755
--- a/tools/livecd-iso-to-disk.sh
+++ b/tools/livecd-iso-to-disk.sh
@@ -138,6 +138,18 @@ checkPartActive() {
fi
}
+checkLVM() {
+ dev=$1
+
+ if [ -x /sbin/pvs -a \
+ "$(/sbin/pvs -o vg_name --noheadings $dev* 2>/dev/null)" ]; then
+ echo "Device, $dev, contains a volume group and cannot be formated!"
+ echo "You can remove the volume group using vgremove."
+ exitclean
+ fi
+ return 0
+}
+
createGPTLayout() {
dev=$1
getdisk $dev
@@ -407,6 +419,7 @@ fi
# do some basic sanity checks.
checkMounted $USBDEV
if [ -n "$format" ];then
+ checkLVM $USBDEV
# checks for a valid filesystem
if [ -n "$efi" ];then
createGPTLayout $USBDEV
--
1.6.0.6
Redirecting standard error leads to silent failure when the lvm2 tools are not installed.
I've suggested leaving out that redirection so as to leave a hint for the user in that situation.
--Fred