Last change
on this file since 1707 was 1581, checked in by Bruno Cornec, 17 years ago |
Continue to remove floppy support
|
-
Property svn:keywords
set to
Id
|
File size:
1.5 KB
|
Rev | Line | |
---|
[1] | 1 | #!/bin/sh
|
---|
[866] | 2 | #
|
---|
| 3 | # $Id: untar-and-softlink 1581 2007-07-27 00:11:55Z bruno $
|
---|
| 4 | #
|
---|
| 5 | ########################################################################
|
---|
[1] | 6 |
|
---|
[866] | 7 |
|
---|
[1] | 8 | Die() {
|
---|
| 9 | echo "Fatal error! $1" >> /dev/stderr
|
---|
| 10 | exit 1
|
---|
| 11 | }
|
---|
| 12 |
|
---|
| 13 |
|
---|
| 14 | # ---------------------- main ----------------------
|
---|
| 15 |
|
---|
[1581] | 16 | mountpoint=""
|
---|
[1] | 17 | [ -e "/tmp/CDROM-LIVES-HERE" ] && mountpoint=/mnt/cdrom/images
|
---|
| 18 | [ "$#" -eq "3" ] || Die "untar-and-softlink <tarball> <untar_to> <softlink_to>"
|
---|
| 19 | diskno=$1
|
---|
| 20 | untar_path=$2
|
---|
| 21 | softlink_path=$3
|
---|
| 22 | tarball=$mountpoint/$diskno.tar.gz
|
---|
| 23 | if [ -e "/tmp/CDROM-LIVES-HERE" ] ; then
|
---|
| 24 | [ -e "$tarball" ] || LogIt "Can't find CD's $tarball" 1
|
---|
| 25 | fi
|
---|
| 26 |
|
---|
| 27 | [ -e "$mountpoint/LAST-DISK" ] && cp -f $mountpoint/LAST-DISK /
|
---|
| 28 | old_pwd=`pwd`
|
---|
| 29 | cd $untar_path
|
---|
| 30 | counter=0
|
---|
| 31 | for fname in `tar -zxvf $tarball` ; do
|
---|
| 32 | [ -e "$softlink_path/$fname" ] && continue
|
---|
| 33 | mkdir -p $softlink_path/$fname 2> /dev/null
|
---|
| 34 | if [ ! -d "$untar_path/$fname" ] ; then
|
---|
| 35 | rmdir $softlink_path/$fname 2> /dev/null
|
---|
| 36 | ln -sf $untar_path/$fname $softlink_path/$fname
|
---|
| 37 | sync;sync;sync
|
---|
| 38 | fi
|
---|
| 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-"
|
---|
| 44 | done
|
---|
| 45 | cd $old_pwd
|
---|
| 46 | echo -e -n "\r"
|
---|
| 47 | [ ! -e "/tmp/CDROM-LIVES-HERE" ] && umount $mountpoint
|
---|
| 48 | sleep 1
|
---|
| 49 | if [ ! -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
|
---|
| 52 | fi
|
---|
| 53 | exit 0
|
---|
Note:
See
TracBrowser
for help on using the repository browser.