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