]> git.sur5r.net Git - bacula/rescue/blobdiff - rescue/linux/usb/src/scripts/restore/do_lvm
Add new usb rescue key code
[bacula/rescue] / rescue / linux / usb / src / scripts / restore / do_lvm
diff --git a/rescue/linux/usb/src/scripts/restore/do_lvm b/rescue/linux/usb/src/scripts/restore/do_lvm
new file mode 100755 (executable)
index 0000000..da162d8
--- /dev/null
@@ -0,0 +1,91 @@
+#!/bin/sh
+
+
+if [ -f working/scripts/create-pv ];then
+
+if [ -f create-pv ];then
+rm create-pv
+fi
+
+  if [ -f create-lv ];then
+  rm create-lv
+  fi
+
+    if [ -f create-vg ];then
+    rm create-vg
+    fi
+if [ -f lvdisks ];then
+rm lvdisks
+fi
+touch create-pv
+touch create-lv
+touch create-vg
+touch lvdisks
+
+  if [ -f disklistmp ];then
+  rm disklistmp
+  fi
+               cat disklist|while read line;do
+                       if [ ! $line = "" ];then
+                               grep $line disklistmp>>/dev/null 2>&1
+                               if [ ! $? = 0 ];then
+                               echo $line >>disklistmp
+                               fi
+                       fi
+               done
+
+               cat raidisks|while read line;do
+                       if [ ! $line = "" ];then
+                               grep $line disklistmp>>/dev/null 2>&1
+                               if [ ! $? = 0 ];then
+                               echo $line >>disklistmp
+                               fi
+                       fi
+               done
+mv disklistmp totaldisks
+
+cat totaldisks|while read line;do
+
+  cat working/scripts/create-pv |grep pvcreate|grep $line|while read LINE ;do
+       li=`echo $LINE`
+       cat create-pv|grep "$li">>/dev/null 2>&1
+               if [ ! $? = 0 ];then
+               echo $LINE >> create-pv
+               fi
+  done
+        cat working/scripts/create-vg |grep vgcreate|grep $line|while read LINE ;do
+       li=`echo $LINE`
+       cat create-vg|grep "$li">>/dev/null 2>&1
+               if [ ! $? = 0 ];then
+               echo $LINE >> create-vg
+               fi
+        done
+   
+done
+
+
+cat create-vg|awk '{print $3}'|while read line;do
+
+        cat working/scripts/create-lv |grep lvcreate|grep $line|while read LINE ;do
+       li=`echo $LINE`
+       cat create-lv|grep "$li">>/dev/null 2>&1
+               if [ ! $? = 0 ];then
+               echo $LINE >> create-lv
+               fi
+       if [ -f working/scripts/format.$line ];then
+       cat working/scripts/format.$line >>formatallscript
+       fi
+       cat lvdisks|grep $line>/dev/null 2>&1
+       if [ ! $? = 0 ];then
+       echo $line >>lvdisks
+       fi
+        done
+
+
+done
+
+
+
+
+
+fi