source: branches/3.2/mindi/rootfs/usr/sbin/install-additional-tools @ 3621

Last change on this file since 3621 was 3216, checked in by Bruno Cornec, 7 years ago
  • Moves all mindi scripts under /usr/sbin to be more easily compatible with the lack of /sbin in recent distros.
  • Property svn:keywords set to Id
File size: 1.8 KB
RevLine 
[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
12LogIt "Starting install-additional-tools"
[1997]13
14if [ ! "$GROOVY" ] ; then
15    LogIt "I'm not groovy!"
16    exit 1
17fi
18
[2371]19mountdir=$GROOVY
20
[1998]21if [ $mountdir = "/" ]; then
22    LogIt "mountdir shouldn't be /"
23    exit 1
24fi
25
[1734]26# Should be the same as in mindi => conf param
[1]27mkdir -p $mountdir
28res=0
29if [ -e "/tmp/TAPEDEV-HAS-DATA-DISKS" ] ; then
30    LogIt "I am assuming the data disks' contents are already in $mountdir."
31else
[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]55fi
56
[1734]57LogIt "Populating / with tar file content..." 1
[1]58
59cd $mountdir
[1748]60if [ -f etc/fstab ]; then
[1841]61    cp etc/fstab /tmp
[1748]62fi
63if [ -f etc/raidtab ]; then
[1841]64    cp etc/raidtab /tmp
[1748]65fi
[1]66
[1734]67liste=`ls`
68if [ "$liste" ]; then
[2363]69    LogIt "Installing and removing $liste"
[1734]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
Note: See TracBrowser for help on using the repository browser.