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