Grabar imagen ISO

Nombre: burniso
Autor: Luis Moreno Rodriguez
Lenguaje: Bash
Licencia: GPL
Dependencias: cdrecord ó wodim

Graba en CD o DVD una imagen ISO.

burniso imagen_iso
#!/bin/bash

# AUTOR: Luis Moreno Rodriguez          2010

function burniso () {
    # CD ROM device
    CDROM=/dev/sr0         

    if [ $# = 0 ] || [ "$1" = "--help" ] || [ "$1" = "-h" ]; then
        echo -e "Burn an iso image in CD. Usage 'burniso isofile'"
        return
    fi
    if [ ! -f "$i" ]; then echo "'$i' is not valid ISO file"
        return
    fi
    if ! ls $CDROM &>/dev/null; then
        echo -e "ERROR! the device $CDROM doesn't exists, adjust CDROM variable in the script."
        return
    fi 
   
    # SPEED=10            # If unspecified, uses max spd.
    DEVICE="1,0,0"

    eject $CDROM &>/dev/null 
    echo -e "Insert blank CD-R."
    echo "Press ENTER when ready."
    read                             
    eject -t $CDROM &>/dev/null  
    echo "Copying $1 to CD-R."

    if which wodim &>/dev/null; then
        if ! wodim -v -isosize dev=$DEVICE $1; then
            echo -e "ERROR! check the blank CD-R."
        fi       
    else
        if ! cdrecord -v -isosize dev=$CDROM $1; then   # speed=$SPEED
            echo -e "ERROR! check the blank CD-R, and that you have installed wodim or cdrecord."
        fi
    fi
    # Uses Joerg Schilling's "cdrecord" package (see its docs).
    # http://www.fokus.gmd.de/nthp/employees/schilling/cdrecord.html
    # Newer Linux distros may use "wodim" rather than "cdrecord" ...
    echo -e "\nDone copying $1 to CD-R on device $CDROM."
}

burniso $*