@echo off

rem ### “Copyright (9/16/2011) (9/30/2011) Intel Corporation All Rights Reserved.        ##
rem ###                                                                                   ##
rem ### The source code, information and material ("Material") contained herein is        ##
rem ### owned by Intel Corporation or its suppliers or licensors, and title to such       ##
rem ### Material remains with Intel Corporation or its suppliers or licensors. The        ##
rem ### Material contains proprietary information of Intel or its suppliers and           ##
rem ### licensors. The Material is protected by worldwide copyright laws and treaty       ##
rem ### provisions. No part of the Material may be used, copied, reproduced, modified,    ##
rem ### published, uploaded, posted, transmitted, distributed or disclosed in any way     ##
rem ### without Intel's prior express written permission. No license under any patent,    ##
rem ### copyright or other intellectual property rights in the Material is granted to     ##
rem ### or conferred upon you, either expressly, by implication, inducement, estoppel     ##
rem ### or otherwise. Any license under such intellectual property rights must be         ##
rem ### express and approved by Intel in writing.                                         ##

rem ### Unless otherwise agreed by Intel in writing, you may not remove or alter          ##
rem ### this notice or any other notice embedded in Materials by Intel or Intel’s         ##
rem ### suppliers or licensors in any way.”    
  
if not exist %~dp0..\..\..\inc\settings.bat (
 echo Missing %~dp0..\..\..\inc\settings.bat.
 goto end
)

call %~dp0..\..\..\inc\settings.bat
:: Recheck for source files and get vars
call %~dp0vnc_pre.bat

:: Check for temp dir
SET TMP_DIR=%~dp0..\..\..\tmp\
SET MNT_DIR=%~dp0..\..\..\tmp\mount\
if not exist %MNT_DIR% (
 echo Image not mounted
 goto end
)
:: Copy in included code
xcopy /cherky %~dp0..\src\%arch%\*.* %MNT_DIR%
if not %ERRORLEVEL%==0 (
 echo Unable to apply VNC Package.
 goto end
)

:: Add start VNC command to WinPE
echo call vncsvr.cmd >> %MNT_DIR%windows\system32\startnet2.cmd

echo Success
:end