source: MondoRescue/branches/2.2.9/mindi/rootfs/sbin/install-additional-tools @ 2363

Last change on this file since 2363 was 2363, checked in by Bruno Cornec, 11 years ago

More verbose at installation of additional tools

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