source: branches/stable/mindi/rootfs/sbin/untar @ 1903

Last change on this file since 1903 was 1903, checked in by bruno, 11 years ago

merge -r 1842:1889 2.2.5

  • Property svn:keywords set to Id
File size: 1.2 KB
Line 
1#!/bin/sh
2#
3# $Id: untar 1903 2008-04-09 23:13:58Z bruno $
4#
5########################################################################
6
7
8Die() {
9    echo "Fatal error! $1" >> /dev/stderr
10    exit 1
11}
12
13
14# ---------------------- main ----------------------
15
16mountpoint=/dev/null
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
24fi
25
26[ -e "$mountpoint/LAST-DISK" ] && cp -f $mountpoint/LAST-DISK /
27old_pwd=`pwd`
28cd $untar_path
29counter=0
30for fname in `tar -zxvf $tarball` ; do
31    counter=$(($counter+1))
32    [ "$(($counter % 4))" -eq "0" ] && echo -en "\r\t\t\t\t\t\t\t\\"
33    [ "$(($counter % 4))" -eq "1" ] && echo -en "\r\t\t\t\t\t\t\t|"
34    [ "$(($counter % 4))" -eq "2" ] && echo -en "\r\t\t\t\t\t\t\t/"
35    [ "$(($counter % 4))" -eq "3" ] && echo -en "\r\t\t\t\t\t\t\t-"
36done
37cd $old_pwd
38echo -e -n "\r"
39[ ! -e "/tmp/CDROM-LIVES-HERE" ] && umount $mountpoint
40sleep 1
41if [ ! -e "/tmp/CDROM-LIVES-HERE" -a -f "/LAST-DISK" ] ; then
42    echo -en "Please remove the last data disk and press ENTER."
43    read line
44fi
45exit 0
Note: See TracBrowser for help on using the repository browser.