[1] | 1 | #!/bin/sh
|
---|
| 2 | #
|
---|
[866] | 3 | # $Id: install-additional-tools 2594 2010-03-17 02:55:16Z 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 |
|
---|
[2488] | 17 | # if the file '$MINDI_CACHE/CDROM-LIVES-HERE' exists then we should use the CD
|
---|
[1] | 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 |
|
---|
[2372] | 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
|
---|
[2488] | 42 | [ -e "$MINDI_CACHE/CDROM-LIVES-HERE" ] && mountpoint=/mnt/cdrom/images
|
---|
[1902] | 43 | tarball=$mountpoint/all.tar.gz
|
---|
[2488] | 44 | if [ -e "$MINDI_CACHE/CDROM-LIVES-HERE" ] ; then
|
---|
[1902] | 45 | [ -e "$tarball" ] || LogIt "Can't find CD's $tarball" 1
|
---|
| 46 | fi
|
---|
| 47 |
|
---|
| 48 | old_pwd=`pwd`
|
---|
| 49 | cd $mountdir
|
---|
| 50 | counter=0
|
---|
[2592] | 51 | if [ -f $tarball ]; then
|
---|
| 52 | for fname in `tar -zxvf $tarball` ; do
|
---|
| 53 | counter=$(($counter+1))
|
---|
| 54 | [ "$(($counter % 4))" -eq "0" ] && echo -en "\r\t\t\t\t\t\t\t\\"
|
---|
| 55 | [ "$(($counter % 4))" -eq "1" ] && echo -en "\r\t\t\t\t\t\t\t|"
|
---|
| 56 | [ "$(($counter % 4))" -eq "2" ] && echo -en "\r\t\t\t\t\t\t\t/"
|
---|
| 57 | [ "$(($counter % 4))" -eq "3" ] && echo -en "\r\t\t\t\t\t\t\t-"
|
---|
| 58 | done
|
---|
| 59 | fi
|
---|
[1902] | 60 | cd $old_pwd
|
---|
| 61 | echo -e -n "\r"
|
---|
[2594] | 62 | [ ! -e "$MINDI_CACHE/CDROM-LIVES-HERE" ] && [ -e "$tarball" ] && umount $mountpoint
|
---|
[1902] | 63 | sleep 1
|
---|
[1] | 64 | fi
|
---|
| 65 |
|
---|
[1734] | 66 | LogIt "Populating / with tar file content..." 1
|
---|
[1] | 67 |
|
---|
| 68 | cd $mountdir
|
---|
[1748] | 69 | if [ -f etc/fstab ]; then
|
---|
[1841] | 70 | cp etc/fstab /tmp
|
---|
[1748] | 71 | fi
|
---|
| 72 | if [ -f etc/raidtab ]; then
|
---|
[1841] | 73 | cp etc/raidtab /tmp
|
---|
[1748] | 74 | fi
|
---|
[1] | 75 |
|
---|
[1734] | 76 | liste=`ls`
|
---|
| 77 | if [ "$liste" ]; then
|
---|
[2364] | 78 | LogIt "Installing and removing $liste"
|
---|
[1734] | 79 | tar cf - $liste | (cd / ; tar xf -)
|
---|
| 80 | rm -fr $liste
|
---|
| 81 | fi
|
---|
[229] | 82 | cd /
|
---|
[1] | 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
|
---|