OK, I revised the vbscript and will get the BASH script written later tonight
Code:
' ***************************************************************************************
' updateDosUBCD.vbs
'
' PURPOSE:
' This script extracts an UBCD ISO, updates dosubcd.igz, and creates an updated ISO file
'
' REQUIREMENTS:
' This script requires that 7-Zip is installed, a new dosubcd.igz file, and an UBCD ISO.
'
' NOTES:
' It is recommended to use the default variables, but you can customize their paths under the custom
' variables section. Please see that section for the default values. This script has been tested and will
' work with UBCD 4.x and 5.x
' ***************************************************************************************
' Force Explicit Variable Declaration and Ignore All Errors
Option Explicit
On Error Resume Next
' User Script Variables - Set to Customize Script
' ***************************************************************************************
' Custom Variable Paths to Override the Default Paths
Dim path7Zip: path7Zip = "" '(Default = %PROGRAMFILES%\7-Zip\7z.exe)
Dim pathIMG: pathIMG = "" '(Default = Same Directory as this Script)
Dim pathISO: pathISO = "" '(Default = Same Directory as this Script)
Dim pathMKISOFS: pathMKISOFS = "" '(Default = Uses mkisofs.exe from the UBCD ISO)
' User Defined Variables THESE MUST BE SET
Dim nameIMG: nameIMG = "dosubcd_r128.zip" '(Name of the dosubcd zip file)
Dim nameISO: nameISO = "ubcd411.iso" '(Name of UBCD ISO)
Dim repIMGExtract: repIMGExtract = True '(Replace dosubcd.igz when extracting dosubcd_<version>.zip)
Dim repISOExtract: repISOExtract = True '(Replace dosubcd.igz when extracting dosubcd_<version>.zip)
' Default Variables - Do Not Modify This Section
' ***************************************************************************************
' Create Objects & Variables
Dim objShell: Set objShell = WScript.CreateObject("WScript.Shell")
Dim objFSO: Set objFSO = CreateObject("Scripting.FileSystemObject")
Dim verISO
' Get Path to Current Script
Dim scriptPath: scriptPath = Left(WScript.ScriptFullName,InstrRev(WScript.ScriptFullName,"\"))
' Set Path to 7-Zip
If Not objFSO.FileExists(path7Zip) Then
path7Zip = objShell.ExpandEnvironmentStrings("%PROGRAMFILES%\7-Zip\7z.exe")
If Not objFSO.FileExists(path7Zip) Then
Wscript.Echo "!~ERROR~! 7-Zip Couldn't Be located in the Location:" & vbCrLf & _
path7Zip & vbCrLf & _
"Quitting Script!"
Wscript.Quit
End If
End If
' Set Path to dosubcd_<version>.zip
If objFSO.FolderExists(pathIMG) Then
If Right(pathIMG, 1) <> "\" Then pathIMG = pathIMG & "\"
Else
pathIMG = scriptPath
If Right(pathIMG, 1) <> "\" Then pathIMG = pathIMG & "\"
End If
If Not objFSO.FileExists(pathIMG & nameIMG) Then
Wscript.Echo "!~ERROR~! dosubcd_<version>.zip Couldn't Be located in the Location:" & vbCrLf & _
pathIMG & nameIMG & vbCrLf & _
"Quitting Script!"
Wscript.Quit
End If
' Set Path to UBCD ISO
If objFSO.FolderExists(pathISO) Then
If Right(pathISO, 1) <> "\" Then pathISO = pathISO & "\"
Else
pathISO = scriptPath
If Right(pathISO, 1) <> "\" Then pathISO = pathISO & "\"
End If
If Not objFSO.FileExists(pathISO & nameISO) Then
Wscript.Echo "!~ERROR~! UBCD ISO Couldn't Be located in the Location:" & vbCrLf & _
pathISO & nameISO & vbCrLf & _
"Quitting Script!"
Wscript.Quit
End If
' Get UBCD ISO Version and Append It
verISO = Replace(nameISO, ".iso", "")
verISO = Replace(verISO, "ubcd", "") & "1"
' Path to Extract UBCD ISO
Dim pathUBCDExtract: pathUBCDExtract = scriptPath & "ubcd-extract\"
If Right(pathUBCDExtract, 1) <> "\" Then pathUBCDExtract = pathUBCDExtract & "\"
' Process Files - Do Not Modify This Section
' ***************************************************************************************
' Extract dosubcd_<version>.zip
If repIMGExtract = True Then
objShell.Run chr(34) & path7Zip & chr(34) & " x -y -o" & chr(34) & pathIMG & chr(34) & " " & chr(34) & pathIMG & nameIMG & chr(34), 1, TRUE
Else
objShell.Run chr(34) & path7Zip & chr(34) & " x -o" & chr(34) & pathIMG & chr(34) & " " & chr(34) & pathIMG & nameIMG & chr(34), 1, TRUE
End If
' Extract UBCD ISO
If repISOExtract = True Then
objShell.Run chr(34) & path7Zip & chr(34) & " x -y -o" & chr(34) & pathUBCDExtract & chr(34) & " " & chr(34) & pathISO & nameISO & chr(34), 1, TRUE
Else
objShell.Run chr(34) & path7Zip & chr(34) & " x -o" & chr(34) & pathUBCDExtract & chr(34) & " " & chr(34) & pathISO & nameISO & chr(34), 1, TRUE
End If
' Update dosubcd.igz (Compatible with versions 4.x and 5.x)
If objFSO.FolderExists(pathUBCDExtract & "images") Then
' UBCD 4.x Detected
' Copy File
objFSO.CopyFile pathIMG & nameIMG, pathUBCDExtract & "images\dosubcd.igz", True
' Set Path MKISOFS
If Not objFSO.FileExists(pathMKISOFS) Then
' Use Default From Extracted ISO
pathMKISOFS = pathUBCDExtract & "tools\ubcd2iso\mkisofs.exe"
If Not objFSO.FileExists(pathMKISOFS) Then
Wscript.Echo "!~ERROR~! - Couldn't find mkisofs.exe in:" & vbCrLf & _
pathMKISOFS & vbCrLf & _
"Quitting Script!"
Wscript.Quit
End If
End If
Elseif objFSO.FolderExists(pathUBCDExtract & "ubcd\images") Then
' UBCD 5.x Detected
' Copy File
objFSO.CopyFile pathIMG & nameIMG, pathUBCDExtract & "ubcd\images\dosubcd.igz", True
' Set Path MKISOFS
If Not objFSO.FileExists(pathMKISOFS) Then
' Use Default From Extracted ISO
pathMKISOFS = pathUBCDExtract & "ubcd\tools\ubcd2iso\mkisofs.exe"
If Not objFSO.FileExists(pathMKISOFS) Then
Wscript.Echo "!~ERROR~! - Couldn't find mkisofs.exe in:" & vbCrLf & _
pathMKISOFS & vbCrLf & _
"Quitting Script!"
Wscript.Quit
End If
End If
Else
Wscript.Echo "!~ERROR~! - Couldn't Find Extracted UBCD 4.x Or 5.x Files in:" & vbCrLf & _
pathUBCDExtract & "images" & vbCrLf & _
"OR" & vbCrLf & _
pathUBCDExtract & "ubcd\images" & vbCrLf & _
"Quitting Script!"
Wscript.Quit
End If
' Create ISO
If objFile.Exists(scriptPath & "UBCD.iso") Then
objFSO.DeleteFile(scriptPath & "UBCD.iso"), True
End If
Wscript.Sleep(3000)
objShell.Run chr(34) & pathMKISOFS & chr(34) & " -N -J -joliet-long -D -V " & chr(34) & "UBCD" & verISO & chr(34) & " -o " & chr(34) & Replace(scriptPath,"\","/") & "UBCD.iso" & chr(34) & " -b " & chr(34) & "isolinux/isolinux.bin" & chr(34) & " -no-emul-boot -boot-load-size 4 -boot-info-table " & chr(34) & Replace(pathUBCDExtract,"\","/") & chr(34), 1, True
' Cleanup Objects and Finish
' ***************************************************************************************
Set objShell = nothing
Set objFSO = nothing
Wscript.Echo "Finished"