2 #iface=`ifconfig |cut -d" " -f1|head -n1`
4 swp=`blkid |grep swap|awk '{print $1}'|cut -d: -f1|head -n1`
5 if [ ! $swp = "" ];then
9 iface=`grep dev= working/scripts/start_network|cut -d= -f2`
11 howmany=`ifconfig |cut -d" " -f1 |grep -v '^$' |grep -v lo|wc -l`
15 ifconfig |cut -d" " -f1 |grep -v '^$' |grep -v lo |while read line; do
18 echo `echo $line $line'\'`>>tmp
26 if [ -f ../../../scripts/nozen ]; then
32 $DIALOG --menu "Which ethernet adapter connects to the director ??:" 30 60 20 $tmp 2>ans
38 sed -i 's/'$iface'/'$ifaceans'/g' working/scripts/start_network
39 . ./working/scripts/start_network
41 if [ -f mount_drives ];then
45 if [ -d /media/bs-rescue/chroot ];then
46 rm -r /media/bs-rescue/chroot
48 mkdir /media/bs-rescue/chroot
52 cat disklist|while read line;do
53 cat working/scripts/mount_drives|grep $line>>/dev/null 2>&1
55 cat working/scripts/mount_drives|grep $line|while read LINE;do
56 cat mount_drives|grep "$LINE"
58 echo $LINE>>mount_drives
64 cat lvdisks|while read line;do
65 cat working/scripts/mount_drives|grep $line>>/dev/null 2>&1
67 cat working/scripts/mount_drives|grep $line|while read LINE;do
68 cat mount_drives|grep "$LINE"
70 echo $LINE>>mount_drives
78 if [ ! -d /media/bs-rescue/chroot/sys ];then
79 mkdir /media/bs-rescue/chroot/sys
81 if [ ! -d /media/bs-rescue/chroot/tmp ];then
82 mkdir /media/bs-rescue/chroot/tmp
83 chmod 777 /media/bs-rescue/chroot/tmp
85 if [ ! -d /media/bs-rescue/chroot/dev ];then
86 mkdir /media/bs-rescue/chroot/dev
88 if [ -f /media/bs-rescue/chroot/bacula-fdstatic ];then
89 rm /media/bs-rescue/chroot/bacula-fdstatic
91 #cp bacula-fdstatic /media/bs-rescue/chroot
92 #cp batermined /media/bs-rescue/chroot
93 #cp working/diskinfo/bacula-fd.conf /media/bs-rescue/chroot #### doesn t work if you copy files
94 #cp working/diskinfo/bat.conf /media/bs-rescue/chroot before mounting disks
95 if [ ! -d /media/bs-rescue/chroot/proc ];then
96 mkdir /media/bs-rescue/chroot/proc
98 mount -o bind /proc /media/bs-rescue/chroot/proc
105 cp working/diskinfo/bacula-fd.conf /media/bs-rescue/chroot
107 if [ ! -d /media/bs-rescue/chroot/etc ];then
108 mkdir -p /media/bs-rescue/chroot/etc
110 if [ ! -d /media/bs-rescue/chroot/lib ];then
111 mkdir -p /media/bs-rescue/chroot/lib
113 cp /lib/libnss_dns.so.2 /media/bs-rescue/chroot/lib
114 cp /etc/nsswitch.conf /media/bs-rescue/chroot/etc
115 cp /etc/resolv.conf /media/bs-rescue/chroot/etc
116 cp ping.ermined /media/bs-rescue/chroot/ping
118 if [ ! -d /media/bs-rescue/chroot/var/bacula/working ];then
119 mkdir -p /media/bs-rescue/chroot/var/bacula/working
121 if [ ! -d /media/bs-rescue/chroot/var/run/bacula ];then
122 mkdir -p /media/bs-rescue/chroot/var/run/bacula
125 if [ -d /etc/bacula ];then
131 if [ -f working/diskinfo/bconsole.conf ];then
133 cp working/diskinfo/bconsole.conf /etc/bacula
134 ../bin/bconsole.ermined < bcon > bconsole_output
135 cat bconsole_output |grep Version|awk '{print $5}'|grep 3.0
137 cp /media/bs-rescue/bacula-rescue/bin/bacula-fd-static-3.0.3 /media/bs-rescue/chroot/bacula-fd-static
139 cat bconsole_output |grep Version|awk '{print $5}'|grep 2.4
141 cp /media/bs-rescue/bacula-rescue/bin/bacula-fd-static-2.4.4 /media/bs-rescue/chroot/bacula-fd-static
145 $DIALOG --backtitle "If you want to connect to the director from this machine, \n you must provide a bconsole.conf , where is it ? \n (otherwise you can restore this client from another bconsole bat or bweb \n on another machine ) " --title "(spacebar to select)" --aspect 12 --begin 4 3 --fselect / 30 60 2>tmp
147 $DIALOG --title "!!!!!!" --msgbox "No bconsole.conf, you will have to access your director \n from another machine and restore the directories \n that correspond to the drives you just formated" 30 60
148 $DIALOG --radiolist "Which director version do you use ?:" 10 40 3 \
156 if [ $version = "1" ];then
157 cp /media/bs-rescue/bacula-rescue/bin/bacula-fd-static-2.4.4 /media/bs-rescue/chroot/bacula-fd-static
159 if [ $version = "2" ];then
160 cp /media/bs-rescue/bacula-rescue/bin/bacula-fd-static-3.0.3 /media/bs-rescue/chroot/bacula-fd-static
171 echo $bakonf |grep bconsole.conf
174 cp $bakonf /etc/bacula
176 $DIALOG --radiolist "Which director version do you use ?:" 10 40 3 \
184 if [ $version = "1" ];then
185 cp /media/bs-rescue/bacula-rescue/bin/bacula-fd-static-2.4.4 /media/bs-rescue/chroot/bacula-fd-static
187 if [ $version = "2" ];then
188 cp /media/bs-rescue/bacula-rescue/bin/bacula-fd-static-3.0.3 /media/bs-rescue/chroot/bacula-fd-static
194 chroot /media/bs-rescue/chroot /bacula-fd-static -c /bacula-fd.conf &
195 df |grep /media/bs-rescue/chroot |grep -v /media/bs-rescue/chroot/ >/dev/null 2>&1
197 df |grep /media/bs-rescue/chroot >tmp
198 place=`cat tmp|awk '{print $6}'|cut -c 24-1000`
203 df |grep /media/bs-rescue/chroot >tmp
205 cat tmp|while read line;do
206 b=`echo $line|awk '{print $6}'|cut -c 24-1000`
207 if [ ! $b = "" ];then
212 placet=`df $lv|grep media|awk '{print $5}'|cut -c 24-1000`
219 cat tmp2|grep $placet
236 $DIALOG --title "!!! WARNING !!!" --msgbox "Be carefull you didn't choose your root disk, so you must ONLY restore \n files that are situated on \$ $place \n otherwise you would fill up this usb key instead of your disks \n \n \n But you still want to point to / (where to ?? >>> / )" 30 60
238 $DIALOG --title "!!! WARNING !!!" --msgbox "Now you must restore your files pointing to / \n We are faking that your disks are mounted on the root ( / ) \n \n \n If you restore your files anywhere else it wont work" 30 60
239 if [ -f /etc/bacula/bconsole.conf ];then
240 ../bin/bconsole.ermined
242 $DIALOG --title "PROCESSING" --msgbox "Please press ok when your job is done" 30 60
243 if [ -d /media/bs-rescue/chroot/boot/grub ];then
244 $DIALOG --title "Install GRUB ?" --yesno "You seem to have GRUB installed on this disk, \n Do you want to run install-grub (grub 1) on this disk ? \n (we will back up the grub dir in grub.bak in case something goes wrong)" 30 60
246 grubdisk=`df |grep /media/bs-rescue/chroot |grep -v /media/bs-rescue/chroot/ |awk '{print $1}'`
247 cp -r /media/bs-rescue/chroot/boot/grub /media/bs-rescue/chroot/boot/grub.bak
248 grub-install --root-directory=/media/bs-rescue/chroot/boot/grub $grubdisk
251 $DIALOG --title "THAT'S IT" --msgbox "That's it , we're all done \n \n \n Enjoy !!!" 30 60
252 if [ -f added_disks ];then
255 if [ -f alldisks ];then
263 if [ -f badblocksnoprompt ];then
267 if [ -f noprompt ];then
271 if [ -f clientmp ];then
276 if [ -f dialogtest ];then
280 if [ -f disklist ];then
284 if [ -f fulldisks ];then
288 if [ -d working ];then
292 if [ -f mount_drives ];then
299 pid=`ps -ax|grep ermine|grep -v grep|awk '{print $1}'`
300 if [ ! $pid = "" ];then
303 lsof |grep /media/bs-rescue/chroot|awk '{print $2}'|while read line ;do
304 if [ ! $line = "" ];then