How to burn your installation DVD

openSUSE 11.3 is out and many people are busy burning DVDs. A common source of future problems during installation is insufficient checking of the burnt media. I present a small bash shell script which will take care of the MD5-checksums and perform the actual burning operation.

Prerequities: Needs packages cdrkit-cdrtools-compat and wodim.
You have downloaded the iso image for a 32 Bit or 64 Bit PC from your nearest mirror. I recommend to pick a mirror from software.opensuse.org: Download openSUSE 11.3 selecting the “Pick Mirror” option and selecting your “Type of Computer”. Then click “Download DVD” and copy/paste the link of the mirror to the command line in a terminal window. Mine looks like:

wget -c http://mirror.switch.ch/ftp/mirror/opensuse/distribution/11.3/iso/openSUSE-11.3-DVD-i586.iso

Have a cup of coffee. When your download is interrupted for any reason you may repeat the command. Once the download was successful you are ready for burning. Copy/paste the following shell script to the same directory where your iso file is saved. Name it ‘burn-iso’ (without the quotes) and make it executable:

chmod +x burn-iso

Before you can run the script you have to do some configuration. Open the script file in your preferred editor (vi, joe, …) and set the correct values for MEDIA and SPEED. Set MEDIA to the device of your DVD-burner. A burning speed of 4 works well for me. According to the type of your iso file (32-Bit or 64-Bit) uncomment the corresponding lines for variables MDSUM and ISOFILE. Here is the script:

#!/bin/bash
# Script burn-iso
# Burn iso file <openSUSE-11.3-DVD-i586.iso> or
#               <openSUSE-11.3-DVD-x86_64.iso> to DVD
# Author:  vodoo
# Licence: public domain
#
# Set true | false
CHECKMD5="true"

##########################################
# User configuration: set your values here
##########################################
MEDIA="/dev/sr0"
SPEED="4"
##########################################
# For 32-bit version enable these:
MDSUM="1a1da28c84e3cdad750d5cfa21c4fd17"
ISOFILE="openSUSE-11.3-DVD-i586.iso"
##########################################
# For 64-bit Version uncomment these:
# MDSUM="adf5d2a0a03c1e3aaf102fd6a4771b87"
# ISOFILE="openSUSE-11.3-DVD-x86_64.iso"
##########################################

if test $EUID != 0 ; then
        echo "Must be run as root"
        exit 1
fi

if $CHECKMD5 ; then
        echo "Checking iso source file integrity ..."
        MDEFF=$(md5sum $ISOFILE | sed -e "s/ .*//")
        if ! test "$MDEFF" == "$MDSUM" ; then
                echo "Source-iso: md5sum does not match!"
                exit 1
        else
                echo "Source-iso: md5sum is correct."
        fi
fi

echo "Burning DVD ..."
nice -n -19 cdrecord -v dev=$MEDIA speed=$SPEED fs=32m \
        driveropts=burnproof -eject $ISOFILE
echo "Finished"

if $CHECKMD5 ; then
        echo
        echo -e "Please close the DVD drive again and press <ENTER>"
        read RESP
        echo
        echo "Waiting 20 seconds ..."
        sleep 20
        echo "Media check ..."
        DVDINFO=$(/usr/bin/isoinfo -d -i $MEDIA)
        BSIZE=$(echo "$DVDINFO" | sed -e "/^Logical block size is:/ !d" \
                -e "s/^Logical block size is: //")
        VSIZE=$(echo "$DVDINFO" | sed -e "/^Volume size is:/ !d" \
                -e "s/^Volume size is: //")
        if test -z "$BSIZE" -o -z "$VSIZE" ; then
                echo "Reading DVD info failed; aborting media check"
                exit 0
        fi
        MDEFF=$(dd if=$MEDIA bs=$BSIZE count=$VSIZE conv=notrunc,noerror \
                2>/dev/null | md5sum - | sed -e "s/ .*//")
        if ! test "$MDEFF" == "$MDSUM" ; then
                echo "Media $MEDIA: md5sum does not match!"
                echo "Burning failed."
                echo "Please do not use this DVD for installation!"
                exit 1
        else
                echo "Media $MEDIA: md5sum is correct."
        fi
