source: branches/2.2.5/mindi/rootfs/sbin/untar @ 1734

Last change on this file since 1734 was 1734, checked in by bruno, 12 years ago
  • untar-and-softlink => untar (+ interface change)
  • suppress useless softlinks creation/removal in boot process
  • avoids udevd messages on groups
  • Increase # of disks to 99 as in mindi at restore time (should be a conf file parameter)
  • skip existing big file creation
  • seems to work correctly for USB mindi boot
  • Property svn:keywords set to Id
File size: 1.5 KB
Line 
1#!/bin/sh
2#
3# $Id: untar 1734 2007-10-29 13:24:06Z bruno $
4#
5########################################################################
6
7
8Die() {
9    echo "Fatal error! $1" >> /dev/stderr
10    exit 1
11}
12
13
14# ---------------------- main ----------------------
15
16mountpoint=/mnt/floppy
17[ -e "/tmp/CDROM-LIVES-HERE" ] && mountpoint=/mnt/cdrom/images
18[ "$#" -eq "2" ] || Die "untar <tarball> <untar_to>"
19diskno=$1
20untar_path=$2
21tarball=$mountpoint/$diskno.tar.gz
22if [ -e "/tmp/CDROM-LIVES-HERE" ] ; then
23    [ -e "$tarball" ] || LogIt "Can't find CD's $tarball" 1
24else
25    while [ ! -f "$tarball" ] ; do
26        echo -e -n "Please insert data (floppy) disk #$diskno and press ENTER."
27        read line
28        mount /dev/fd0 -t ext2 -o ro $mountpoint
29        [ -f "$tarball" ] || umount $mountpoint ; # unmount if tarball not on disk
30        echo -en "Working..."
31    done
32fi
33
34[ -e "$mountpoint/LAST-DISK" ] && cp -f $mountpoint/LAST-DISK /
35old_pwd=`pwd`
36cd $untar_path
37counter=0
38for fname in `tar -zxvf $tarball` ; do
39    counter=$(($counter+1))
40    [ "$(($counter % 4))" -eq "0" ] && echo -en "\r\t\t\t\t\t\t\t\\"
41    [ "$(($counter % 4))" -eq "1" ] && echo -en "\r\t\t\t\t\t\t\t|"
42    [ "$(($counter % 4))" -eq "2" ] && echo -en "\r\t\t\t\t\t\t\t/"
43    [ "$(($counter % 4))" -eq "3" ] && echo -en "\r\t\t\t\t\t\t\t-"
44done
45cd $old_pwd
46echo -e -n "\r"
47[ ! -e "/tmp/CDROM-LIVES-HERE" ] && umount $mountpoint
48sleep 1
49if [ ! -e "/tmp/CDROM-LIVES-HERE" -a -f "/LAST-DISK" ] ; then
50    echo -en "Please remove the last data disk and press ENTER."
51    read line
52fi
53exit 0
Note: See TracBrowser for help on using the repository browser.