Page 1 of 1

ubcd2iso.cmd additions (hiding boot.catalog + add run.bat)

Posted: Thu Aug 14, 2008 12:21 am
by Icecube
Change ubcd2iso.cmd to the following (moves boot.catalog to /isolinux/boot.cat and hides it).
Before you rebuild your iso, remove the boot.catalog file from the root (you only have to do this once).
@echo off

rem * Create a bootable UBCD ISO image
rem *
rem * Ultimate Boot CD (UBCD): http://www.ultimatebootcd.com/
rem * syslinux: http://syslinux.zytor.com/

@echo on
@if "%debug%"=="" echo off

SET a1=%1
SET a1=###%a1%###
SET a1=%a1:"###=%
SET a1=%a1:###"=%
SET a1=%a1:###=%

SET a2=%2
SET a2=###%a2%###
SET a2=%a2:"###=%
SET a2=%a2:###"=%
SET a2=%a2:###=%

if "%a1%"==":" if not "%a2%"=="" goto %a2%
if "%a1%"=="" goto _help
if "%a2%"=="" goto _help

echo UBCD2ISO: Creating bootable UBCD ISO image ...

if not exist "%~p0\mkisofs.exe" %0 : _error Missing file '%~p0\mkisofs.exe'
if not exist "%a1%\isolinux\isolinux.bin" %0 : _error Missing file '%a1%\isolinux\isolinux.bin'

del "%a1%\isolinux\boot.cat"

pushd "%a1%"
"%~p0\mkisofs.exe" -N -J -joliet-long -D -V "UBCD40" -o "%a2%" -b "isolinux/isolinux.bin" -c "isolinux/boot.cat" -hide "isolinux/boot.cat" -no-emul-boot -boot-load-size 4 -boot-info-table .
popd
if errorlevel 0 goto _success
%0 : _error 'mkisofs.exe' failed

:_success
echo UBCD2ISO: Bootable UBCD ISO image has been created
echo.
"%~p0\wait" 3
if not "%3"=="-Y" if not "%3"=="-y" pause
goto _end

:_help
echo.
echo UBCD2ISO: Create bootable UBCD ISO image
echo.
echo Params: -Y : No pause (for batch-mode)
echo.
echo Usage: UBCD2ISO (UBCD-path) (output-image) [params]
echo.
echo Example: UBCD2ISO c:\ubcd c:\ubcd40.iso
echo (UBCD extracted in dir 'c:\ubcd', ISO image written to 'c:\ubcd40.iso')
echo.
echo Required: W2K/XP/W2K3/Vista and UBCD extracted to local storage
echo.
rem * This pause isn't needed anymore if this file is called from run.bat
rem pause

goto _end

:_error
shift
shift
echo.
echo (ERROR) %1 %2 %3 %4 %5 %6 %7 %8
echo.
rem * This pause isn't needed anymore if this file is called from run.bat
rem pause

goto _end

:_end
Add a file run.cmd (also to ubcd2usb)
run.cmd
@echo off

rem * Run ubcd2iso.cmd and afterwards cmd so the user can add the nessecary parameters to the ubcd2iso command

call ubcd2iso.cmd
cmd.exe /c cd "%~p0"
@pause
The user must run now only run.bat (just double click on it). So there should be any problems any more for users to rebuild the iso.

EDIT: corrected run.bat

Posted: Thu Aug 14, 2008 1:16 am
by as702
@echo off

rem * Run ubcd2iso.cmd and afterwards cmd so the user can add the nessecary parameters to the ubcd2iso command

ubcd2iso.cmd
cmd.exe /c cd "%~p0"
change to:
@echo off

rem * Run ubcd2iso.cmd and afterwards cmd so the user can add the nessecary parameters to the ubcd2iso command

call ubcd2iso.cmd
cmd.exe /c cd "%~p0"
@pause

