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

Last change on this file since 1998 was 1998, checked in by Bruno Cornec, 16 years ago
  • Improves again the security of the rm used
  • Property svn:keywords set to Id
File size: 1.9 KB
Line 
1#!/bin/sh
2#
3# $Id: install-additional-tools 1998 2008-07-10 15:48:47Z bruno $
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
21
22if [ ! "$GROOVY" ] ; then
23 LogIt "I'm not groovy!"
24 exit 1
25fi
26
27if [ $mountdir = "/" ]; then
28 LogIt "mountdir shouldn't be /"
29 exit 1
30fi
31
32# Should be the same as in mindi => conf param
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
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
61fi
62
63LogIt "Populating / with tar file content..." 1
64
65cd $mountdir
66if [ -f etc/fstab ]; then
67 cp etc/fstab /tmp
68fi
69if [ -f etc/raidtab ]; then
70 cp etc/raidtab /tmp
71fi
72
73liste=`ls`
74if [ "$liste" ]; then
75 tar cf - $liste | (cd / ; tar xf -)
76 rm -fr $liste
77fi
78cd /
79
80sync;sync;sync
81
82LogIt "Done." 1
83
84which gawk 2> /dev/null > /dev/null
85[ "$?" -ne "0" ] && which awk 2> /dev/null > /dev/null && ln -sf `which awk` /usr/bin/gawk
86
87LogIt "Exiting install-additional-tools"
88exit 0
Note: See TracBrowser for help on using the repository browser.