dvdrec tool Code
Status: Alpha
Brought to you by:
jan_conrads
#!/bin/sh
# "dvdrec" a interactive script to create CD/DVD using mkisofs and cdrecord
# Copyright (C) 2007 Jan Conrads
# This program is free software; you can redistribute it and/or modify it under the terms of the
# GNU General Public License as published by the Free Software Foundation; either version 2 of the
# License, or any later version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
# without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with this program; if
# not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110,
# USA
######################################################################################################
### put the location of used programs in here if not in PATH
mkisofs="mkisofs"
cdrecord="cdrecord"
dvdrwformat="dvd+rw-format"
######## test weather mkisofs and cdrecord can be found ######################################
which $mkisofs 2> /dev/null >/dev/null
if [ "$?" != "0" ]; then
echo "Sorry! I can't find "mkisofs" in PATH"
echo "Please check that is installed. If installed, please set the correct path in this script"
echo "with the variable mkisofs= "
exit 1
fi
which $cdrecord 2> /dev/null > /dev/null
if [ "$?" != "0" ]; then
echo "Sorry! I can't find "cdrecord" in PATH"
echo "Please check that is installed. If installed, please set the correct path in this script"
echo "with the variable cdrecord= "
exit 1
fi
which $dvdrwformat 2> /dev/null > /dev/null
if [ "$?" != "0" ]; then
echo "Sorry! I can't find "dvd+rw-format" in PATH"
echo "Please check that is installed. If installed, please set the correct path in this script"
echo "with the variable dvdrwformat= "
exit 1
fi
#############################################################################################
############### here the variables##########################
version=0.0.2
tmp="/tmp/dvdrec_tmp.iso" # the temponary image file
CD="/dev/cdrom" # your CD drive
format="-allow-limited-size -udf" # use udf as standard
PUB="-p dvdrec_by_Jan_Conrads" #don't touch the "-p"
############# put the functions here ########################
info()
{
#clear
echo " dvdrec version "$version" by Jan Conrads "
echo ---------------------------------------------------------------------------------
#echo "[T]: set title [F]:choose file" [set-dev]:set device [dvdrw-f] :format DVDRW
#echo "[create]:create [add]: add session [burn]:Burn it!" [burn-fix]: burn and fix
#echo "[quit]: to exit [quit-k]: keep image [j]:iso9660 [u]: udf"
#echo
echo "[t]: set title [add] : new session [create] : new >4GB file disk "
echo "[f]: choose file(s) [burn]: Burn ! [burn-fix]: burn and fix "
echo " [dev] : set device [image] : burn an image file "
echo "[j]: iso9660 [quit]: Exit! [dvdrw-f] : format DVDRW "
echo "[u]: udf [info]: info [quit-k] : Exit, keep image "
echo "title :>"$title"<"
echo "file :>"$file"<"
if [ "$format" == "-allow-limited-size -udf" ]; then
echo "format:> UDF"
fi
if [ "$format" == "-J" ]; then
echo "format:> iso9660"
fi
echo "device:>"$CD
}
set_device()
{ echo "Enter the name of your CDROM";read -ep "Name:>" CD; }
format_dvdrw()
{ $dvdrwformat -force $CD; }
file_to_burn()
{ echo "Enter the name of the file to burn"; read -ep "Name:>" file; }
disk_title()
{ echo "Enter the title of the CD/DVD (max 16 chars)";read -p "title:>" title; }
burn_fix()
{ $cdrecord -v driveropts=burnfree dev=$CD $tmp; }
burn_multi()
{ $cdrecord -v -multi -nofix driveropts=burnfree dev=$CD $tmp; }
multi_info()
{ info=$($cdrecord -msinfo); }
create_multi_image()
{ multi_info;$mkisofs $format -VV -o $tmp -C $info -M $CD -r $PUB $file; }
create_single_image()
{ $mkisofs $format -VV -o $tmp -r $PUB $file; }
burn_image()
{ echo "Enter the name of your image";read -ep "Name:>" img;$cdrecord -v driveropts=burnfree dev=$CD $img; }
quit_normal()
{ rm -f $tmp;word=q;echo "Bye!"; }
quit_keep_image()
{ word=q;echo "Don't forgot to remove the image!\n $tmp"; }
####################################################################################################
word=0
clear # make us a clean screen
echo "dvdrec version "$version", Copyright (C) 2007 Jan Conrads"
echo "dvdrec comes with ABSOLUTELY NO WARRANTY"
echo "This is free software, and you are welcome to redistribute it"
echo "under certain conditions; read the file license.txt for details."
sleep 2
clear
while [ "$word" != "q" ] ; do
info
read option
clear
case "$option" in
####################### the menu ########################################
t)
disk_title
;;
f)
file_to_burn
;;
info)
multi_info
;;
dev)
set_device
;;
dvdrw-f)
format_dvdrw
;;
create)
create_single_image
;;
add)
create_multi_image
;;
image)
burn_image
;;
burn-fix)
burn_fix
;;
burn)
burn_multi
;;
quit-k)
quit_keep_image
;;
quit)
quit_normal;;
j)
format="-J"
;;
u)
format="-allow-limited-size -udf"
;;
*)
echo "unknown option" $option
esac
done