SCOUG Logo


Next Meeting: Sat, TBD
Meeting Directions


Be a Member
Join SCOUG

Navigation:


Help with Searching

20 Most Recent Documents
Search Archives
Index by date, title, author, category.


Features:

Mr. Know-It-All
Ink
Download!










SCOUG:

Home

Email Lists

SIGs (Internet, General Interest, Programming, Network, more..)

Online Chats

Business

Past Presentations

Credits

Submissions

Contact SCOUG

Copyright SCOUG



warp expowest
Pictures from Sept. 1999

The views expressed in articles on this site are those of their authors.

warptech
SCOUG was there!


Copyright 1998-2024, Southern California OS/2 User Group. ALL RIGHTS RESERVED.

SCOUG, Warp Expo West, and Warpfest are trademarks of the Southern California OS/2 User Group. OS/2, Workplace Shell, and IBM are registered trademarks of International Business Machines Corporation. All other trademarks remain the property of their respective owners.

The Southern California OS/2 User Group
USA

April 2004


 Dear Mr. Know-It-All 

Mr. Know-It-All has the answers to even the really tough questions.


Question:

Last year, Mr. KIA said he might be convinced to discuss his 4OS2 aliases for cdrecord at some future date. Is it time yet?

Answer:

OK. You convinced me. For those that don't know, 4OS2 was originally developed by JP Software and has been open sourced. I will assume you have working 4OS2, cdrecord and ISOFS setups. If not, you can get current versions at Hobbes. Setup help is available on the SCOUG mailing lists and elsewhere.

Organization

Mr. KIA's CD burning tools are organized as a set of 3 global scripts and 2 optional, local scripts. The global scripts take care of common initialization and cleanup and are stored in a well known location. The optional, local scripts invoke the global scripts and do any setup required for the specific CD content. The local scripts are stored in a directory that contains other tools and files related to the specific CD content. Usually this directory is a subdirectory of the directory where the global scripts are stored, but this is not required. The local directory is a good place to store a CD specific version of .mkisofsrc.

The global scripts are:

  • init.cmd sets up a generic environment. The script sets up environment variables and defines aliases and does other common initialization. The aliases delay evaluating the environment variables for as long as possible. This allows settings to be adjusted by updating the environment variable. The aliases do not need to be changed.
  • shut.cmd shuts down the burn setup. The script releases the alias definitions, unmounts the ISO and cleans up work files.
  • h.cmd displays the cdrecord and mkisofs help files.

The local scripts are:

  • init.cmd sets up a local environment. The script invokes the global init.cmd and then does CD content specific initialization. This is the place to override the write speed or unzip files to temporary directories.
  • shut.cmd shuts down the local environment. The script invokes the global init.cmd and then does CD specific cleanup. This is the place to clean up and temporary files and directories.

The Global Scripts

These scripts make assumptions on file locations and names and refer to several common utilities. You will need to make minor edits to adjust the scripts to work on your system. The scripts refer to the external script AskYN.btm, a copy of which is provided at the end of this article. Annotated explanations follow in the next section.

This is init.cmd:

:: Init - init burn tools

:: This program is free software licensed under the terms of the GNU
:: General Public License.  The GPL Software License can be found in
:: gnugpl2.txt or at http://www.gnu.org/licenses/licenses.html#GPL

set DIR=J:\Util\BurnCDRom;D:\MMedia\CDRecord;D:\MMedia\ISOFS\bin
set PATH=%DIR%;%PATH%
:: For help
set DIR=d:\MMedia\CDRecord

set ISOFILE=j:/tmp/tmp.iso
set ISOFILED=j:\tmp\tmp.iso

:: Define CD-R
set CDR_DEVICE=1,4,0
:: Not sure if tested - 4x worked as of 3/3/03
set CDR_SPEED=12
set CDR_FIFOSIZE=16M

:: Define tool aliases

:: Absolute time in pre-grove - media status
alias atip cdrecord -atip

:: Blank CD-RW
alias blank cdrecord -blank=fast

:: Record single-session using %ISOFILE
alias burns cdrecord -vv %%ISOFILE

:: Record multi-session using ISOFILE
alias burnm cdrecord -vv -multi %%ISOFILE

:: Record single-session using pipe
alias burnq `mkisofs -v -r -J -graft-points -path-list=pathlist.in 
  -exclude-list=pathlist.out | cdrecord -vv -`

alias c cdrecord %%&

:: Finalize
alias fix cdrecord -fix

:: Inquire
alias inq cdrecord -inq

:: Make ISO image %ISOFILE using pathlist.in and pathlist.out
alias iso mkisofs -v -o %=%ISOFILE -r -J -graft-points -path-list=pathlist.in 
  -exclude-list=pathlist.out `%+` dir %%ISOFILED

:: Scan bus
alias scan `cdrecord -scanbus | more`

:: mount as Z:
alias mnt mntisofs.exe z: %=%ISOFILE

:: Standard shutdown
alias shut `iff exist shut.cmd then %+ *shut %+ else %+ *..\shut %+ endiff`

