source: MondoRescue/branches/2.2.7/mindi/rootfs/sbin/install-additional-tools@ 1997

Last change on this file since 1997 was 1997, checked in by Bruno Cornec, 16 years ago
  • Fix a bug when calling install-additional-tools manually without using init which could create a risk of removing a lot of files without control. Should still be checked more carefully.
  • Property svn:keywords set to Id
File size: 1.8 KB
RevLine 
[1]1#!/bin/sh
2#
[866]3# $Id: install-additional-tools 1997 2008-07-10 15:38:40Z 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
[1734]27# Should be the same as in mindi => conf param
[1]28mkdir -p $mountdir
29res=0
30if [ -e "/tmp/TAPEDEV-HAS-DATA-DISKS" ] ; then
31 LogIt "I am assuming the data disks' contents are already in $mountdir."
32else
[1902]33 LogIt "PLEASE WAIT. Untarring data content" 2
34
35 mountpoint=/dev/null
36 [ -e "/tmp/CDROM-LIVES-HERE" ] && mountpoint=/mnt/cdrom/images
37 tarball=$mountpoint/all.tar.gz
38 if [ -e "/tmp/CDROM-LIVES-HERE" ] ; then
39 [ -e "$tarball" ] || LogIt "Can't find CD's $tarball" 1
40 fi
41
42 old_pwd=`pwd`
43 cd $mountdir
44 counter=0
45 for fname in `tar -zxvf $tarball` ; do
46 counter=$(($counter+1))
47 [ "$(($counter % 4))" -eq "0" ] && echo -en "\r\t\t\t\t\t\t\t\\"
48 [ "$(($counter % 4))" -eq "1" ] && echo -en "\r\t\t\t\t\t\t\t|"
49 [ "$(($counter % 4))" -eq "2" ] && echo -en "\r\t\t\t\t\t\t\t/"
50 [ "$(($counter % 4))" -eq "3" ] && echo -en "\r\t\t\t\t\t\t\t-"
51 done
52 cd $old_pwd
53 echo -e -n "\r"
54 [ ! -e "/tmp/CDROM-LIVES-HERE" ] && umount $mountpoint
55 sleep 1
[1]56fi
57
[1734]58LogIt "Populating / with tar file content..." 1
[1]59
60cd $mountdir
[1748]61if [ -f etc/fstab ]; then
[1841]62 cp etc/fstab /tmp
[1748]63fi
64if [ -f etc/raidtab ]; then
[1841]65 cp etc/raidtab /tmp
[1748]66fi
[1]67
[1734]68liste=`ls`
69if [ "$liste" ]; then
70 tar cf - $liste | (cd / ; tar xf -)
71 rm -fr $liste
72fi
[229]73cd /
[1]74
75sync;sync;sync
76
[1734]77LogIt "Done." 1
[1]78
79which gawk 2> /dev/null > /dev/null
80[ "$?" -ne "0" ] && which awk 2> /dev/null > /dev/null && ln -sf `which awk` /usr/bin/gawk
81
82LogIt "Exiting install-additional-tools"
83exit 0
84
85# exit $res
86
Note: See TracBrowser for help on using the repository browser.