@echo off

rem ********************************************************************************
rem *
rem * ADSJOBS.BAT
rem *
rem * This file copies files and creates the job templates within ADS, if
rem * 1 is passed to the file.
rem *
rem * If 2 is passed to the file then the file removes the toolkit job templates
rem * from an existing ADS installation.
rem *
rem * This batch file is called by the InstallShield program.
rem *
rem ********************************************************************************

if "%1" == "" goto END
if %1 == 1 goto ADDJOBS
if %1 == 2 goto DELJOBS

:ADDJOBS
rem ********************************************************************************
rem * Copy Toolkit files to proper location under Microsoft ADs path
rem ********************************************************************************
copy %TK_INS%\%TK_PT%\ads\images\tk_*.*       "%ADS_PATH%\tftproot\*.*"            > nul
copy %TK_INS%\%TK_PT%\ads\xml\Toolkit_*.*     "%ADS_PATH%\samples\sequences\*.*"   > nul

rem ********************************************************************************
rem * Create ADS jobs
rem ********************************************************************************
call adsjobtemplate /create "IBM Scripting Toolkit Disposal" /description "Disposes of all data on the hard disks of the target server." /sequence "%ADS_PATH%\samples\Sequences\Toolkit_Disposal.xml"

call adsjobtemplate /create "IBM Scripting Toolkit Raid Configuration Disk 1" /description "Configures the RAID on the target server. See the Scripting Toolkit User's Reference for supported adapters." /sequence "%ADS_PATH%\samples\Sequences\Toolkit_RAID.xml"

call adsjobtemplate /create "IBM Scripting Toolkit Updates" /description "Updates BIOS and firmware of the target server." /sequence "%ADS_PATH%\samples\Sequences\Toolkit_Updates.xml"

call adsjobtemplate /create "IBM Scripting Toolkit Raid Configuration Disk 2" /description "Configures the RAID on the target server. See the Scripting Toolkit User's Reference for supported adapters." /sequence "%ADS_PATH%\samples\Sequences\Toolkit_RAID2.xml"

goto END


:DELJOBS
rem ********************************************************************************
rem * Delete Toolkit files from their location under Microsoft ADS path
rem ********************************************************************************
del "%ADS_PATH%\tftproot\tk_*.*"                 > nul
del "%ADS_PATH%\samples\sequences\Toolkit_*.*"   > nul


rem ********************************************************************************
rem * Delete ADS jobs
rem ********************************************************************************
call adsjobtemplate /delete "IBM Scripting Toolkit Disposal"

call adsjobtemplate /delete "IBM Scripting Toolkit Raid Configuration Disk 1"

call adsjobtemplate /delete "IBM Scripting Toolkit Raid Configuration Disk 2"

call adsjobtemplate /delete "IBM Scripting Toolkit Updates"

goto END
    
:END

