source: branches/stable/mindi/rootfs/sbin/install-additional-tools @ 1193

Last change on this file since 1193 was 1193, checked in by bruno, 12 years ago

Remove some useless \r in code
Remove center_string usage as it's now broiken for dynamically created strings

  • Property svn:keywords set to Id
File size: 3.1 KB
Line 
1#!/bin/sh
2#
3# $Id: install-additional-tools 1193 2007-02-20 11:24:22Z 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#   echo "biggienumber=$biggienumber slicefile=$slicefile" >> /tmp/mondo-restore.log
54        cat $slicefile >> /tmp/out.dat
55        rm -f $slicefile
56        sliceno=$(($sliceno+1))
57        done
58#    echo "$sliceno slices"
59
60    echo "$biggiefname ($biggiefsize KB) restored. $sliceno slices." >> /tmp/mondo-restore.log
61
62#    cat $stub.[0-9]* > /tmp/out.dat
63#    rm -f $stub.*               ; # .[0-9]* for the slices, plus .name & .size
64
65
66    mkdir -p $biggiefname
67    rmdir $biggiefname 2> /dev/null
68    chmod +x /tmp/out.dat
69    cp -f /tmp/out.dat $biggiefname
70    rm -f /tmp/out.dat
71    biggienumber=$(($biggienumber+1))
72    echo -e -n "."
73done
74echo -en "Done.                                                              \r"
75rm -f /slice*
76
77LogIt "Resolving softlinks"
78echo -en "Finalizing softlinks..."
79
80cd $mountdir
81for path in `find | grep -v /etc/fstab` ; do
82    if [ -d "$path" ] ; then
83        mkdir /$path 2> /dev/null
84    else
85# Patch from Andrew Bulhak
86        if [ -h "/$path" ] ; then
87            # echo "removing symlink /$path"
88            rm -f /$path
89        fi
90# end patch
91        mv -f $path /$path
92    fi
93done
94cp -f etc/fstab /tmp/fstab
95tar cf - sbin bin usr/bin usr/sbin lib usr/lib lib64 usr/lib64 | (cd / ; tar xf -)
96
97cd /
98
99for i in modprobe lsmod depmod rmmod ; do
100    [ -e "$mountdir/sbin/$i" ] && ln -sf $mountdir/sbin/$i /sbin/$i
101done
102
103sync;sync;sync
104
105echo "Done."
106
107for j in io.sys msdos.sys embleer.B.bz2 embleer.C.bz2 ; do
108    [ -e "$mountdir/$j" ] && ln -sf $mountdir/$j /$j
109done
110[ -e "$mountdir/etc/fstab" ] && ln -sf $mountdir/etc/fstab /tmp/fstab
111[ -e "$mountdir/etc/raidtab" ] && ln -sf $mountdir/etc/raidtab /tmp/raidtab
112
113which gawk 2> /dev/null > /dev/null
114[ "$?" -ne "0" ] && which awk 2> /dev/null > /dev/null && ln -sf `which awk` /usr/bin/gawk
115
116LogIt "Exiting install-additional-tools"
117exit 0
118
119# exit $res
120
Note: See TracBrowser for help on using the repository browser.