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