:: unmount Z:
alias umnt umntiso.exe z:

:: daemon
alias dmn start isofsdmn.exe

echo Check ISOFS daemon.  Start if needed
pstat | grep -i isofsdmn || start isofsdmn.exe

title CDRecord
@echo.
@echo Use al to see alias commands
@echo ISOFILE is %ISOFILE
This is shut.cmd:
@echo off
:: shut - global clean up burn session shutdown
::   assume called by local shut or alias

:: This program is free software licensed under the terms of the GNU
:: General Public License.  The GPL Software License can be found in
:: gnugpl2.txt or at http://www.gnu.org/licenses/licenses.html#GPL

on errormsg pause

setlocal

iff %@ready[z:] = 1 then
  call AskYN Unmount z:
  if %? gt 1 cancel
  if %? = 0 umnt
endiff

iff exist %ISOFILED then
  dir /m %ISOFILED
  echo.
  del /p %ISOFILED
endiff

endlocal

:: Clear aliases
unalias atip
unalias blank
unalias burns
unalias burnm
unalias burnq
unalias c
unalias fix
unalias inq
unalias iso
unalias scan
unalias shut
unalias mnt
unalias umnt
unalias dmn

title CDRecord Shut

This is h.cmd:

@echo off
:: h show help files

:: This program is free software licensed under the terms of the GNU
:: General Public License.  The GPL Software License can be found in
:: gnugpl2.txt or at http://www.gnu.org/licenses/licenses.html#GPL

setlocal
cdd %DIR%\doc\man
start "MkISOFS Help" /c less mkisofs.man
start "CDRecord Help" /c less cdrecord.man

The Local Scripts

This is a very simple local init.cmd:

..\init

This script assumes that the global init.cmd is in the parent directory.

This is a very simple local shut.cmd:

call ..\shut

This is a more complex local init.cmd:

:: init - init for Bootable

on errormsg pause

call ..\init.cmd

set PATH=j:\Util\Bootable;f:\vfdisk;%PATH
set HELP=f:\vfdisk;%HELP

:: Make bootable ISO image %ISOFILE using OSBOOT.IMG pathlist.in and pathlist.out
alias isob mkisofs -v -o %=%ISOFILE -r -J -graft-points -b OSBOOT.IMG -c boot.cat 
  -path-list=pathlist.in -exclude-list=pathlist.out `%+` dir %%ISOFILED

:: Prepare OSBOOT.IMG and CD content
alias bldimg Bootable slamain.cfg MakeCD.cfg

title BootCD

f:\vfdisk\vfctrl U: 2.88
f:\vfdisk\vfctrl U:

if not isdir j:\tmp\00BootCD mkdir j:\tmp\00BootCD

@echo Ready to build bootable CDs

This script adjusts the path variables, defines aliases specific to Hayo Baan's Bootable and mounts the virtual floppy.

This is the corresponding shut.cmd:

on errormsg pause

call ..\shut

unalias isob
unalias bldimg

vfctrl u: eject
vfctrl u:

echo Clean up j:\tmp\00BootCD sometime

title BootCD Shut

The Global Scripts - Annotated

This is an annotated description of the global init.cmd:

set DIR=J:\Util\BurnCDRom;D:\MMedia\CDRecord;D:\MMedia\ISOFS\bin
set PATH=%DIR%;%PATH%

The PATH is updated to include the tool directories.

  • The global scripts are stored in J:\Util\BurnCDRom.
  • cdrecord is installed in D:\MMedia\CDRecord
  • The ISOFS utilities are installed in D:\MMedia\ISOFS\bin
set DIR=d:\MMedia\CDRecord

The DIR variable points to the cdrecord directory. h.cmd uses this variable to find the help files.

set ISOFILE=j:/tmp/tmp.iso
set ISOFILED=j:\tmp\tmp.iso

These variables point to the location of the ISO file. Two definitions are needed to accommodate UNIX and DOS style paths. 4OS2 can be set to allow unix style paths (see the UNIXPATHS setting), but in this case it is easier to define two variables

set CDR_DEVICE=1,4,0
set CDR_SPEED=12
set CDR_FIFOSIZE=16M

These general settings are referenced by several aliases. You will probably need to update CDR_SPEED to match your media and hardware. Use the inq and atip aliases to check the device and media characteristics.

alias atip cdrecord -atip

The atip alias retrieves the media characteristics such as burn speed and manufacturer.

alias blank cdrecord -blank=fast

The blank alias does a quick blank of CD-RW media.

alias burns cdrecord -vv %=%ISOFILE

The burns alias does a single-session burn. -vv requests verbose output. The variable ISOFILE names the ISO image file.

alias burnm cdrecord -vv -multi %%ISOFILE

The burnm alias does a multi-session using ISOFILE. You will need to finalize (i.e. fix) the CD before it can be read by most applications.

alias burnq `mkisofs -v -r -J -graft-points -path-list=pathlist.in 
 -exclude-list=pathlist.out | cdrecord -vv -`