fi
exit 0

When the configuration is done insert a blank DVD disk into the burner and run the script as user root:

su -c './burn-iso'

Enter the root password when asked for it.

The script will check the MD5 sums of the downloaded iso file and of the burnt DVD. This may take up to 4 minutes - be patient. Have a look at the script code to see how this is done.

Have a lot of fun.

On 2010-07-17 14:46, vodoo wrote:
>
> openSUSE 11.3 is out and many people are busy burning DVDs. A common
> source of future problems during installation is insufficient checking
> of the burnt media. I present a small bash shell script which will take
> care of the MD5-checksums and perform the actual burning operation.
>
> Prerequities: Needs packages cdrkit-cdrtools-compat and wodim.
> You have downloaded the iso image for a 32 Bit or 64 Bit PC from your
> nearest mirror. I recommend to pick a mirror from
> ‘software.opensuse.org: Download openSUSE 11.3’

Just pick a good metalink downloader (aria2c, for example), and give it the metalink url of the iso
(in the above link). It will download using several mirrors simultaneously so as to maximize your
bandwidth, including torrent d/u, and will run checksums on the downloaded image, and re-download
any fragment with errors, so that in the end you get a guaranteed perfect iso image.

Automatically :-.)


Cheers / Saludos,

Carlos E. R.
(from 11.2 x86_64 “Emerald” GM (Elessar))

As openSUSE 12.1 has been released today I took the occasion to update my download / burn script again.

What it does:

  1. The script will download the current ISO file using aria2c. The user may interrupt the download at any time typing ^C and the download will resume when the script is started again. The download will be skipped automatically when the complete file already exists.

  2. The MD5 sum of the downloaded ISO file is checked.

  3. When everything seems ok the user is prompted to insert a blank DVD and press y <enter>. The ISO file will be burnt on the DVD.

  4. When the burning process is terminated the tray with the DVD should open. Close it again and press <enter> to start the media check. This step verifies the checksum on the media.

  5. Parameters to tweak: You may want to adapt the value of the variables ARCH, DISTRO, SPEED and MEDIA at the beginning of the script. It defaults to 12.1 and i586. You can select the desired architecture without changing the script by specifying the architecture i586 or x86_64 as the first argument on the command line. Burning speed of 4x should be ok in most cases, but make sure to set the correct device for your DVD drive. Default is /dev/sr0

./burn-iso [i586 | x86_64]
  1. How to install? Save the script to a file named ‘burn-iso’ and make it executable:
chmod +x burn-iso
  1. How to use? Copy the executable script to the place where you want your downloaded ISO file. Then start it as user root:
# ./burn-iso <arch>]

Here it is:

#!/bin/bash
# Script burn-iso
# Burn iso file <openSUSE-12.1-DVD-i586.iso> or
#               <openSUSE-12.1-DVD-x86_64.iso> to DVD
# Author:  vodoo
# Version: 12.1 (2011-11-16)
# Licence: public domain
#
##########################################
# User configuration: set your values here
##########################################
ARCH="i586"
#ARCH="x86_64"
DISTRO="12.1"
MIRROR="download.opensuse.org"
SPATH="distribution"
MEDIA="/dev/sr0"
SPEED="4"
METHOD="aria2c"
#METHOD="wget"
##########################################

# Set true | false
CHECKMD5="true"
TESTONLY="false"

# Accept architecture as <arg1>
if test -n "$1" ; then
        if test "$1" = "i586" ; then
                ARCH="$1"
        elif test "$1" = "x86_64" ; then
                ARCH="$1"
        else
                echo "Bad argument: $1"
                echo "Architecture is: i586 | x86_64"
                exit 1
        fi
fi

# Check for required cdrecord
if ! $TESTONLY ; then
        BURNPROG=$(which --skip-functions cdrecord 2>/dev/null)
        if ! test $? = 0 ; then
                echo "Needs cdrecord for burning. Please install it."
                exit 1
        fi