Posted: Thu Aug 14, 2008 1:33 am
by Icecube
Change ubcd2iso.cmd to the following (moves boot.catalog to /isolinux/boot.cat and hides it + add the cmd command inside ubcd2iso.cmd (run.bat isn't needed anymore)).

Before you rebuild your iso, remove the boot.catalog file from the root (you only have to do this once).

The VOLUME ID (label) had the wrong name (still UBCD40). I added an extra variable at the beginning so that it is easier to change it when UBCD501 comes out
@echo off

rem * Create a bootable UBCD ISO image
rem *
rem * Ultimate Boot CD (UBCD): http://www.ultimatebootcd.com/
rem * syslinux: http://syslinux.zytor.com/

@echo on
@if "%debug%"=="" echo off

rem * Set VOLUME ID (label) which will be displayed in explorer when the cd is mounted
SET VOLUME_ID="UBCD500"


SET a1=%1
SET a1=###%a1%###
SET a1=%a1:"###=%
SET a1=%a1:###"=%
SET a1=%a1:###=%

SET a2=%2
SET a2=###%a2%###
SET a2=%a2:"###=%
SET a2=%a2:###"=%
SET a2=%a2:###=%

if "%a1%"==":" if not "%a2%"=="" goto %a2%
if "%a1%"=="" goto _help
if "%a2%"=="" goto _help

echo UBCD2ISO: Creating bootable UBCD ISO image ...

if not exist "%~p0\mkisofs.exe" %0 : _error Missing file '%~p0\mkisofs.exe'
if not exist "%a1%\isolinux\isolinux.bin" %0 : _error Missing file '%a1%\isolinux\isolinux.bin'

del "%a1%\isolinux\boot.cat" > %tmp%\nul

pushd "%a1%"
"%~p0\mkisofs.exe" -N -J -joliet-long -D -V %VOLUME_ID% -o "%a2%" -b "isolinux/isolinux.bin" -c "isolinux/boot.cat" -hide "isolinux/boot.cat" -no-emul-boot -boot-load-size 4 -boot-info-table .
popd
if errorlevel 0 goto _success
%0 : _error 'mkisofs.exe' failed

:_success
echo UBCD2ISO: Bootable UBCD ISO image has been created
echo.
"%~p0\wait" 3
if not "%3"=="-Y" if not "%3"=="-y" pause
goto _end

:_help
echo.
echo UBCD2ISO: Create bootable UBCD ISO image
echo.
echo Params: -Y : No pause (for batch-mode)
echo.
echo Usage: UBCD2ISO (UBCD-path) (output-image) [params]
echo.
echo Example: UBCD2ISO c:\ubcd c:\ubcd40.iso
echo (UBCD extracted in dir 'c:\ubcd', ISO image written to 'c:\ubcd40.iso')
echo.
echo Required: W2K/XP/W2K3/Vista and UBCD extracted to local storage
echo.
rem * This pause isn't needed anymore
rem pause
cmd.exe /c cd "%~p0"
@pause

goto _end

:_error
shift
shift
echo.
echo (ERROR) %1 %2 %3 %4 %5 %6 %7 %8
echo.
rem * This pause isn't needed anymore
rem pause

goto _end

:_end

Posted: Thu Aug 14, 2008 1:37 am
by as702
Even better (works fine in win32).

Posted: Mon Aug 25, 2008 8:03 am
by JMFM
Hi I've changed the ubcd2iso.bat, and changed it's extension to cmd, don't know if that makes any difference.
When I run the file a command opens and the message
"UBCD2ISO: Creating bootable UBCD ISO image ... "
appears many times, and then the command window closes and the file isn't created.
any suggestion??

Posted: Mon Aug 25, 2008 9:47 am
by as702
JMFM wrote:Hi I've changed the ubcd2iso.bat, and changed it's extension to cmd, don't know if that makes any difference.
When I run the file a command opens and the message
"UBCD2ISO: Creating bootable UBCD ISO image ... "
appears many times, and then the command window closes and the file isn't created.
any suggestion??
What OS are you using?

Posted: Wed Aug 27, 2008 2:29 am
by JMFM
I'm using winxp

Posted: Wed Aug 27, 2008 2:34 am
by Icecube
Have you copied the .cmd file to C:\ubcd\tools\ubcd2iso\ ?

Posted: Sat Aug 30, 2008 7:14 am
by Victor Chew
Methinks "run.cmd" should look like this:
@echo off
call ubcd2iso.cmd
cmd.exe /k cd "%~p0"
since the idea is to want the Command Prompt to remain opened after the "cd" command?

The "@pause" doesn't seem to be necessary, since the Command Prompt is sitting there already, so the user can immediately type in the desired command.

The updated "ubcd2iso.cmd" will look like this:
@echo off

rem * Create a bootable UBCD ISO image
rem *
rem * Ultimate Boot CD (UBCD): http://www.ultimatebootcd.com/
rem * syslinux: http://syslinux.zytor.com/

@echo on
@if "%debug%"=="" echo off

...

echo UBCD2ISO: Creating bootable UBCD ISO image ...

if not exist "%~p0\mkisofs.exe" %0 : _error Missing file '%~p0\mkisofs.exe'
if not exist "%a1%\isolinux\isolinux.bin" %0 : _error Missing file '%a1%\isolinux\isolinux.bin'

del "%a1%\isolinux\boot.catalog" 2> NUL

pushd "%a1%"
"%~p0\mkisofs.exe" -N -J -joliet-long -D -V "UBCD40" -o "%a2%" -b "isolinux/isolinux.bin" -c "isolinux/boot.catalog" -hide "isolinux/boot.catalog" -no-emul-boot -boot-load-size 4 -boot-info-table .
popd
if errorlevel 0 goto _success
%0 : _error 'mkisofs.exe' failed

...

:_help
echo.
echo UBCD2ISO: Create bootable UBCD ISO image
echo.
echo Params: -Y : No pause (for batch-mode)
echo.
echo Usage: UBCD2ISO (UBCD-path) (output-image) [params]
echo.
echo Example: UBCD2ISO "c:\ubcd" "c:\ubcd.iso"
echo (UBCD extracted in dir 'c:\ubcd', ISO image written to 'c:\ubcd.iso')
echo.
echo Required: W2K/XP/W2K3/Vista and UBCD extracted to local storage
echo.
goto _end

:_error
shift
shift
echo.
echo (ERROR) %1 %2 %3 %4 %5 %6 %7 %8
echo.
goto _end

:_end
@as702: Correct me if I am wrong. I think your intention is to suppress any error messages from the "del" command? But the error message is printed to stderr, so one needs to use a "2>" instead of the usual ">". Also, a single "NUL" symbol should suffice.

@Icecube: Contrary to my earlier PM to you, I think with this enhancement, we shouldn't need the "Step-by-step guide" anymore, so I have taken it out.

I will also be removing the "-Y" param from both scripts, since I think that is no longer applicable.

Posted: Tue Sep 02, 2008 5:07 am
by Icecube
Victor Chew wrote:Methinks "run.cmd" should look like this:
@echo off
call ubcd2iso.cmd
cmd.exe /k cd "%~p0"
since the idea is to want the Command Prompt to remain opened after the "cd" command?
I found on the web that you could use /c or /k (/c looks nicer to me, but it was probably wrong). I don't have windows installed myself, so I couldn't test it myself.

Wouldn't it be better to include the line

Code: Select all

cmd.exe [b]/k[/b] cd "%~p0"
into ubcd2iso.cmd itself (see my post above)?
Victor Chew wrote: The "@pause" doesn't seem to be necessary, since the Command Prompt is sitting there already, so the user can immediately type in the desired command.
I didn't include it originally because I thought that it wasn't nessary but as702 tested it and says that it didn't work correctly without it. Probalby because the /c command was wrong!?
Victor Chew wrote:@as702: Correct me if I am wrong. I think your intention is to suppress any error messages from the "del" command? But the error message is printed to stderr, so one needs to use a "2>" instead of the usual ">". Also, a single "NUL" symbol should suffice.
I chose ">" instead of "2>" because I didn't want to show the user that the isolinux/boot.cat file will be deleted (not very interesting to display and it maybe can frighten users when they see that the script deletes files without there permission). as702 told me that redirecting the output to NUL doesn't work if the current directory is readonly, at least in dos this is the case. Redirecting to %tmp%/NULL will always work.
Victor Chew wrote:@Icecube: Contrary to my earlier PM to you, I think with this enhancement, we shouldn't need the "Step-by-step guide" anymore, so I have taken it out.

I will also be removing the "-Y" param from both scripts, since I think that is no longer applicable.
This is good thing.

I didn't download the new UBCD5 beta but have you included the SET VOLUME_ID="UBCD500" in the script, so that you only have to edit this line to change the label of the CD instead of changing it in the mkisofs command?

Posted: Tue Sep 02, 2008 2:36 pm
by Icecube
@echo off
rem * Create a bootable UBCD ISO image
rem *
rem * Ultimate Boot CD (UBCD): http://www.ultimatebootcd.com/
rem * syslinux: http://syslinux.zytor.com/

@echo on
@if "%debug%"=="" echo off

SET VOLUME_ID="UBCD50B5"

SET a1=%1
SET a1=###%a1%###
SET a1=%a1:"###=%
SET a1=%a1:###"=%
SET a1=%a1:###=%

SET a2=%2
SET a2=###%a2%###
SET a2=%a2:"###=%
SET a2=%a2:###"=%
SET a2=%a2:###=%

if "%a1%"==":" if not "%a2%"=="" goto %a2%
if "%a1%"=="" goto _help
if "%a2%"=="" goto _help

echo UBCD2ISO: Creating bootable UBCD ISO image ...

if not exist "%~p0\mkisofs.exe" %0 : _error Missing file '%~p0\mkisofs.exe'

if not exist "%a1%\isolinux\isolinux.bin" %0 : _error Missing file '%a1%\isolinux\isolinux.bin'

del "%a1%\isolinux\boot.catalog" > NUL

pushd "%a1%"

"%~p0\mkisofs.exe" -N -J -joliet-long -D -V %VOLUME_ID% -o "%a2%" -b "isolinux/isolinux.bin" -c "isolinux/boot.catalog" -hide "isolinux/boot.catalog" -no-emul-boot -boot-load-size 4 -boot-info-table .

popd

if errorlevel 0 goto _success
%0 : _error 'mkisofs.exe' failed

:_success
echo UBCD2ISO: Bootable UBCD ISO image has been created
echo.
rem * The following isn't needed, I think. You can also use pause > NUL
rem "%~p0\wait" 3

goto _end

:_help
echo.
echo UBCD2ISO: Create bootable UBCD ISO image
echo.
echo Usage: UBCD2ISO (UBCD-path) (output-image) [params]
echo.
echo Example: UBCD2ISO "c:\ubcd" "c:\ubcd.iso"
echo (UBCD extracted in dir 'c:\ubcd', ISO image written to 'c:\ubcd.iso')
echo.
echo Required: W2K/XP/W2K3/Vista and UBCD extracted to local storage
echo.
cmd.exe /k cd "%~p0"
goto _end

:_error
shift
shift
echo.
echo (ERROR) %1 %2 %3 %4 %5 %6 %7 %8
echo.
goto _end

:_end
If you really want a run.cmd:
@echo off
call ubcd2iso.cmd ../../../ ubcd50b5-custom.iso
This let you preserve the original ubcd50b5.iso, so in case that you ruined the extracted folder, you still have the original iso to start over again.

Posted: Tue Sep 02, 2008 3:32 pm
by as702

Code: Select all

@echo off
call ubcd2iso.cmd ../../../ ubcd50b5-custom.iso
I'm not to keen on this. NwDsk still requires a valid volume ID when using UBCD4.1.1 (it's purely cosmetic for UBCD5.0b5, thus, a non-issue). It would be best to set the volume ID as a constant, one which is designated according to distribution (e.g. UBCD411 or UBCD50b5). In principle, the more variables you introduce only makes it that much harder to develop for later down the line (potentially at least).

Why not simply create a new folder and place the remastered ISO in there? You could also retrieve a valid volume ID (??) and/or allow users to input a choice on runtime...

Select ISO to build:
1. UBCD4.1.1
2. UBCD5.0b5

meh...

Posted: Wed Sep 03, 2008 3:14 am
by Victor Chew
I chose ">" instead of "2>" because I didn't want to show the user that the isolinux/boot.cat file will be deleted
When deleting a single file, no message will be displayed, so we are safe. The 2> will get rid of any "File not found" error message.
I didn't download the new UBCD5 beta but have you included the SET VOLUME_ID="UBCD500"
Ah, one of those things I missed. I have added it to the script now. Also added the same thing to ubcd2usb.

I have also removed the wait and added "cmd.exe /k cd "%~p0", so run.cmd has been removed.
If you really want a run.cmd:
If we create an ISO file within the UBCD folder, it is quite likely that the user run ubcd2iso again without deleting the ISO file, hence the newly created ISO file will include the previous ISO file (if it works at all).