]> git.sur5r.net Git - bacula/rescue/blobdiff - rescue/linux/usb/src/scripts/restore/checkraid
Add new usb rescue key code
[bacula/rescue] / rescue / linux / usb / src / scripts / restore / checkraid
diff --git a/rescue/linux/usb/src/scripts/restore/checkraid b/rescue/linux/usb/src/scripts/restore/checkraid
new file mode 100755 (executable)
index 0000000..13cf451
--- /dev/null
@@ -0,0 +1,69 @@
+#!/bin/sh 
+
+
+
+
+
+if [ -f working/scripts/recreate_raid_arrays ];then
+
+if [ ! -f lvmdisks ];then
+touch lvmdisks
+fi
+cat disklist|while read LINE;do
+disk=`echo $LINE`
+grep $disk working/scripts/recreate_raid_arrays |while read line;do
+     
+       
+       grep $disk checkraidtemp >>/dev/null 2>&1
+               if [ ! $? = 0 ];then
+               echo $line>>checkraidtemp
+               field=`echo $line|wc -w`
+                       while [ $field -ne 0 ];do
+                       a=`echo $line|awk "{ print \$ $field }"`
+                       echo $a|grep /dev |grep -v md|grep -v $disk>/dev/null 2>&1
+                               if [ $? = 0 ];then
+                               grep $a disklist
+                                       if [ ! $? = 0 ];then
+                                       echo $a >>added_disks
+                                       
+                                       fi
+                               fi
+                       field=$(( field - 1 ))
+                       done
+
+
+
+                       field=`echo $line|wc -w`
+                       while [ $field -ne 0 ];do
+                       a=`echo $line|awk "{ print \$ $field }"`
+                       echo $a|grep  md|grep -v mdadm >/dev/null 2>&1
+                               if [ $? = 0 ];then
+                               grep $a lvmdisks
+                                       if [ ! $? = 0 ];then
+                                       echo $a >> raidisks
+                                       
+                                       fi
+                               fi
+                       field=$(( field - 1 ))
+                       done
+
+
+
+               fi
+        
+done
+done
+               cat disklist|while read line;do
+                       if [ ! $line = "" ];then
+                       echo $line >>disklistmp
+                       fi
+               done
+                               cat added_disks|while read line;do
+                                       if [ ! $line = "" ];then
+                                       echo $line>>disklistmp
+                                       fi
+                               done
+mv disklistmp disklist
+
+echo "" > added_disks
+fi