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