The burnq alias does a single-session burn using a pipe rather than an ISO file. This is more efficient if you know the ISO will be built correctly and you have sufficient CPU power

alias c cdrecord %%&

The c alias is a shorthand for cdrecord.

alias fix cdrecord -fix

The fix alias finalizes a multi-session CD.

alias inq cdrecord -inq

The inq alias queries the CD drive and reports its capabilities.

alias iso mkisofs -v -o %%ISOFILE -r -J -graft-points -path-list=pathlist.in 
 -exclude-list=pathlist.out `%+` dir %%ISOFILED

The iso alias builds an ISO image file. The image file is named by the ISOFILE variable. The alias assumes the existence of two files, pathlist.in and pathlist.out.

Pathlist.in lists the files and directories to be included on the CD. A typical pathlist.in file is:

InCharge/=j:/InCharge
mr2i/mail/Scoug-2001/=j:/mr2i/mail/F095
mr2i/mail/Scoug-2002/=j:/mr2i/mail/F100
SCOUG/=j:/SCOUG

The left hand side is the name of the file or directory on the CD. The right hand side is the name of the file or directory on the hard drive. UNIX style path separators are required.

Pathlist.out lists the files and directories to be excluded. Most of the time this file will be empty, but it must exist.

A typical pathlist.out file is:

  D:/Util/dfsee/SetTop1
  D:/Util/dfsee/TBOX1
  D:/Util/ZTBold/ZTB.LOG
  D:/Util/ZTBold/zkeys.log
alias scan `cdrecord -scanbus | more`

The scanbus alias scans the SCSI bus and lists the devices. This is handy for verifying the CDR-DEVICE setting.

alias mnt mntisofs.exe z: %=%ISOFILE

The mnt alias mounts the ISO file image as drive Z:. This is handy for checking that the ISO image file contains what you expect.

alias shut `iff exist shut.cmd then %+ *shut %+ else %+ *..\shut %+ endiff`

The shut alias locates a copy of shut.cmd and runs it. The alias assumes that the local directory is a subdirectory of the directory where the global scripts are stored.

alias umnt umntiso.exe z:

The mnt alias unmounts the ISO file image from drive z:. It is a good idea to unmount the ISO when building a new image file.

alias dmn start isofsdmn.exe

The dmn alias restarts the ISOFS daemon.

This completes the variable and alias definitions. The rest of the script does common startup processing.

pstat | grep -i isofsdmn || start isofsdmn.exe

The above code checks the state of ISOFS daemon. If it is not running, it is started. Mr. KIA only runs the daemon when building ISO images.

title CDRecord
@echo.
@echo Use al to see alias commands
@echo ISOFILE is %ISOFILE

The above code changes the window title and provides a couple of reminders for the forgetful.

This is an annotated description of the global shut.cmd:

iff %@ready[z:] = 1 then
  call AskYN Unmount z:
  if %? gt 1 cancel
  if %? = 0 umnt
endiff

The above offers to unmount the ISO.

iff exist %ISOFILED then
  dir /m %ISOFILED
  echo.
  del /p %ISOFILED
endiff

The above offers to delete the ISO image file.

unalias atip
unalias blank
unalias burns
unalias burnm
unalias burnq
unalias c
unalias fix
unalias inq
unalias iso
unalias scan
unalias shut
unalias mnt
unalias umnt
unalias dmn

The above releases the aliases.

title CDRecord Shut

The above changes to window title to remind the forgetful that the burn environment has bee shut down.

Using the Tools

To burn a CD-R all we need to do is open a 4OS2 session in the directory containing the local files and:

init
iso
burns
shut
or if your system has sufficient performance:
init
burnq
shut
and you have a ready to use CD. The other aliases only get a lot of use when laying out new CDs or troubleshooting problems.

I suspect this is enough detail for now. If you have questions or suggestions you know where to find me.

Addendum - AskYN.btm

@echo off
:: askyn Ask y/n question

:: This program is free software licensed under the terms of the GNU
:: General Public License.  The GPL Software License can be found in
:: gnugpl2.txt or at http://www.gnu.org/licenses/licenses.html#GPL

setlocal

on break quit 4

iff "%1" == "" then
  inkey /K"ynq[Esc]" `Continue (y/n/q ?) ` %%Z
else
  inkey /K"ynq[Esc]" %& `(y/n/q ?) ` %%Z
endiff

if "%Z" == "y" quit 0
if "%Z" == "n" quit 1
if "%Z" == "q" quit 2
quit 3


Curious or in doubt, you can ask Mr. Know-It-All
OS/2 is his specialty and sharing solutions is his passion
Mr. Know-It-All lives in Southern California.


The Southern California OS/2 User Group
P.O. Box 26904
Santa Ana, CA 92799-6904, USA

Copyright 2004 the Southern California OS/2 User Group. ALL RIGHTS RESERVED.

SCOUG, Warp Expo West, and Warpfest are trademarks of the Southern California OS/2 User Group. OS/2, Workplace Shell, and IBM are registered trademarks of International Business Machines Corporation. All other trademarks remain the property of their respective owners.