Resolves rhbz#583658
---
 tools/livecd-iso-to-disk.sh |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/tools/livecd-iso-to-disk.sh b/tools/livecd-iso-to-disk.sh
index 3a4726d..0cfcfb8 100755
--- a/tools/livecd-iso-to-disk.sh
+++ b/tools/livecd-iso-to-disk.sh
@@ -138,6 +138,21 @@ checkPartActive() {
     fi
 }
 
+checkLVMActive() {
+    dev=$1
+
+       # check for an active lv which will cause format to fail
+       for vg in $(pvs -o vg_name --noheadings $dev $dev${dev_delim}[0-9]* 
2>/dev/null|sort -u); do
+               if [ $(lvs -o lv_attr --noheadings $vg |awk {'print $1;'} |cut 
-c 5) = "a" ]; then
+               echo "Device, $dev, contains a volume group with an active 
volume and cannot be formated!"
+               echo "You can remove the volume group with "
+               echo "    # /sbin/vgremove -f $vg"
+               exitclean
+               fi
+    done
+    return 0
+}
+
 createGPTLayout() {
     dev=$1
     getdisk $dev
@@ -407,6 +422,7 @@ fi
 # do some basic sanity checks.  
 checkMounted $USBDEV
 if [ -n "$format" ];then
+  checkLVMActive $USBDEV
   # checks for a valid filesystem
   if [ -n "$efi" ];then
     createGPTLayout $USBDEV
-- 
1.6.6.1

--
livecd mailing list
[email protected]
https://admin.fedoraproject.org/mailman/listinfo/livecd

Reply via email to