Re: VOLHDR or something
Joerg Schilling <[email protected]> Thu, 15 Dec 2005 14:10:28 +0100
| Newsgroups | gmane.comp.archivers.star.user |
|---|---|
| Message-ID | <43A16B44.nailD9W119S01@burner> |
"Zoran Ljubisic" <[email protected]> wrote: > star -c f=/dev/st0 VOLHDR=Test . > > How can I read VOLHDR from tape? > I don't want to extract nothing but a VOLHDR. This script "finds" the file mark position on tape asuming that the volhdr is follows a "hostname:directory" rule: /*--------------------------------------------------------------------------*/ #!/bin/sh # # Remove all files created by us.. # trap "rm -f /tmp/sdd.$$; exit" 0 1 2 15 BLOCKSIZE=256k TAPE=/dev/rmt/0cbn TAPE=/dev/null TAPE=/dev/tape #TAPE=/dev/null HOST=mouse.berlios.de TUSER=tape RTAPE=${TUSER}@${HOST}:${TAPE} MT="smt -f $RTAPE" usage() { echo "Usage: findba \"hostname:directory\"" exit 1 } if [ $# -lt 1 ]; then usage fi if [ .$BASH != . ]; then echo() { builtin echo -e "$@" } fi $MT -wready nop $MT rewind $MT status I=0 while true; do echo "Tape File # $I ---->\c" sdd if= $RTAPE bs=$BLOCKSIZE count=1 of=/tmp/sdd.$$ 2> /dev/null if [ ! -s /tmp/sdd.$$ ]; then echo EOF echo "Pattern not found" exit fi head=`star -tv f=/tmp/sdd.$$ 2>/dev/null | match -- '--Volume Header--'` echo "$head" echo "$head" | match -s " $1 --Volume Header--" if [ $? -eq 0 ]; then echo "Pattern found" $MT bsr 1 $MT sta exit fi $MT fsf I=`expr $I + 1` done /*--------------------------------------------------------------------------*/ Jörg -- EMail:[email protected] (home) Jörg Schilling D-13353 Berlin [email protected] (uni) [email protected] (work) Blog: http://schily.blogspot.com/ URL: http://cdrecord.berlios.de/old/private/ ftp://ftp.berlios.de/pub/schily