source: MondoRescue/branches/2.2.2/mindi/rootfs/sbin/install-additional-tools@ 1315

Last change on this file since 1315 was 1315, checked in by Bruno Cornec, 17 years ago

Log files are now consistent: mondoarchive.log for mondoarchive (containing also mindi.log) and mondorestore.log for mondorestore (copied from /tmp (ram) to /var/log (disk) at the end of the restore)
One include has been created for each bianry containing only that declaration ofr the moment, but which will be extended to include all local definitions (ps_* e.g.)
Doc updated accordingly
LOGFILE in restore process is now passed in the environment and not duplicated anymore
LogIt is not redifined either
LOGFILE should be put in environment by mondoarchive for mindi's usage but that's a step left for later.

  • Property svn:keywords set to Id
File size: 2.8 KB
Line 
1#!/bin/sh
2#
3# $Id: install-additional-tools 1315 2007-04-16 14:13:59Z bruno $
4#
5########################################################################
6
7
8Die() {
9 echo "Fatal error! $1" >> /dev/stderr
10 exit 1
11}
12
13
14
15# ------------ main -----------
16
17# if the file '/tmp/CDROM-LIVES-HERE' exists then we should use the CD
18
19LogIt "Starting install-additional-tools"
20mountdir=$GROOVY
21mkdir -p $mountdir
22diskno=1
23res=0
24if [ -e "/tmp/TAPEDEV-HAS-DATA-DISKS" ] ; then
25 LogIt "I am assuming the data disks' contents are already in $mountdir."
26else
27 while [ "$diskno" -lt "20" ] ; do
28 LogIt "PLEASE WAIT. Untarring and softlinking disk #$diskno" 2
29 untar-and-softlink $diskno $mountdir /
30 res=$(($res+$?))
31 [ -e "/LAST-DISK" ] && diskno=999
32 diskno=$(($diskno+1))
33 [ -e "/tmp/CDROM-LIVES-HERE" ] && [ ! -f "/mnt/cdrom/images/$diskno.tar.gz" ] && break
34 done
35fi
36rm -f /LAST-DISK
37
38echo -e -n "Recombining large files..."
39biggienumber=0
40while [ -e "$mountdir/slice-$biggienumber.name" ] ; do
41 stub=$mountdir/slice-$biggienumber
42 biggiefname=`cat $stub.name`
43 biggiefsize=`cat $stub.size`
44 rm -f $stub.name $stub.size
45 > /tmp/out.dat
46 sliceno=0
47 while [ "$sliceno" -le "999" ] ; do
48 slicefile=$stub.
49 [ "$sliceno" -lt "100" ] && slicefile="$slicefile"0
50 [ "$sliceno" -lt "10" ] && slicefile="$slicefile"0
51 slicefile="$slicefile"$sliceno
52 [ ! -e "$slicefile" ] && break
53 cat $slicefile >> /tmp/out.dat
54 rm -f $slicefile
55 sliceno=$(($sliceno+1))
56 done
57
58 echo "$biggiefname ($biggiefsize KB) restored. $sliceno slices." >> $LOGFILE
59
60 mkdir -p $biggiefname
61 rmdir $biggiefname 2> /dev/null
62 chmod +x /tmp/out.dat
63 cp -f /tmp/out.dat $biggiefname
64 rm -f /tmp/out.dat
65 biggienumber=$(($biggienumber+1))
66 echo -e -n "."
67done
68echo -en "Done. \r"
69rm -f /slice*
70
71LogIt "Resolving softlinks"
72echo -en "Finalizing softlinks..."
73
74cd $mountdir
75for path in `find | grep -v /etc/fstab` ; do
76 if [ -d "$path" ] ; then
77 mkdir /$path 2> /dev/null
78 else
79# Patch from Andrew Bulhak
80 if [ -h "/$path" ] ; then
81 # echo "removing symlink /$path"
82 rm -f /$path
83 fi
84# end patch
85 mv -f $path /$path
86 fi
87done
88cp -f etc/fstab /tmp/fstab
89tar cf - sbin bin usr/bin usr/sbin lib usr/lib lib64 usr/lib64 | (cd / ; tar xf -)
90
91cd /
92
93for i in modprobe lsmod depmod rmmod ; do
94 [ -e "$mountdir/sbin/$i" ] && ln -sf $mountdir/sbin/$i /sbin/$i
95done
96
97sync;sync;sync
98
99echo "Done."
100
101for j in io.sys msdos.sys embleer.B.bz2 embleer.C.bz2 ; do
102 [ -e "$mountdir/$j" ] && ln -sf $mountdir/$j /$j
103done
104[ -e "$mountdir/etc/fstab" ] && ln -sf $mountdir/etc/fstab /tmp/fstab
105[ -e "$mountdir/etc/raidtab" ] && ln -sf $mountdir/etc/raidtab /tmp/raidtab
106
107which gawk 2> /dev/null > /dev/null
108[ "$?" -ne "0" ] && which awk 2> /dev/null > /dev/null && ln -sf `which awk` /usr/bin/gawk
109
110LogIt "Exiting install-additional-tools"
111exit 0
112
113# exit $res
114
Note: See TracBrowser for help on using the repository browser.