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

Last change on this file since 866 was 866, checked in by bruno, 13 years ago
  • tabs inserted for scripts
  • MyInsmod? should be less verbose
  • x86_64 directories taken in account in install-additional-tools
  • one useless function removed from init
  • Property svn:keywords set to Id
File size: 3.2 KB
Line 
1#!/bin/sh
2#
3# $Id: install-additional-tools 866 2006-10-02 17:45:36Z 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#    echo -e -n "\rRecombining #$biggienumber ($biggiefname)        \r"
46    > /tmp/out.dat
47    sliceno=0
48    while [ "$sliceno" -le "999" ] ; do
49        slicefile=$stub.
50        [ "$sliceno" -lt "100" ] && slicefile="$slicefile"0
51        [ "$sliceno" -lt "10" ]  && slicefile="$slicefile"0
52        slicefile="$slicefile"$sliceno
53        [ ! -e "$slicefile" ] && break
54#   echo "biggienumber=$biggienumber slicefile=$slicefile" >> /tmp/mondo-restore.log
55        cat $slicefile >> /tmp/out.dat
56        rm -f $slicefile
57        sliceno=$(($sliceno+1))
58        done
59#    echo "$sliceno slices"
60
61    echo "$biggiefname ($biggiefsize KB) restored. $sliceno slices." >> /tmp/mondo-restore.log
62
63#    cat $stub.[0-9]* > /tmp/out.dat
64#    rm -f $stub.*               ; # .[0-9]* for the slices, plus .name & .size
65
66
67    mkdir -p $biggiefname
68    rmdir $biggiefname 2> /dev/null
69    chmod +x /tmp/out.dat
70    cp -f /tmp/out.dat $biggiefname
71    rm -f /tmp/out.dat
72    biggienumber=$(($biggienumber+1))
73    echo -e -n "."
74done
75echo -en "Done.                                                              \r"
76rm -f /slice*
77
78LogIt "Resolving softlinks"
79echo -en "Finalizing softlinks..."
80
81cd $mountdir
82for path in `find | grep -v /etc/fstab` ; do
83    if [ -d "$path" ] ; then
84        mkdir /$path 2> /dev/null
85    else
86# Patch from Andrew Bulhak
87        if [ -h "/$path" ] ; then
88            # echo "removing symlink /$path"
89            rm -f /$path
90        fi
91# end patch
92        mv -f $path /$path
93    fi
94done
95cp -f etc/fstab /tmp/fstab
96tar cf - sbin bin usr/bin usr/sbin lib usr/lib lib64 usr/lib64 | (cd / ; tar xf -)
97
98cd /
99
100for i in modprobe lsmod depmod rmmod ; do
101    [ -e "$mountdir/sbin/$i" ] && ln -sf $mountdir/sbin/$i /sbin/$i
102done
103
104sync;sync;sync
105
106echo "Done."
107
108for j in io.sys msdos.sys embleer.B.bz2 embleer.C.bz2 ; do
109    [ -e "$mountdir/$j" ] && ln -sf $mountdir/$j /$j
110done
111[ -e "$mountdir/etc/fstab" ] && ln -sf $mountdir/etc/fstab /tmp/fstab
112[ -e "$mountdir/etc/raidtab" ] && ln -sf $mountdir/etc/raidtab /tmp/raidtab
113
114which gawk 2> /dev/null > /dev/null
115[ "$?" -ne "0" ] && which awk 2> /dev/null > /dev/null && ln -sf `which awk` /usr/bin/gawk
116
117LogIt "Exiting install-additional-tools"
118exit 0
119
120# exit $res
121
Note: See TracBrowser for help on using the repository browser.