Writing CDs quickly - script included
On Sat, May 31, 2003 at 04:27:32PM -0400, Robert Tilley wrote:
> I did something which greatly surprised me recently: I reverted to
> Windows XP. I did so not out of nostalgia for the days of reboots.
> Rather, this was done for the ease of CD writing and to use the Kazaa
> network.
Hm. "ease" ... I have yet to find a way to burn a movie file to a CD
with _one_ mouse click.
> I am a P2P/Kazaa addict. I collect movies, pr0n, MP3s, etc. and often
> find myself burning CDs almost as quickly as my tray can open. After
Oh, you too? Then let's swap stuff ;)
> finding a dearth of CD writing apps on the Linux platform (rather,
> Easy-To-Use apps) I switched to XP for the ease of creating CD backups
> of my data. I know that with some time and effort, duplicating the
> same click-n-drag CD burning on XP is possible using KDE. I would
> like to switch back to a stable platform (plus, I'm a slut for a
> Debian-flavored penguin).
k3b, cdburnoven, etc. are GUI programs. I use something more effective
for me (because I often revert to midnight commander for file management
tasks), on the command line. I attached my script.
$ makecd "CD label" "file.avi"
creates a single CD with file.avi as the only file on it.
$ makecd "CD label" "file.mpg"
checks if the file is RIFF or MPEG, and if so, creates a (S)VCD.
$ makecd "CD Label" "directory/"
burns the specified directory to CD.
There is no simpler way. ;)
--
mfg, Jens Benecke
QOTD: The Internet is not a network of machines. It's a network of PEOPLE.
That's where its real power comes from.
http://www.rb-hosting.de - Webhosting mit Extras
Werbefreies Hosting ab €7 - SSH-Zugang ab €19 - Günstiger Traffic
#!/bin/bash
# set -e -x
#
# Burn a directory structure on CD, using cdrecord, buffer and mkisofs.
#
# It supports Joliet and Rockridge extensions and optionally burns the
# e2fs attributes (like UIDs, rwxrwx, suid, etc) on the CD. Perfect for
# backups (provided you also backup your /etc/passwd so you can restore the
# UID <-> username dependancies).
#
# (c) by Jens Benecke <jens@pinguin.conetix.de>, 1999.
#
# This script is distributed under the GNU Public Licence, v2.0. If you
# improve it, please send me a note. A 'dialog' version is in development.
#
# Syntax: See below.
#
# Please SYMLINK THIS TO 'makecd' and/or 'makeimg' if you want to do
# on-the-fly burning! The program checks how it is called and acts
# accordingly.
#
# The trouble with the permissions I solved the following way: I made
# cdrecord suid root, BUT also used root.cdburn user/group and rws--x--- as
# permissions. So, now everybody that is in group cdburn can burn CDs,
# everyone else cannot even execute cdrecord itself. This also ensures that
# cdrecord gets enough system resources to prevent buffer underruns.
#
# ATTENTION:
# Sometimes cdrecord failes to fix the CD after burning multi session. It
# looks like an error, but is just a warning that the CD hasn't been
# fixated. If this happens to you, just use
#
# cdrecord -fix -dev X,0
#
# where X is your CDRID (the one you supplied below). This will fixate the
# CDR.
#
# change this to reflect your CD BURNER device. This is needed to continue
# multi session tracks.
CDDEV=/dev/sr0
# change this to reflect the SCSI ID of your CD BURNER.
CDRID=0
###########################################################################
# shouldn't need to change anything below here
#
NAME=`basename $0`
MKISOFS="mkisofs -A Made_with_Linux"
MKISOPTS="-q -f -J -r "
CDRECORD="cdrecord"
# Real CDRECORD options in /etc/defaults/cdrecord
CDROPTS="-v -overburn -driveropts=burnproof -fs=30m -dev 0,0 -pad -eject -multi -"
CDROPTSA="-v -overburn -driveropts=burnproof -fs=30m -dev 0,0 -pad -eject -multi"
if [ "$#" -eq "0" ] ; then
echo "Usage: makeimg <Volume_ID> <path> <image_name>"
echo " makecd test"
echo " makecd <Volume_ID> <path>"
echo "(makecd must be called as root or s.o. with CDR write access)"
exit 1
fi
if [ "$1" == "test" ] ; then
echo "### This feature will mount your CD (unless not already done)"
echo "### and try reading every file on it, and tell you of any errors."
echo "### On a 24x CDROM, a full CD will probably take 5-10 minutes."
if test -z "$2" ; then
echo -n "### Enter your CD mount point or press CTRL-C to break [/mnt/cd1]: "
read MOUNTCD
test -z "$MOUNTCD" && MOUNTCD=/mnt/cd1
else
MOUNTCD="$2"
fi
echo -n "### Mounting CD ..." ; mount $MOUNTCD ; echo
file $MOUNTCD/*
echo -n "### Reading files ..."
find $MOUNTCD -type f | while read FILE ; do
cat "$FILE" >/dev/null && echo -n "."
done
sleep 2
eject $MOUNTCD
echo -e "\n### Done."
exit 0
fi
if test $NAME == "makecd" ; then
# if pwd|grep "/home">/dev/null ; then
# echo "### You are probably burning from a NFS mounted directory (/home)!"
# read PAUSE
# fi
echo -n "### Use dummy mode? (y/N) "
read T ; [ "$T" == "y" ] && DUMMY="-dummy"
# echo -n "### Use what speed? (1,2,4,6,8,12,16,24,...) [24] "
# read T ; test -z "$T" && T=24
echo -n "### Use DAO (Disk At Once)? (y/N) "
read DAO ; [ "$DAO" == "y" ] && DAO="-dao"
CDROPTS="-speed 24 $DAO $DUMMY $CDROPTS"
CDROPTSA="-speed 24 $DAO $DUMMY $CDROPTSA"
fi
if test "$1" == "audio" ; then
shift
echo "---------------------------------------------------------------------------"
echo $CDRECORD $CDROPTSA $*
echo "---------------------------------------------------------------------------"
$CDRECORD $CDROPTSA $*
exit
fi
# wenn $2 (DIR) eine Datei ist, dann temp. Verzeichnis erstellen, Datei da
# reinlinken und das Verz. brennen.
if test -f "$2" ; then
file "$2" | egrep "MPEG|RIFF" && MPG=1
file "$2" | grep "AVI" && unset MPG
if [ "$MPG" != "" ]; then
echo -n "[$2] seems to be MPEG. Do you want a [v]CD or [s]VCD?"
read VCD
test "$VCD" == "v" && VCD=""
test "$VCD" == "s" && VCD="-t svcd"
if file "$2" | grep "RIFF" ; then
cdxa2mpeg "$2" temp-$$.mpg
INFILE=temp-$$.mpg
else
INFILE="$2"
fi
echo -e "\n\nnice vcdimager $VCD --update-scan-offsets --add-dir=SEGMENT \
-l \"$1\" --iso-application-id=\"$1\" -v \"$INFILE\" \
&& cdrdao write --speed 24 --eject --device $CDRID,0 --driver generic-mmc videocd.cue \
&& rm -vf videocd.* temp-$$.mpg\n\n"
nice vcdimager $VCD --update-scan-offsets --add-dir=SEGMENT \
-l "$1" --iso-application-id="$1" -v "$INFILE" \
&& cdrdao write --speed 24 --eject --device $CDRID,0 --driver generic-mmc videocd.cue \
&& rm -vf temp-$$.mpg videocd.*
exit 0
fi
echo "[$2] is a file, not a directory. Making temp directory."
mkdir /tmp/$NAME.$$
ln -s "$PWD/$2" "/tmp/$NAME.$$"
DIR="/tmp/$NAME.$$"
elif test -d "$2" ; then
echo "[$2] is a directory. Not making temp directory (not needed)."
DIR="$2"
fi
#if [ -f "$2" ] && [ $1 != "audio" ] ; then
# echo -n "### OK to overwrite $2 (CTRL-C if not)?"
# read JUNK
#fi
#echo -n "### Use ISO9660 Mode 2 (long filenames)? (y/N) "
#read T ; [ "$T" == "y" ] && MKISOPTS="${MKISOPTS} -l "
#echo -n "### Follow symbolic links? (Y/n) "
#read T ; [ "$T" == "n" ] || ( MKISOPTS=" -f ${MKISOPTS} " ; L="L" )
L="L"
#echo -n "### Use ISO9660 Rock Ridge Extensions (file uid/gid, modes)? (y/N) "
#read T ; [ "$T" == "y" ] && MKISOPTS="${MKISOPTS} -R " || MKISOPTS="${MKISOPTS} -r"
echo "### Please INSERT YOUR CDR containing the first session if you want this."
echo -n "### Include first session on CD (i.e. append another session)? "
read T ; if test "$T" == "y" ; then
SESSION="`cdrecord -dev $CDRID,0 -msinfo`"
MKISOPTS="$MKISOPTS -C $SESSION -M $CDDEV "
echo "### mkisofs new options: $MKISOPTS"
echo "### Second session will be started at $SESSION on $CDDEV."
fi
echo -n "### Calculating image size ..."
if [ $NAME == "makecd" ] ; then
ISOSIZE="`$MKISOFS $MKISOPTS --print-size $DIR 2>/dev/null | grep -v ^Using | \
sed 's/.*written = //'`"
CDROPTS="tsize=${ISOSIZE}s ${CDROPTS}"
fi
SIZE=`du -${L}sb "$DIR" | cut -f1`
echo
# SIZE=`$MKISOFS $MKISOPTS -print-size`
#if [ "$SIZE" -ge "681000000" ] ; then
# echo "### The image size is/will be $SIZE, this might not fit on the disk."
# echo -n "### Continue? (Ctrl-C)"
# read JUNK
#else
echo "### Image size will be $SIZE bytes (ISO size: $ISOSIZE)."
#fi
test -z "$DUMMY" || echo "### Writing in SIMULATION mode."
OUT=${3-\-}
echo "### mkisofs parameters : $MKISOPTS -V $1 -o $3 $DIR"
test $NAME == "makecd" && echo "### cdrecord parameters: $CDROPTS"
sleep 2
#nicht mehr gebraucht, -> größeren cdrecord buffer nehmen!
#BUFF=`which buffer 2>/dev/null`
#test -x "$BUFF" && BUFF=" $BUFF -p 75 -m 4096000 "
test $NAME == "makeimg" && $MKISOFS $MKISOPTS -V "$1" -o "$3" "$DIR"
test $NAME == "makecd" && ( $MKISOFS $MKISOPTS -V "$1" "$DIR" | $CDRECORD $CDROPTS ) 2>&1
#test $NAME == "makecd" && ( $MKISOFS $MKISOPTS -V "$1" "$DIR" | $BUFF | $CDRECORD $CDROPTS ) 2>&1
echo -n "Key..."
read Y
Reply to: