[1] | 1 | #!/bin/sh
|
---|
| 2 | #
|
---|
[866] | 3 | # $Id: install-additional-tools 2371 2009-09-08 11:40:25Z 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"
|
---|
[1997] | 20 |
|
---|
| 21 | if [ ! "$GROOVY" ] ; then
|
---|
| 22 | LogIt "I'm not groovy!"
|
---|
| 23 | exit 1
|
---|
| 24 | fi
|
---|
| 25 |
|
---|
[2371] | 26 | mountdir=$GROOVY
|
---|
| 27 |
|
---|
[1998] | 28 | if [ $mountdir = "/" ]; then
|
---|
| 29 | LogIt "mountdir shouldn't be /"
|
---|
| 30 | exit 1
|
---|
| 31 | fi
|
---|
| 32 |
|
---|
[1734] | 33 | # Should be the same as in mindi => conf param
|
---|
[1] | 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
|
---|
[1902] | 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
|
---|
[1] | 62 | fi
|
---|
| 63 |
|
---|
[1734] | 64 | LogIt "Populating / with tar file content..." 1
|
---|
[1] | 65 |
|
---|
| 66 | cd $mountdir
|
---|
[1748] | 67 | if [ -f etc/fstab ]; then
|
---|
[1841] | 68 | cp etc/fstab /tmp
|
---|
[1748] | 69 | fi
|
---|
| 70 | if [ -f etc/raidtab ]; then
|
---|
[1841] | 71 | cp etc/raidtab /tmp
|
---|
[1748] | 72 | fi
|
---|
[1] | 73 |
|
---|
[1734] | 74 | liste=`ls`
|
---|
| 75 | if [ "$liste" ]; then
|
---|
[2363] | 76 | LogIt "Installing and removing $liste"
|
---|
[1734] | 77 | tar cf - $liste | (cd / ; tar xf -)
|
---|
| 78 | rm -fr $liste
|
---|
| 79 | fi
|
---|
[229] | 80 | cd /
|
---|
[1] | 81 |
|
---|
| 82 | sync;sync;sync
|
---|
| 83 |
|
---|
[1734] | 84 | LogIt "Done." 1
|
---|
[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
|
---|