fi

# Must be root to renice for burning
if test $EUID != 0 ; then
        echo "Must be run as root"
        exit 1
fi

ISOFILE="openSUSE-$DISTRO-DVD-$ARCH.iso"
URL="http://$MIRROR/$SPATH/$DISTRO/iso"

# Download the checksum
if ! test -r $ISOFILE.md5 ; then
        wget $URL/$ISOFILE.md5
fi

# Get the checksum of our target
MDSUM=$(cat $ISOFILE.md5 | sed -e "s/ .*//")

# Download the iso
downloadiso()
{
        echo "Downloading $ISOFILE ... "
        if test "$METHOD" = "wget" ; then
                wget --progress=bar -c $URL/$ISOFILE
        elif test "$METHOD" = "aria2c" ; then
                aria2c --max-upload-limit=50K $URL/$ISOFILE
        else
                echo "Unknown method '$METHOD'"
                exit 1
        fi

        # When user interrupted the download stop here
        if ! test $? = 0 ; then
                date "+Download of $ISOFILE stopped at %Y-%m-%d %H:%M:%S" > interrupted
                echo "Download interrupted"
                exit 1
        fi
}

if test -r $ISOFILE ; then
        if test -f interrupted ; then
                rm -f interrupted
                downloadiso
        else
                echo "$ISOFILE found, skipping download"
        fi
else
        downloadiso
fi

if $CHECKMD5 ; then
        ISCLEAN="false"
        COUNT=3
        while ! $ISCLEAN ; do
        echo "Checking iso source file integrity ..."
        MDEFF=$(md5sum $ISOFILE | sed -e "s/ .*//")
        if ! test "$MDEFF" == "$MDSUM" ; then
                echo "Source-iso: md5sum does not match!"
                echo "MD5 checksum should be: $MDSUM"
                echo "MD5 checksum computed:  $MDEFF"
                downloadiso
        else
                echo "Source-iso: md5sum is correct."
                echo "MD5 checksum should be: $MDSUM"
                echo "MD5 checksum computed:  $MDEFF"
                ISCLEAN="true"
        fi
        if test "$COUNT" == "0" ; then
                echo "Download of a clean iso file failed; giving up"
                exit 1
        fi
        COUNT=$(($COUNT - 1))
        done
fi

if ! $TESTONLY ; then
        echo "Burning $ISOFILE DVD"
        echo "Insert a blank DVD and hit <y> to burn, <s> to skip, ^C to quit"
        read RESP
        if test "$RESP" == "y" ; then
                echo "Burning DVD ..."
                nice -n -19 $BURNPROG -v dev=$MEDIA speed=$SPEED fs=32m driveropts=burnproof -eject $ISOFILE
                echo "Finished"
        fi
fi

if $CHECKMD5 ; then
        echo
        echo -e "Please close the DVD drive again and press <ENTER>"
        read RESP
        echo
        echo "Waiting 30 seconds ..."
        sleep 30
        echo "Media check ..."
        BSIZE="2048"
        SSIZE=$(find ./ -name $ISOFILE -printf '%s
')
        VSIZE=$(echo "scale=0; $SSIZE / $BSIZE" | bc)
        echo "Logical block size:    $BSIZE"
        echo "Volume size:        $VSIZE"
        MDEFF=$(dd if=$MEDIA bs=$BSIZE count=$VSIZE conv=notrunc,noerror \
                2>/dev/null | md5sum - | sed -e "s/ .*//")
        if ! test "$MDEFF" == "$MDSUM" ; then
                echo "Media $MEDIA: md5sum does not match!"
                echo "Burning failed."
                echo "Please do not use this DVD for installation!"
                echo "MD5 checksum should be: $MDSUM"
                echo "MD5 checksum computed:  $MDEFF"
                exit 1
        else
                echo "Media $MEDIA: md5sum is correct."
                echo "MD5 checksum should be: $MDSUM"
                echo "MD5 checksum computed:  $MDEFF"
        fi
fi
exit 0

Have fun!