home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 2001 July
/
Chip_2001-07_cd1.bin
/
tema
/
linux6
/
vypal.sh~
< prev
Wrap
Text File
|
2001-06-04
|
4KB
|
158 lines
#!/bin/bash
set -h
#echo "Pocet parametru je $n"
#mapovani CD-ROM na SCSI
DEV=`cdrecord -scanbus|grep CD-ROM| cut -d" " -f1|tr -d '\t' `
R=$?
if [ $R != 0 ] ; then
echo 'Mate problem s vypalovackou'
fi
usage(){
if [ "$*" == "" ]; then
echo 'Pouziti: vypal.sh jmeno_image_souboru cesta_k_stromu/adresari_ktery_vypalujete'
exit 1
fi
}
checktree() {
mount $MNTCDROM
S=$?
if [ "$S" != "0" ] ; then
echo "Image se neda pripojit"
exit 1
fi
if [ "$DISPLAY" == "" ] ; then
tree $MNTCDROM
else
$BROWSER $MNTCDRO
fi
}
info() {
cdrecord -toc dev=$DEV
}
closed() {
if [ "$AFTERTEST" == "1" ] ; then
:
else
CMD="mkisofs -R -J -l -allow-lowercase -allow-multidot -max-iso9660-filename -N -o ${IMG} ${SRC}"
echo "$CMD"
echo "Zkontroluj si prikaz, dej Enter nebo Ctrl-C"
read Q
eval $CMD
fi
# checktree #nema smysl u druhe a dalsi session
cdrecord -v $EJECT $DUMMY -speed=$SPEED dev=$DEV -multi -data ${IMG}
}
opened() {
if [ "$AFTERTEST" == "1" ] ; then
:
else
echo Tvorim image soubor
Q=`echo $SRC |grep =`
if [ "$Q" != "" ]; then
GRAFT=-graft-points
fi
CMD="mkisofs -R -J -l $GRAFT -allow-lowercase -allow-multidot -max-iso9660-filename -N -C `cdrecord -msinfo dev=$DEV` -M /dev/scd0 -o ${IMG} ${SRC}"
echo "$CMD"
echo "Zkontroluj si prikaz, dej Enter nebo Ctrl-C"
read Q
eval $CMD
fi
checktree
cdrecord -v $EJECT $DUMMY -speed=$SPEED dev=$DEV -multi -data ${IMG}
}
testparams() {
if [ "$IMG" == "" ] ; then
echo 'Zadejte cestu k image souboru jako prvni parametr'
exit 1
fi
if [ "$SRC" == "" ] ; then
echo "Zadejte cestu k souboru/adresari, ktery chcete vypalit, a to jako druhy parametr"
exit 1
else
:
fi
}
#sem jeste zohlednit graft cestu s =
runparams() {
echo 'Jenom test ?A/N a Enter'
read A
case $A in
A|a) DUMMY="-dummy" ;;
*) DUMMY="";;
esac
echo 'Vysunout medium po skonceni? A/N a Enter'
read B
case $B in
A|a) EJECT="-eject" ;;
*) EJECT="" ;;
esac
echo 'Zadejte rychlost 2,4,6,8 a Enter'
read SPEED
echo 'Pokud jiz existuje image soubor a nema se tvorit, potvrdte A a Enter'
read Q
case $Q in
A|a) AFTERTEST=1 ;;
*) AFTERTEST=0 ;;
esac
}
#main
IMG=$1
SRC=$2
DUMMY=""
GRAFT=""
EJECT=""
SPEED=4
MNTCDROM="/mnt/cdrom"
BROWSER=konqueror
echo "CDROM je mapovano jako $DEV"
echo "Image soubor je $IMG a strom je $SRC"
echo 'Chcete vypalovat Jedinou stopu/Prvni z mnoha a dalsi/Cist informace z CD? J/P/C a Enter'
read Q
case $Q in
j|J) testparams; runparams;closed ;;
p|P) testparams;runparams;opened ;;
c|C) info ;;
*) echo 'Chybne zadani' ; exit 1 ;;
esac
exit
#co spadlo pod stul
#vypaleni druhe a dalsi stopy
#mkisofs -R -J -l -allow-lowercase -allow-multidot -max-iso9660-filename -N -C `cdrecord -msinfo $DEV` -M /dev/scd0 -o ${IMG} ${SRC};echo "Enter nebo Ctrl-C";cdrecord -v -eject $SPEED $DEV -multi -data ${IMG}) '
#vypaleni druhe a dalsi stopy se zadanym bodem roubu
# if [ ! -f $SRC ] && [ ! -d $SRC ] ; then
# echo 'Zadana cesta k souboru/adresari, ktery chcete vypalit, neexistuje'
# exit 1
#fi
#nema smysl, pokud se zadava seznam cest k vypaleni