]> git.sur5r.net Git - bacula/rescue/blob - rescue/linux/usb/src/scripts/restore/do_lvm
Add new usb rescue key code
[bacula/rescue] / rescue / linux / usb / src / scripts / restore / do_lvm
1 #!/bin/sh
2
3
4 if [ -f working/scripts/create-pv ];then
5
6 if [ -f create-pv ];then
7 rm create-pv
8 fi
9
10   if [ -f create-lv ];then
11   rm create-lv
12   fi
13
14     if [ -f create-vg ];then
15     rm create-vg
16     fi
17 if [ -f lvdisks ];then
18 rm lvdisks
19 fi
20 touch create-pv
21 touch create-lv
22 touch create-vg
23 touch lvdisks
24
25   if [ -f disklistmp ];then
26   rm disklistmp
27   fi
28                 cat disklist|while read line;do
29                         if [ ! $line = "" ];then
30                                 grep $line disklistmp>>/dev/null 2>&1
31                                 if [ ! $? = 0 ];then
32                                 echo $line >>disklistmp
33                                 fi
34                         fi
35                 done
36
37                 cat raidisks|while read line;do
38                         if [ ! $line = "" ];then
39                                 grep $line disklistmp>>/dev/null 2>&1
40                                 if [ ! $? = 0 ];then
41                                 echo $line >>disklistmp
42                                 fi
43                         fi
44                 done
45 mv disklistmp totaldisks
46
47 cat totaldisks|while read line;do
48
49   cat working/scripts/create-pv |grep pvcreate|grep $line|while read LINE ;do
50         li=`echo $LINE`
51         cat create-pv|grep "$li">>/dev/null 2>&1
52                 if [ ! $? = 0 ];then
53                 echo $LINE >> create-pv
54                 fi
55   done
56         cat working/scripts/create-vg |grep vgcreate|grep $line|while read LINE ;do
57         li=`echo $LINE`
58         cat create-vg|grep "$li">>/dev/null 2>&1
59                 if [ ! $? = 0 ];then
60                 echo $LINE >> create-vg
61                 fi
62         done
63    
64 done
65
66
67 cat create-vg|awk '{print $3}'|while read line;do
68
69         cat working/scripts/create-lv |grep lvcreate|grep $line|while read LINE ;do
70         li=`echo $LINE`
71         cat create-lv|grep "$li">>/dev/null 2>&1
72                 if [ ! $? = 0 ];then
73                 echo $LINE >> create-lv
74                 fi
75         if [ -f working/scripts/format.$line ];then
76         cat working/scripts/format.$line >>formatallscript
77         fi
78         cat lvdisks|grep $line>/dev/null 2>&1
79         if [ ! $? = 0 ];then
80         echo $line >>lvdisks
81         fi
82         done
83
84
85 done
86
87
88
89
90
91 fi