source: branches/2.2.5/mindi/rootfs/sbin/install-additional-tools @ 1841

Last change on this file since 1841 was 1841, checked in by Bruno Cornec, 12 years ago
  • Fix lack of /etc/raidtab at restore rime in the right place
  • Adds support for nls_utf8 and pata_serverworks

Patches from Dirk Husung (husung_at_tu-harburg.de)

  • Property svn:keywords set to Id
File size: 2.3 KB
Line 
1#!/bin/sh
2#
3# $Id: install-additional-tools 1841 2007-12-14 23:44:42Z 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
21# Should be the same as in mindi => conf param
22MAX_DISKS=99
23mkdir -p $mountdir
24diskno=1
25res=0
26if [ -e "/tmp/TAPEDEV-HAS-DATA-DISKS" ] ; then
27    LogIt "I am assuming the data disks' contents are already in $mountdir."
28else
29    while [ "$diskno" -lt "$MAX_DISKS" ] ; do
30        LogIt "PLEASE WAIT. Untarring disk #$diskno" 2
31        untar $diskno $mountdir
32        res=$(($res+$?))
33        [ -e "/LAST-DISK" ] && diskno=999
34        diskno=$(($diskno+1))
35        [ -e "/tmp/CDROM-LIVES-HERE" ] && [ ! -f "/mnt/cdrom/images/$diskno.tar.gz" ] && break
36    done
37fi
38rm -f /LAST-DISK
39
40LogIt "Recombining large files..." 1
41biggienumber=0
42while [ -e "$mountdir/slice-$biggienumber.name" ] ; do
43    stub=$mountdir/slice-$biggienumber
44    biggiefname=`cat $stub.name`
45    if [ -f $biggiefname ]; then
46        LogIt "$biggiefname already exists - skipped" 1
47        biggienumber=$(($biggienumber+1))
48        continue
49    fi
50    biggiefsize=`cat $stub.size`
51    rm -f $stub.name $stub.size
52    > /tmp/out.dat
53    sliceno=0
54    while [ "$sliceno" -le "999" ] ; do
55        slicefile=$stub.
56        [ "$sliceno" -lt "100" ] && slicefile="$slicefile"0
57        [ "$sliceno" -lt "10" ]  && slicefile="$slicefile"0
58        slicefile="$slicefile"$sliceno
59        [ ! -e "$slicefile" ] && break
60        cat $slicefile >> /tmp/out.dat
61        rm -f $slicefile
62        sliceno=$(($sliceno+1))
63        done
64
65    LogIt "$biggiefname ($biggiefsize KB) restored. $sliceno slices." 1
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))
73done
74rm -f /slice*
75
76LogIt "Populating / with tar file content..." 1
77
78cd $mountdir
79if [ -f etc/fstab ]; then
80    cp etc/fstab /tmp
81fi
82if [ -f etc/raidtab ]; then
83    cp etc/raidtab /tmp
84fi
85
86liste=`ls`
87if [ "$liste" ]; then
88    tar cf - $liste | (cd / ; tar xf -)
89    rm -fr $liste
90fi
91cd /
92
93sync;sync;sync
94
95LogIt "Done." 1
96
97which gawk 2> /dev/null > /dev/null
98[ "$?" -ne "0" ] && which awk 2> /dev/null > /dev/null && ln -sf `which awk` /usr/bin/gawk
99
100LogIt "Exiting install-additional-tools"
101exit 0
102
103# exit $res
104
Note: See TracBrowser for help on using the repository browser.