El Rancho San Benito Community Resource Website
San Benito County Community Resource Website

--Paul McNett, Earthling
Home
XML

My Useful Python Shell Script: Burning CD-R's - Jul 19, 2004 14:32
I frequently burn CD-R discs, usually for the purpose of distributing my
custom applications to my clients. Up until last week, I was doing the 
burning on my Windows NT system using Sony Spressa, simply because it
worked and that's how I always did it. 

However, that method got very inconvenient since I've reorganized my 
computers. As I've been transitioning to Linux, my NT box is now sitting
in my garage, and it is tucked inside a cabinet which cuts off access to
the cd burner. My Toshiba laptop running Red Hat 9 Linux has a cd burner
that I had never used: it was time to get familiar with it.

It took a little research and a bunch of coasters to arrive at a system
for reliably producing cd's, and once I arrived at that system I didn't 
want to have to remember the command line switches every time. Enter a
great opportunity for shell scripting. 

The following Python scripts wrap the mkisofs and cdrecord utilities that
certainly exist on your Linux setup. You may need to tweak the files for 
your system, but probably not. 

I keep all the source for my scripts in my Subversion repository, with a
local working copy in ~/projects/scripts. I keep symbolic links to these
scripts inside ~/scripts, and I've added ~/scripts to my $PATH (in .bashrc).
For example:

	cd ~/scripts
	ln -s ../projects/scripts/cdrecord-pkm.py cdrecord-pkm
	ln -s ../projects/scripts/mkisofs-pkm.py mkisofs-pkm
	ln -s ../projects/scripts/burn-pkm.py burn-pkm
	
This lets me type 'burn-pkm sbs.exe' to burn my sbs.exe client distribution
from whatever directory I happen to be in, and all I need to do is have
a blank CD-R in my burner.

Anyway, here are my scripts. I hope they are helpful.

	mkisofs-pkm.py
	cdrecord-pkm.py
	burn-pkm.py
	

© 2004 Paul McNett       [/Computing/Linux] permanent link

Feel free to link to a story by using the 'permanent link' feature. Please do not reprint a substantial part of a story without permission. Please make sure to have some fun every day, because time keeps on ticking away.