1 | #!/bin/sh |
---|
2 | # |
---|
3 | # $Id: install-additional-tools 1997 2008-07-10 15:38:40Z bruno $ |
---|
4 | # |
---|
5 | ######################################################################## |
---|
6 | |
---|
7 | |
---|
8 | Die() { |
---|
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 | |
---|
19 | LogIt "Starting install-additional-tools" |
---|
20 | mountdir=$GROOVY |
---|
21 | |
---|
22 | if [ ! "$GROOVY" ] ; then |
---|
23 | LogIt "I'm not groovy!" |
---|
24 | exit 1 |
---|
25 | fi |
---|
26 | |
---|
27 | # Should be the same as in mindi => conf param |
---|
28 | mkdir -p $mountdir |
---|
29 | res=0 |
---|
30 | if [ -e "/tmp/TAPEDEV-HAS-DATA-DISKS" ] ; then |
---|
31 | LogIt "I am assuming the data disks' contents are already in $mountdir." |
---|
32 | else |
---|
33 | LogIt "PLEASE WAIT. Untarring data content" 2 |
---|
34 | |
---|
35 | mountpoint=/dev/null |
---|
36 | [ -e "/tmp/CDROM-LIVES-HERE" ] && mountpoint=/mnt/cdrom/images |
---|
37 | tarball=$mountpoint/all.tar.gz |
---|
38 | if [ -e "/tmp/CDROM-LIVES-HERE" ] ; then |
---|
39 | [ -e "$tarball" ] || LogIt "Can't find CD's $tarball" 1 |
---|
40 | fi |
---|
41 | |
---|
42 | old_pwd=`pwd` |
---|
43 | cd $mountdir |
---|
44 | counter=0 |
---|
45 | for fname in `tar -zxvf $tarball` ; do |
---|
46 | counter=$(($counter+1)) |
---|
47 | [ "$(($counter % 4))" -eq "0" ] && echo -en "\r\t\t\t\t\t\t\t\\" |
---|
48 | [ "$(($counter % 4))" -eq "1" ] && echo -en "\r\t\t\t\t\t\t\t|" |
---|
49 | [ "$(($counter % 4))" -eq "2" ] && echo -en "\r\t\t\t\t\t\t\t/" |
---|
50 | [ "$(($counter % 4))" -eq "3" ] && echo -en "\r\t\t\t\t\t\t\t-" |
---|
51 | done |
---|
52 | cd $old_pwd |
---|
53 | echo -e -n "\r" |
---|
54 | [ ! -e "/tmp/CDROM-LIVES-HERE" ] && umount $mountpoint |
---|
55 | sleep 1 |
---|
56 | fi |
---|
57 | |
---|
58 | LogIt "Populating / with tar file content..." 1 |
---|
59 | |
---|
60 | cd $mountdir |
---|
61 | if [ -f etc/fstab ]; then |
---|
62 | cp etc/fstab /tmp |
---|
63 | fi |
---|
64 | if [ -f etc/raidtab ]; then |
---|
65 | cp etc/raidtab /tmp |
---|
66 | fi |
---|
67 | |
---|
68 | liste=`ls` |
---|
69 | if [ "$liste" ]; then |
---|
70 | tar cf - $liste | (cd / ; tar xf -) |
---|
71 | rm -fr $liste |
---|
72 | fi |
---|
73 | cd / |
---|
74 | |
---|
75 | sync;sync;sync |
---|
76 | |
---|
77 | LogIt "Done." 1 |
---|
78 | |
---|
79 | which gawk 2> /dev/null > /dev/null |
---|
80 | [ "$?" -ne "0" ] && which awk 2> /dev/null > /dev/null && ln -sf `which awk` /usr/bin/gawk |
---|
81 | |
---|
82 | LogIt "Exiting install-additional-tools" |
---|
83 | exit 0 |
---|
84 | |
---|
85 | # exit $res |
---|
86 | |
---|