@echo off
rem ******************************************************************
rem *   Filename: install.bat
rem *    Version: 1.2
rem *     Author: Ben Burnett <burnett@cs.wisc.edu>
rem *    Purpose: Condor Image install script
rem *    History: 
rem * 2007-07-13: File Created (UW-Madison).
rem * 2007-09-12: Can now optionally supply a drive letter where 
rem *             Condor will be installed (should have it 
rem *             auto-magically fix condor_config too-- D: is
rem *             supported, however)
rem * 2007-10-19: Stoped the installer from starting the service,
rem *             because it will be done in the configuration script.
rem ******************************************************************

rem Make all environment changes local to this file
setlocal

rem Figure out where we are installing to... if it's not C: you'll
rem have to edit condor_config to reflect the new drive name.
set DRIVE_DST=%SystemDrive%
if not A%1==A (
    set DRIVE_DST=%1
    shift
)

rem Change this to where Condor was installed (this MUST already exist)
set CONDOR_INSTALL_DIR=%DRIVE_DST%\condor

rem Create registry keys
reg add "HKLM\SOFTWARE\Condor" /f
reg add "HKLM\SOFTWARE\Condor" /v "CONDOR_CONFIG" /t REG_SZ /d "%CONDOR_INSTALL_DIR%\condor_config" /f

rem Set registry permissions
"%CONDOR_INSTALL_DIR%\set_perms.exe"

rem Set proper file system permissions
"%CONDOR_INSTALL_DIR%\condor_set_acls.exe" "%CONDOR_INSTALL_DIR%"

rem Register service
sc create condor binPath= "%CONDOR_INSTALL_DIR%\bin\condor_master.exe" start= auto

rem NOTE: We don't start Condor service here because we will be adding custom
rem configuration files in the second stage of the install and we can just
rem start the serice at that point.

rem Remind the user to change condor_config
if not %DRIVE_DST% equ %SystemDrive% (
    rem we do support D: installs
    if not %DRIVE_DST% equ D: (
        echo ************** IMPORTANT **********************
        echo ***********************************************
        echo Remember to change condor_condig to point to %DEST_DRIVE%
        echo ***********************************************
        echo ***********************************************
    )
)


rem End local environment changes
:finish
endlocal

rem ******************************************************************
rem * EOF
rem ******************************************************************
