@echo off

setlocal

set PATH=%PATH%;%CD%\tools

call:install rmarkdown master
call:install packrat master
call:install shinyapps master

GOTO:EOF

:install

set PACKAGE=%1
set PACKAGE_VERSION=%2

REM git clone if necessary
set PACKAGE_DIR="%PACKAGE%"
if not exist "%PACKAGE_DIR%" (
   git clone "https://github.com/rstudio/%PACKAGE%.git"
)

REM clean and checkout target branch
pushd "%PACKAGE_DIR%"
git checkout .
git clean -df .
git pull
git checkout "%PACKAGE_VERSION%"

REM append GitHub fields to DESCRIPTION
git rev-parse "%PACKAGE_VERSION%" > PACKAGE_SHA1
set /p PACKAGE_SHA1= < PACKAGE_SHA1
del PACKAGE_SHA1
echo GithubRepo: %PACKAGE% >> DESCRIPTION
echo GithubUsername: rstudio >> DESCRIPTION
echo GithubRef: %PACKAGE_VERSION% >> DESCRIPTION
echo GithubSHA1: %PACKAGE_SHA1% >> DESCRIPTION
echo Origin: RStudioIDE >> DESCRIPTION

REM create source package
popd
set PACKAGE_ARCHIVE_PATTERN="%PACKAGE%*.tar.gz"
del /s /q %PACKAGE_ARCHIVE_PATTERN%
R CMD build "%PACKAGE%"

REM modify filename to include SHA1
for %%f in (%PACKAGE_ARCHIVE_PATTERN%) do set PACKAGE_ARCHIVE=%%f
set PACKAGE_ARCHIVE_STEM=%PACKAGE_ARCHIVE:~0,-7%
set PACKAGE_ARCHIVE_SHA1=%PACKAGE_ARCHIVE_STEM%_%PACKAGE_SHA1%.tar.gz
move %PACKAGE_ARCHIVE% %PACKAGE_ARCHIVE_SHA1%

GOTO:EOF

@echo off

setlocal

set PATH=%PATH%;%CD%\tools

call:install rmarkdown master
call:install packrat master
call:install rsconnect master

GOTO:EOF

:install

set PACKAGE=%1
set PACKAGE_VERSION=%2

REM git clone if necessary
set PACKAGE_DIR="%PACKAGE%"
if not exist "%PACKAGE_DIR%" (
   git clone "https://github.com/rstudio/%PACKAGE%.git"
)

REM clean and checkout target branch
pushd "%PACKAGE_DIR%"
git checkout .
git clean -df .
git pull
git checkout "%PACKAGE_VERSION%"

REM append GitHub fields to DESCRIPTION
git rev-parse "%PACKAGE_VERSION%" > PACKAGE_SHA1
set /p PACKAGE_SHA1= < PACKAGE_SHA1
del PACKAGE_SHA1
echo GithubRepo: %PACKAGE% >> DESCRIPTION
echo GithubUsername: rstudio >> DESCRIPTION
echo GithubRef: %PACKAGE_VERSION% >> DESCRIPTION
echo GithubSHA1: %PACKAGE_SHA1% >> DESCRIPTION
echo Origin: RStudioIDE >> DESCRIPTION

REM create source package
popd
set PACKAGE_ARCHIVE_PATTERN="%PACKAGE%*.tar.gz"
del /s /q %PACKAGE_ARCHIVE_PATTERN%
R CMD build "%PACKAGE%"

REM modify filename to include SHA1
for %%f in (%PACKAGE_ARCHIVE_PATTERN%) do set PACKAGE_ARCHIVE=%%f
set PACKAGE_ARCHIVE_STEM=%PACKAGE_ARCHIVE:~0,-7%
set PACKAGE_ARCHIVE_SHA1=%PACKAGE_ARCHIVE_STEM%_%PACKAGE_SHA1%.tar.gz
move %PACKAGE_ARCHIVE% %PACKAGE_ARCHIVE_SHA1%

GOTO:EOF

install rsconnect rather than shinyapps on windows


set PATH=C:\Go\bin;%PATH%

set GOPATH=%CD%\gopath;%CD%\concourse;%CD%\gopath\src\github.com\vito\houdini\deps
set PATH=%CD%\gopath\bin;%PATH%

set /p FinalVersion=<final-version\version

go get github.com/jteeuwen/go-bindata

go build -o go-bindata.exe github.com/jteeuwen/go-bindata/go-bindata

.\go-bindata.exe -pkg bindata -o gopath\src\github.com\concourse\bin\bindata\bindata.go cli-artifacts/...

go build -ldflags "-X main.Version=%FinalVersion% -X github.com/concourse/atc/atccmd.Version=%FinalVersion%" -o .\binary\concourse_windows_amd64.exe github.com/concourse/bin/cmd/concourse

add Go to PATH on Windows

add Go to PATH on Windows


REM This script installs R-devel from source on Windows.
REM Update the variables up here as new versions of R are released;
REM we attempt to build from tarballs.
REM
REM This script assumes you have 'wget' on your path, as it
REM is used to download. You can find a binary here:
REM
REM     https://eternallybored.org/misc/wget/wget64.exe
REM
REM Ensure that this is run from a command prompt with administrator
REM privileges! Otherwise, files can be created _without_ read permissions
REM and all manner of weird failures can and will happen.
REM
REM If you find that the build is failing for strange reason, ensure that
REM everyone has access to the source tree with
REM
REM     icacls "." /grant Everyone:(F) /T
REM
REM to just indiscriminately give everyone full access to the folder.

REM ---------------------------------
REM - BEGIN CONFIGURATION VARIABLES -
REM ---------------------------------

IF NOT DEFINED WGET (
	SET "WGET=wget"
)

IF NOT DEFINED SVN (
	SET "SVN=svn"
)

IF NOT DEFINED ROOT_DIR (
	SET "ROOT_DIR=C:\R-src"
)

if NOT DEFINED RTOOLS_DIR (
	SET "RTOOLS_DIR=C:\Rtools"
)

IF NOT DEFINED RTOOLS_BIN_DIR (
	SET "RTOOLS_BIN_DIR=C:\Rtools\bin"
)

IF NOT DEFINED TMPDIR (
	SET "TMPDIR=C:\tmp"
)

REM -------------------------------
REM - END CONFIGURATION VARIABLES -
REM -------------------------------

SET "CRAN=http://cran.r-project.org"
SET "RTOOLS_VERSION=33"
SET "R_HOME=%ROOT_DIR%\trunk"

REM Ensure that some essential tools are on the PATH.
WHERE /Q %WGET% || (
	ECHO 'wget' not found on PATH; exiting
	exit /b
)

where /Q %SVN% || (
	ECHO 'svn' not found on PATH; exiting
	exit /b
)

REM Set the current directory.
if not exist "%ROOT_DIR%" (
	mkdir "%ROOT_DIR%"
)
cd "%ROOT_DIR%"
SET OLDPATH=%PATH%

REM URI to RTools.exe
SET "RTOOLS_URL=%CRAN%/bin/windows/Rtools/Rtools%RTOOLS_VERSION%.exe"

REM URI to updated toolchains.
REM TODO Remove this once Rtools stabilized.
SET "TOOLCHAIN_BASE=http://www.stats.uwo.ca/faculty/murdoch/temp"
SET "TOOLCHAIN_32BIT=%TOOLCHAIN_BASE%/mingw32mingw32_gcc-4.9.2.toolchain.tar.gz"
SET "TOOLCHAIN_64BIT=%TOOLCHAIN_BASE%/mingw32mingw64_gcc-4.9.2.toolchain.tar.gz"

REM Download Rtools, and the updated toolchains.
REM TODO: Downloading the upgraded toolchains will not be necessary
REM once RTOOLS has been fully stabilized.
wget -c %RTOOLS_URL%
wget -c %TOOLCHAIN_32BIT%
wget -c %TOOLCHAIN_64BIT%

REM Install Rtools.
SET "RTOOLS_INSTALLER=.\Rtools%RTOOLS_VERSION%.exe"
"%RTOOLS_INSTALLER%" /VERYSILENT

REM Put Rtools on the path.
SET "PATH=%RTOOLS_BIN_DIR%;%PATH%"

REM Overwrite the toolchain paths with our own.
rmdir /S /Q %RTOOLS_DIR%\gcc492_32
rmdir /S /Q %RTOOLS_DIR%\gcc492_64

REM Untar the downloaded toolchains and move them.
tar -zxvf mingw32mingw32_gcc-4.9.2.toolchain.tar.gz
move mingw32 %RTOOLS_DIR%\gcc492_32

tar -zxvf mingw32mingw64_gcc-4.9.2.toolchain.tar.gz
move mingw64 %RTOOLS_DIR%\gcc492_64

REM Download the R sources. Get the latest R-devel sources using SVN.
REM
REM If you need a Windows SVN client, you can download SlikSVN here:
REM
REM     https://sliksvn.com/download/
REM
REM Be sure to place the installed binary directory on your PATH.
svn checkout https://svn.r-project.org/R/trunk/
cd trunk

REM Copy in the 'extras' for a 64bit build. This includes tcltk
REM plus some other libraries. Note that the R64 directory should
REM have been populated by the RTools installation.
xcopy /E /Y C:\R64 %R_HOME%\trunk\

REM Ensure the temporary directory exists.
if not exist "%TMPDIR%" (
	mkdir "%TMPDIR%"
)

REM Create the binary directories that will eventually
REM be populated ourselves, rather than letting the
REM bundled cygwin toolkit do it. The RTools 'mkdir'
REM apparently can build directories without read
REM permissions, which will cause any attempt to link
REM to DLLs within those folders to fail.
rmdir /S /Q bin
mkdir bin\i386
mkdir bin\x64

REM Move into the root directory for 'Windows' builds.
cd src\gnuwin32

REM Since we're building from source, we need to get Recommended packages.
make rsync-recommended

REM Download external software -- libpng, libgsl, and so on.
make rsync-extsoft

REM Look at MkRules.dist and if settings need to be altered, copy it to
REM MkRules.local and edit the settings there.
if exist MkRules.local (
	rm MkRules.local
)
cp MkRules.dist MkRules.local

REM Don't use MIKTEX.
sed -i 's/^MIKTEX = TRUE//g' MkRules.local

REM Ensure that the make rules are properly set -- need to
REM point to 'extsoft'.
sed -i 's/^# LOCAL_SOFT/LOCAL_SOFT/g' MkRules.local
sed -i 's/^# EXT_LIBS/EXT_LIBS/g' MkRules.local

REM Attempt to fix up permissions before the build.
cacls %RTOOLS_DIR% /T /E /G BUILTIN\Users:R > NUL
cacls %R_HOME% /T /E /G BUILTIN\Users:R > NUL
cacls %TMDIR% /T /E /G BUILTIN\Users:R > NUL

REM Make it!
REM For this part, we ensure only Rtools is on the PATH. This
REM is important as if the wrong command line utilites are picked
REM up things can fail for strange reason. In particular, we
REM _must_ use the Rtools 'sort', _not_ the Windows 'sort', or
REM else we will get strange errors from 'comm' when attempting
REM to compare sorted files. Probably just placing Rtools first
REM on the PATH is sufficient, but this is fine too.
SET "PATH=C:\Rtools\bin"
make clean

REM We need to build all of the R library DLLs first, and then
REM copy them to locations where R will find them. Not sure why
REM this step is necessary.
make rlibs
cp ..\extra\graphapp\Rgraphapp.dll Rgraphapp.dll
cp ..\extra\win_iconv\Riconv.dll Riconv.dll

REM Now we should be able to build R + recommended packages.
make all recommended

REM Clean up.
SET "PATH=%OLDPATH%"

REM This script installs R-devel from source on Windows.
REM Update the variables up here as new versions of R are released;
REM we attempt to build from tarballs.
REM
REM This script assumes you have 'wget' on your path, as it
REM is used to download. You can find a binary here:
REM
REM     https://eternallybored.org/misc/wget/wget64.exe
REM
REM Ensure that this is run from a command prompt with administrator
REM privileges! Otherwise, files can be created _without_ read permissions
REM and all manner of weird failures can and will happen.
REM
REM If you find that the build is failing for strange reason, ensure that
REM everyone has access to the source tree with
REM
REM     icacls "." /grant Everyone:(F) /T
REM
REM to just indiscriminately give everyone full access to the folder.

REM ---------------------------------
REM - BEGIN CONFIGURATION VARIABLES -
REM ---------------------------------

IF NOT DEFINED WGET (
	SET "WGET=wget"
)

IF NOT DEFINED SVN (
	SET "SVN=svn"
)

IF NOT DEFINED ROOT_DIR (
	SET "ROOT_DIR=C:\R-src"
)

if NOT DEFINED RTOOLS_DIR (
	SET "RTOOLS_DIR=C:\Rtools"
)

IF NOT DEFINED RTOOLS_BIN_DIR (
	SET "RTOOLS_BIN_DIR=C:\Rtools\bin"
)

IF NOT DEFINED TMPDIR (
	SET "TMPDIR=C:\tmp"
)

REM -------------------------------
REM - END CONFIGURATION VARIABLES -
REM -------------------------------

SET "CRAN=http://cran.r-project.org"
SET "RTOOLS_VERSION=33"
SET "R_HOME=%ROOT_DIR%\trunk"

REM Ensure that some essential tools are on the PATH.
WHERE /Q %WGET% || (
	ECHO 'wget' not found on PATH; exiting
	exit /b
)

where /Q %SVN% || (
	ECHO 'svn' not found on PATH; exiting
	exit /b
)

REM Set the current directory.
if not exist "%ROOT_DIR%" (
	mkdir "%ROOT_DIR%"
)
cd "%ROOT_DIR%"
SET OLDPATH=%PATH%

REM URI to RTools.exe
SET "RTOOLS_URL=%CRAN%/bin/windows/Rtools/Rtools%RTOOLS_VERSION%.exe"

REM URI to updated toolchains.
REM TODO Remove this once Rtools stabilized.
SET "TOOLCHAIN_BASE=http://www.stats.uwo.ca/faculty/murdoch/temp"
SET "TOOLCHAIN_32BIT=%TOOLCHAIN_BASE%/mingw32mingw32_gcc-4.9.2.toolchain.tar.gz"
SET "TOOLCHAIN_64BIT=%TOOLCHAIN_BASE%/mingw32mingw64_gcc-4.9.2.toolchain.tar.gz"

REM Download Rtools, and the updated toolchains.
REM TODO: Downloading the upgraded toolchains will not be necessary
REM once RTOOLS has been fully stabilized.
wget -c %RTOOLS_URL%
wget -c %TOOLCHAIN_32BIT%
wget -c %TOOLCHAIN_64BIT%

REM Install Rtools.
SET "RTOOLS_INSTALLER=.\Rtools%RTOOLS_VERSION%.exe"
"%RTOOLS_INSTALLER%" /VERYSILENT

REM Put Rtools on the path.
SET "PATH=%RTOOLS_BIN_DIR%;%PATH%"

REM Overwrite the toolchain paths with our own.
rmdir /S /Q %RTOOLS_DIR%\gcc492_32
rmdir /S /Q %RTOOLS_DIR%\gcc492_64

REM Untar the downloaded toolchains and move them.
tar -zxvf mingw32mingw32_gcc-4.9.2.toolchain.tar.gz
move mingw32 %RTOOLS_DIR%\gcc492_32

tar -zxvf mingw32mingw64_gcc-4.9.2.toolchain.tar.gz
move mingw64 %RTOOLS_DIR%\gcc492_64

REM Download the R sources. Get the latest R-devel sources using SVN.
REM
REM If you need a Windows SVN client, you can download SlikSVN here:
REM
REM     https://sliksvn.com/download/
REM
REM Be sure to place the installed binary directory on your PATH.
svn checkout https://svn.r-project.org/R/trunk/
cd trunk

REM Copy in the 'extras' for a 64bit build. This includes tcltk
REM plus some other libraries. Note that the R64 directory should
REM have been populated by the RTools installation.
xcopy /E /Y C:\R %R_HOME%\trunk\
xcopy /E /Y C:\R64 %R_HOME%\trunk\

REM Ensure the temporary directory exists.
if not exist "%TMPDIR%" (
	mkdir "%TMPDIR%"
)

REM Create the binary directories that will eventually
REM be populated ourselves, rather than letting the
REM bundled cygwin toolkit do it. The RTools 'mkdir'
REM apparently can build directories without read
REM permissions, which will cause any attempt to link
REM to DLLs within those folders to fail.
rmdir /S /Q bin
mkdir bin\i386
mkdir bin\x64

REM Move into the root directory for 'Windows' builds.
cd src\gnuwin32

REM Since we're building from source, we need to get Recommended packages.
make rsync-recommended

REM Download external software -- libpng, libgsl, and so on.
make rsync-extsoft

REM Look at MkRules.dist and if settings need to be altered, copy it to
REM MkRules.local and edit the settings there.
if exist MkRules.local (
	rm MkRules.local
)
cp MkRules.dist MkRules.local

REM Don't use MIKTEX.
sed -i 's/^MIKTEX = TRUE//g' MkRules.local

REM Ensure that the make rules are properly set -- need to
REM point to 'extsoft'.
sed -i 's/^# LOCAL_SOFT/LOCAL_SOFT/g' MkRules.local
sed -i 's/^# EXT_LIBS/EXT_LIBS/g' MkRules.local

REM Attempt to fix up permissions before the build.
cacls %RTOOLS_DIR% /T /E /G BUILTIN\Users:R > NUL
cacls %R_HOME% /T /E /G BUILTIN\Users:R > NUL
cacls %TMDIR% /T /E /G BUILTIN\Users:R > NUL

REM Make it!
REM For this part, we ensure only Rtools is on the PATH. This
REM is important as if the wrong command line utilites are picked
REM up things can fail for strange reason. In particular, we
REM _must_ use the Rtools 'sort', _not_ the Windows 'sort', or
REM else we will get strange errors from 'comm' when attempting
REM to compare sorted files. Probably just placing Rtools first
REM on the PATH is sufficient, but this is fine too.
SET "PATH=C:\Rtools\bin"
make clean

REM We need to build all of the R library DLLs first, and then
REM copy them to locations where R will find them. Not sure why
REM this step is necessary.
make rlibs
cp ..\extra\graphapp\Rgraphapp.dll Rgraphapp.dll
cp ..\extra\win_iconv\Riconv.dll Riconv.dll

REM Now we should be able to build R + recommended packages.
make all recommended

REM Clean up.
SET "PATH=%OLDPATH%"

copy in Tcl libraries (TODO: split for 32bit, 64bit build)


@ECHO OFF
setlocal
SET ALLYPATH=..\
SET ALLYCOM=%ALLYPATH%components\
set PYTHONPATH=%ALLYCOM%ally-api
set PYTHONPATH=%PYTHONPATH%;%ALLYCOM%ally-authentication
set PYTHONPATH=%PYTHONPATH%;%ALLYCOM%ally-authentication-core
set PYTHONPATH=%PYTHONPATH%;%ALLYCOM%ally-authentication-http
set PYTHONPATH=%PYTHONPATH%;%ALLYCOM%ally-core
set PYTHONPATH=%PYTHONPATH%;%ALLYCOM%ally-core-http
set PYTHONPATH=%PYTHONPATH%;%ALLYCOM%ally-core-plugin
set PYTHONPATH=%PYTHONPATH%;%ALLYCOM%ally-core-sqlalchemy
set PYTHONPATH=%PYTHONPATH%;%ALLYCOM%ally-http-asyncore-server
set PYTHONPATH=%PYTHONPATH%;%ALLYCOM%ally-http-mongrel2-server
set PYTHONPATH=%PYTHONPATH%;%ALLYCOM%ally-utilities
set PYTHONPATH=%PYTHONPATH%;%ALLYCOM%support-administration
set PYTHONPATH=%PYTHONPATH%;%ALLYCOM%support-cdm
set PYTHONPATH=%PYTHONPATH%;%ALLYCOM%support-development

SET ALLYPLUG=%ALLYPATH%plugins\
set PYTHONPATH=%PYTHONPATH%;%ALLYPLUG%gui-action
set PYTHONPATH=%PYTHONPATH%;%ALLYPLUG%gui-core
set PYTHONPATH=%PYTHONPATH%;%ALLYPLUG%internationalization
set PYTHONPATH=%PYTHONPATH%;%ALLYPLUG%introspection-request
set PYTHONPATH=%PYTHONPATH%;%ALLYPLUG%support-sqlalchemy

SET FULLPATH=
SET SUPERPLUG=%FULLPATH%plugins\
REM set PYTHONPATH=%PYTHONPATH%;%SUPERPLUG%ffmpeg-binary
set PYTHONPATH=%PYTHONPATH%;%SUPERPLUG%livedesk
set PYTHONPATH=%PYTHONPATH%;%SUPERPLUG%livedesk-embed
set PYTHONPATH=%PYTHONPATH%;%SUPERPLUG%media-archive
set PYTHONPATH=%PYTHONPATH%;%SUPERPLUG%media-archive-audio
set PYTHONPATH=%PYTHONPATH%;%SUPERPLUG%media-archive-image
set PYTHONPATH=%PYTHONPATH%;%SUPERPLUG%media-archive-video
set PYTHONPATH=%PYTHONPATH%;%SUPERPLUG%superdesk
set PYTHONPATH=%PYTHONPATH%;%SUPERPLUG%superdesk-address
set PYTHONPATH=%PYTHONPATH%;%SUPERPLUG%superdesk-article
set PYTHONPATH=%PYTHONPATH%;%SUPERPLUG%superdesk-authentication
set PYTHONPATH=%PYTHONPATH%;%SUPERPLUG%superdesk-collaborator
set PYTHONPATH=%PYTHONPATH%;%SUPERPLUG%superdesk-country
set PYTHONPATH=%PYTHONPATH%;%SUPERPLUG%superdesk-language
set PYTHONPATH=%PYTHONPATH%;%SUPERPLUG%superdesk-person
set PYTHONPATH=%PYTHONPATH%;%SUPERPLUG%superdesk-post
set PYTHONPATH=%PYTHONPATH%;%SUPERPLUG%superdesk-source
set PYTHONPATH=%PYTHONPATH%;%SUPERPLUG%superdesk-user

del distribution\workspace\superdesk.db
python distribution\application.py

@ECHO OFF
setlocal
SET ALLYPATH=..\
SET ALLYCOM=%ALLYPATH%components\
set PYTHONPATH=%ALLYCOM%ally-api
set PYTHONPATH=%PYTHONPATH%;%ALLYCOM%ally-authentication
set PYTHONPATH=%PYTHONPATH%;%ALLYCOM%ally-authentication-core
set PYTHONPATH=%PYTHONPATH%;%ALLYCOM%ally-authentication-http
set PYTHONPATH=%PYTHONPATH%;%ALLYCOM%ally-core
set PYTHONPATH=%PYTHONPATH%;%ALLYCOM%ally-core-http
set PYTHONPATH=%PYTHONPATH%;%ALLYCOM%ally-core-plugin
set PYTHONPATH=%PYTHONPATH%;%ALLYCOM%ally-core-sqlalchemy
set PYTHONPATH=%PYTHONPATH%;%ALLYCOM%ally-http-asyncore-server
set PYTHONPATH=%PYTHONPATH%;%ALLYCOM%ally-http-mongrel2-server
set PYTHONPATH=%PYTHONPATH%;%ALLYCOM%ally-utilities
set PYTHONPATH=%PYTHONPATH%;%ALLYCOM%support-administration
set PYTHONPATH=%PYTHONPATH%;%ALLYCOM%support-cdm
set PYTHONPATH=%PYTHONPATH%;%ALLYCOM%support-development

SET ALLYPLUG=%ALLYPATH%plugins\
set PYTHONPATH=%PYTHONPATH%;%ALLYPLUG%gui-action
set PYTHONPATH=%PYTHONPATH%;%ALLYPLUG%gui-core
set PYTHONPATH=%PYTHONPATH%;%ALLYPLUG%internationalization
set PYTHONPATH=%PYTHONPATH%;%ALLYPLUG%introspection-request
set PYTHONPATH=%PYTHONPATH%;%ALLYPLUG%support-sqlalchemy

SET FULLPATH=
SET SUPERPLUG=%FULLPATH%plugins\
REM set PYTHONPATH=%PYTHONPATH%;%SUPERPLUG%ffmpeg-binary
set PYTHONPATH=%PYTHONPATH%;%SUPERPLUG%livedesk
set PYTHONPATH=%PYTHONPATH%;%SUPERPLUG%livedesk-embed
set PYTHONPATH=%PYTHONPATH%;%SUPERPLUG%media-archive
set PYTHONPATH=%PYTHONPATH%;%SUPERPLUG%media-archive-audio
set PYTHONPATH=%PYTHONPATH%;%SUPERPLUG%media-archive-image
set PYTHONPATH=%PYTHONPATH%;%SUPERPLUG%media-archive-video
set PYTHONPATH=%PYTHONPATH%;%SUPERPLUG%superdesk
set PYTHONPATH=%PYTHONPATH%;%SUPERPLUG%superdesk-address
set PYTHONPATH=%PYTHONPATH%;%SUPERPLUG%superdesk-article
set PYTHONPATH=%PYTHONPATH%;%SUPERPLUG%superdesk-authentication
set PYTHONPATH=%PYTHONPATH%;%SUPERPLUG%superdesk-collaborator
set PYTHONPATH=%PYTHONPATH%;%SUPERPLUG%superdesk-country
set PYTHONPATH=%PYTHONPATH%;%SUPERPLUG%superdesk-language
set PYTHONPATH=%PYTHONPATH%;%SUPERPLUG%superdesk-person
set PYTHONPATH=%PYTHONPATH%;%SUPERPLUG%superdesk-post
set PYTHONPATH=%PYTHONPATH%;%SUPERPLUG%superdesk-source
set PYTHONPATH=%PYTHONPATH%;%SUPERPLUG%superdesk-user

if exist {distribution\workspace\shared\superdesk.db} (
	del distribution\workspace\shared\superdesk.db
)
if exist {distribution\application.properties} (
	python distribution\application.py
) else (
	python distribution\application.py -dump
	python distribution\application.py
)

NR-474: Refactor the collaborators setup in the blog configuration screen

Inteligent start-source.bat
runs with -dump if no application.properties was found and then runs the
application normal


:: gem uninstall pygments.rb --version "=0.5.2"
:: gem install pygments.rb --version "=0.5.0"

chcp 65001
jekyll serve --watch

Update start_windows.bat

Update start_windows.bat


@ECHO OFF
REM 2015
reg delete "HKEY_CURRENT_USER\SOFTWARE\Microsoft\VisualStudio\14.0_Config\Languages\File Extensions\.shader" /f
reg delete "HKEY_CURRENT_USER\SOFTWARE\Microsoft\VisualStudio\14.0_Config\Languages\File Extensions\.cginc" /f
reg delete "HKEY_CURRENT_USER\SOFTWARE\Microsoft\VisualStudio\14.0_Config\Languages\File Extensions\.compute" /f
reg delete "HKEY_CURRENT_USER\SOFTWARE\Microsoft\VisualStudio\14.0_Config\Languages\File Extensions\.glslinc" /f

REM VS2013
reg delete "HKEY_CURRENT_USER\SOFTWARE\Microsoft\VisualStudio\12.0_Config\Languages\File Extensions\.shader" /f
reg delete "HKEY_CURRENT_USER\SOFTWARE\Microsoft\VisualStudio\12.0_Config\Languages\File Extensions\.cginc" /f
reg delete "HKEY_CURRENT_USER\SOFTWARE\Microsoft\VisualStudio\12.0_Config\Languages\File Extensions\.compute" /f
reg delete "HKEY_CURRENT_USER\SOFTWARE\Microsoft\VisualStudio\12.0_Config\Languages\File Extensions\.glslinc" /f

REM VS2012
reg delete "HKEY_CURRENT_USER\SOFTWARE\Microsoft\VisualStudio\12.0_Config\Languages\File Extensions\.shader" /f
reg delete "HKEY_CURRENT_USER\SOFTWARE\Microsoft\VisualStudio\12.0_Config\Languages\File Extensions\.cginc" /f
reg delete "HKEY_CURRENT_USER\SOFTWARE\Microsoft\VisualStudio\12.0_Config\Languages\File Extensions\.compute" /f
reg delete "HKEY_CURRENT_USER\SOFTWARE\Microsoft\VisualStudio\12.0_Config\Languages\File Extensions\.glslinc" /f

pause

@ECHO OFF
REM VS2015
reg delete "HKEY_CURRENT_USER\SOFTWARE\Microsoft\VisualStudio\14.0_Config\Languages\File Extensions\.shader" /f
reg delete "HKEY_CURRENT_USER\SOFTWARE\Microsoft\VisualStudio\14.0_Config\Languages\File Extensions\.cginc" /f
reg delete "HKEY_CURRENT_USER\SOFTWARE\Microsoft\VisualStudio\14.0_Config\Languages\File Extensions\.compute" /f
reg delete "HKEY_CURRENT_USER\SOFTWARE\Microsoft\VisualStudio\14.0_Config\Languages\File Extensions\.glslinc" /f

REM VS2013
reg delete "HKEY_CURRENT_USER\SOFTWARE\Microsoft\VisualStudio\12.0_Config\Languages\File Extensions\.shader" /f
reg delete "HKEY_CURRENT_USER\SOFTWARE\Microsoft\VisualStudio\12.0_Config\Languages\File Extensions\.cginc" /f
reg delete "HKEY_CURRENT_USER\SOFTWARE\Microsoft\VisualStudio\12.0_Config\Languages\File Extensions\.compute" /f
reg delete "HKEY_CURRENT_USER\SOFTWARE\Microsoft\VisualStudio\12.0_Config\Languages\File Extensions\.glslinc" /f

REM VS2012
reg delete "HKEY_CURRENT_USER\SOFTWARE\Microsoft\VisualStudio\12.0_Config\Languages\File Extensions\.shader" /f
reg delete "HKEY_CURRENT_USER\SOFTWARE\Microsoft\VisualStudio\12.0_Config\Languages\File Extensions\.cginc" /f
reg delete "HKEY_CURRENT_USER\SOFTWARE\Microsoft\VisualStudio\12.0_Config\Languages\File Extensions\.compute" /f
reg delete "HKEY_CURRENT_USER\SOFTWARE\Microsoft\VisualStudio\12.0_Config\Languages\File Extensions\.glslinc" /f

pause

Update vs2015_2013_2012-register.cmd

Update vs2015_2013_2012-register.cmd


@echo off

set "CHRLAUNCHER_NAME=chrlauncher"
set "CHRLAUNCHER_NAME_SHORT=chrlauncher"
set "CHRLAUNCHER_DESCRIPTION=Chromium portable launcher and updater"
set "CHRLAUNCHER_PATH=%~dp0chrlauncher.exe"
set "CHRLAUNCHER_ICON=\"%CHRLAUNCHER_PATH%\",0"
set "CHRLAUNCHER_ARGS=\"%CHRLAUNCHER_PATH%\" \"%%1\""

if not exist "%CHRLAUNCHER_PATH%" (

	echo ERROR: "%CHRLAUNCHER_PATH%" not found.

) else (

	reg add hklm /f>nul 2>&1

	if ERRORLEVEL 1 (

		echo ERROR: you have no privileges.

	) else (

		regedit /s "%~dp0RegistryCleaner.reg"

		reg add "HKLM\Software\Classes\%CHRLAUNCHER_NAME_SHORT%HTML" /v "" /t REG_SZ /d "%CHRLAUNCHER_NAME% Document" /f
		reg add "HKLM\Software\Classes\%CHRLAUNCHER_NAME_SHORT%HTML\DefaultIcon" /v "" /t REG_SZ /d "%CHRLAUNCHER_ICON%" /f
		reg add "HKLM\Software\Classes\%CHRLAUNCHER_NAME_SHORT%HTML\shell\open\command" /v "" /t REG_SZ /d "%CHRLAUNCHER_ARGS%" /f

		reg add "HKLM\Software\Classes\%CHRLAUNCHER_NAME_SHORT%URL" /v "" /t REG_SZ /d "%CHRLAUNCHER_NAME% Protocol" /f
		reg add "HKLM\Software\Classes\%CHRLAUNCHER_NAME_SHORT%URL" /v "EditFlags" /t REG_DWORD /d "2" /f
		reg add "HKLM\Software\Classes\%CHRLAUNCHER_NAME_SHORT%URL" /v "FriendlyTypeName" /t REG_SZ /d "%CHRLAUNCHER_NAME% Protocol" /f
		reg add "HKLM\Software\Classes\%CHRLAUNCHER_NAME_SHORT%URL" /v "URL Protocol" /t REG_SZ /d "" /f
		reg add "HKLM\Software\Classes\%CHRLAUNCHER_NAME_SHORT%URL\DefaultIcon" /v "" /t REG_SZ /d "%CHRLAUNCHER_ICON%" /f
		reg add "HKLM\Software\Classes\%CHRLAUNCHER_NAME_SHORT%URL\shell\open\command" /v "" /t REG_SZ /d "%CHRLAUNCHER_ARGS%" /f

		reg add "HKLM\Software\RegisteredApplications" /v "%CHRLAUNCHER_NAME_SHORT%" /t REG_SZ /d "Software\Clients\StartMenuInternet\%CHRLAUNCHER_NAME_SHORT%\Capabilities" /f

		reg add "HKLM\Software\Clients\StartMenuInternet\%CHRLAUNCHER_NAME_SHORT%" /v "" /t REG_SZ /d "%CHRLAUNCHER_NAME%" /f

		reg add "HKLM\Software\Clients\StartMenuInternet\%CHRLAUNCHER_NAME_SHORT%\DefaultIcon" /v "" /t REG_SZ /d "%CHRLAUNCHER_ICON%" /f

		reg add "HKLM\Software\Clients\StartMenuInternet\%CHRLAUNCHER_NAME_SHORT%\shell\open\command" /v "" /t REG_SZ /d "\"%CHRLAUNCHER_PATH%\"" /f

		reg add "HKLM\Software\Clients\StartMenuInternet\%CHRLAUNCHER_NAME_SHORT%\InstallInfo" /v "IconsVisible" /t REG_DWORD /d "1" /f

		reg add "HKLM\Software\Clients\StartMenuInternet\%CHRLAUNCHER_NAME_SHORT%\Capabilities" /v "ApplicationIcon" /t REG_SZ /d "%CHRLAUNCHER_ICON%" /f
		reg add "HKLM\Software\Clients\StartMenuInternet\%CHRLAUNCHER_NAME_SHORT%\Capabilities" /v "ApplicationName" /t REG_SZ /d "%CHRLAUNCHER_NAME%" /f
		reg add "HKLM\Software\Clients\StartMenuInternet\%CHRLAUNCHER_NAME_SHORT%\Capabilities" /v "ApplicationDescription" /t REG_SZ /d "%CHRLAUNCHER_DESCRIPTION%" /f

		reg add "HKLM\Software\Clients\StartMenuInternet\%CHRLAUNCHER_NAME_SHORT%\Capabilities\FileAssociations" /v ".htm" /t REG_SZ /d "%CHRLAUNCHER_NAME_SHORT%HTML" /f
		reg add "HKLM\Software\Clients\StartMenuInternet\%CHRLAUNCHER_NAME_SHORT%\Capabilities\FileAssociations" /v ".html" /t REG_SZ /d "%CHRLAUNCHER_NAME_SHORT%HTML" /f
		reg add "HKLM\Software\Clients\StartMenuInternet\%CHRLAUNCHER_NAME_SHORT%\Capabilities\FileAssociations" /v ".shtml" /t REG_SZ /d "%CHRLAUNCHER_NAME_SHORT%HTML" /f
		reg add "HKLM\Software\Clients\StartMenuInternet\%CHRLAUNCHER_NAME_SHORT%\Capabilities\FileAssociations" /v ".xht" /t REG_SZ /d "%CHRLAUNCHER_NAME_SHORT%HTML" /f
		reg add "HKLM\Software\Clients\StartMenuInternet\%CHRLAUNCHER_NAME_SHORT%\Capabilities\FileAssociations" /v ".xhtml" /t REG_SZ /d "%CHRLAUNCHER_NAME_SHORT%HTML" /f

		reg add "HKLM\Software\Clients\StartMenuInternet\%CHRLAUNCHER_NAME_SHORT%\Capabilities\StartMenu" /v "StartMenuInternet" /t REG_SZ /d "%CHRLAUNCHER_NAME%" /f

		reg add "HKLM\Software\Clients\StartMenuInternet\%CHRLAUNCHER_NAME_SHORT%\Capabilities\URLAssociations" /v "ftp" /t REG_SZ /d "%CHRLAUNCHER_NAME_SHORT%URL" /f
		reg add "HKLM\Software\Clients\StartMenuInternet\%CHRLAUNCHER_NAME_SHORT%\Capabilities\URLAssociations" /v "http" /t REG_SZ /d "%CHRLAUNCHER_NAME_SHORT%URL" /f
		reg add "HKLM\Software\Clients\StartMenuInternet\%CHRLAUNCHER_NAME_SHORT%\Capabilities\URLAssociations" /v "https" /t REG_SZ /d "%CHRLAUNCHER_NAME_SHORT%URL" /f
		reg add "HKLM\Software\Clients\StartMenuInternet\%CHRLAUNCHER_NAME_SHORT%\Capabilities\URLAssociations" /v "mailto" /t REG_SZ /d "%CHRLAUNCHER_NAME_SHORT%URL" /f
		reg add "HKLM\Software\Clients\StartMenuInternet\%CHRLAUNCHER_NAME_SHORT%\Capabilities\URLAssociations" /v "webcal" /t REG_SZ /d "%CHRLAUNCHER_NAME_SHORT%URL" /f
		reg add "HKLM\Software\Clients\StartMenuInternet\%CHRLAUNCHER_NAME_SHORT%\Capabilities\URLAssociations" /v "urn" /t REG_SZ /d "%CHRLAUNCHER_NAME_SHORT%URL" /f
		reg add "HKLM\Software\Clients\StartMenuInternet\%CHRLAUNCHER_NAME_SHORT%\Capabilities\URLAssociations" /v "tel" /t REG_SZ /d "%CHRLAUNCHER_NAME_SHORT%URL" /f
		reg add "HKLM\Software\Clients\StartMenuInternet\%CHRLAUNCHER_NAME_SHORT%\Capabilities\URLAssociations" /v "smsto" /t REG_SZ /d "%CHRLAUNCHER_NAME_SHORT%URL" /f
		reg add "HKLM\Software\Clients\StartMenuInternet\%CHRLAUNCHER_NAME_SHORT%\Capabilities\URLAssociations" /v "sms" /t REG_SZ /d "%CHRLAUNCHER_NAME_SHORT%URL" /f
		reg add "HKLM\Software\Clients\StartMenuInternet\%CHRLAUNCHER_NAME_SHORT%\Capabilities\URLAssociations" /v "nntp" /t REG_SZ /d "%CHRLAUNCHER_NAME_SHORT%URL" /f
		reg add "HKLM\Software\Clients\StartMenuInternet\%CHRLAUNCHER_NAME_SHORT%\Capabilities\URLAssociations" /v "news" /t REG_SZ /d "%CHRLAUNCHER_NAME_SHORT%URL" /f
		reg add "HKLM\Software\Clients\StartMenuInternet\%CHRLAUNCHER_NAME_SHORT%\Capabilities\URLAssociations" /v "mms" /t REG_SZ /d "%CHRLAUNCHER_NAME_SHORT%URL" /f
		reg add "HKLM\Software\Clients\StartMenuInternet\%CHRLAUNCHER_NAME_SHORT%\Capabilities\URLAssociations" /v "irc" /t REG_SZ /d "%CHRLAUNCHER_NAME_SHORT%URL" /f

		%windir%\system32\control.exe /name Microsoft.DefaultPrograms /page pageDefaultProgram\pageAdvancedSettings?pszAppName=%CHRLAUNCHER_NAME_SHORT%
	)
)

pause

@echo off

set "CHRLAUNCHER_NAME=chrlauncher"
set "CHRLAUNCHER_NAME_SHORT=chrlauncher"
set "CHRLAUNCHER_DESCRIPTION=Chromium portable launcher and updater"
set "CHRLAUNCHER_PATH=%~dp0chrlauncher.exe"
set "CHRLAUNCHER_ICON=\"%CHRLAUNCHER_PATH%\",0"
set "CHRLAUNCHER_ARGS=\"%CHRLAUNCHER_PATH%\" \"%%1\""

if not exist "%CHRLAUNCHER_PATH%" (

	echo ERROR: "%CHRLAUNCHER_PATH%" not found.

) else (

	reg add hklm /f>nul 2>&1

	if ERRORLEVEL 1 (

		echo ERROR: you have no privileges.

	) else (

		regedit /s "%~dp0RegistryCleaner.reg"

		reg add "HKLM\Software\Classes\%CHRLAUNCHER_NAME_SHORT%HTML" /v "" /t REG_SZ /d "%CHRLAUNCHER_NAME% Document" /f
		reg add "HKLM\Software\Classes\%CHRLAUNCHER_NAME_SHORT%HTML\DefaultIcon" /v "" /t REG_SZ /d "%CHRLAUNCHER_ICON%" /f
		reg add "HKLM\Software\Classes\%CHRLAUNCHER_NAME_SHORT%HTML\shell\open\command" /v "" /t REG_SZ /d "%CHRLAUNCHER_ARGS%" /f

		reg add "HKLM\Software\Classes\%CHRLAUNCHER_NAME_SHORT%URL" /v "" /t REG_SZ /d "%CHRLAUNCHER_NAME% Protocol" /f
		reg add "HKLM\Software\Classes\%CHRLAUNCHER_NAME_SHORT%URL" /v "EditFlags" /t REG_DWORD /d "2" /f
		reg add "HKLM\Software\Classes\%CHRLAUNCHER_NAME_SHORT%URL" /v "FriendlyTypeName" /t REG_SZ /d "%CHRLAUNCHER_NAME% Protocol" /f
		reg add "HKLM\Software\Classes\%CHRLAUNCHER_NAME_SHORT%URL" /v "URL Protocol" /t REG_SZ /d "" /f
		reg add "HKLM\Software\Classes\%CHRLAUNCHER_NAME_SHORT%URL\DefaultIcon" /v "" /t REG_SZ /d "%CHRLAUNCHER_ICON%" /f
		reg add "HKLM\Software\Classes\%CHRLAUNCHER_NAME_SHORT%URL\shell\open\command" /v "" /t REG_SZ /d "%CHRLAUNCHER_ARGS%" /f

		reg add "HKLM\Software\RegisteredApplications" /v "%CHRLAUNCHER_NAME_SHORT%" /t REG_SZ /d "Software\Clients\StartMenuInternet\%CHRLAUNCHER_NAME_SHORT%\Capabilities" /f

		reg add "HKLM\Software\Clients\StartMenuInternet\%CHRLAUNCHER_NAME_SHORT%" /v "" /t REG_SZ /d "%CHRLAUNCHER_NAME%" /f

		reg add "HKLM\Software\Clients\StartMenuInternet\%CHRLAUNCHER_NAME_SHORT%\DefaultIcon" /v "" /t REG_SZ /d "%CHRLAUNCHER_ICON%" /f

		reg add "HKLM\Software\Clients\StartMenuInternet\%CHRLAUNCHER_NAME_SHORT%\shell\open\command" /v "" /t REG_SZ /d "\"%CHRLAUNCHER_PATH%\"" /f

		reg add "HKLM\Software\Clients\StartMenuInternet\%CHRLAUNCHER_NAME_SHORT%\InstallInfo" /v "IconsVisible" /t REG_DWORD /d "1" /f

		reg add "HKLM\Software\Clients\StartMenuInternet\%CHRLAUNCHER_NAME_SHORT%\Capabilities" /v "ApplicationIcon" /t REG_SZ /d "%CHRLAUNCHER_ICON%" /f
		reg add "HKLM\Software\Clients\StartMenuInternet\%CHRLAUNCHER_NAME_SHORT%\Capabilities" /v "ApplicationName" /t REG_SZ /d "%CHRLAUNCHER_NAME%" /f
		reg add "HKLM\Software\Clients\StartMenuInternet\%CHRLAUNCHER_NAME_SHORT%\Capabilities" /v "ApplicationDescription" /t REG_SZ /d "%CHRLAUNCHER_DESCRIPTION%" /f

		reg add "HKLM\Software\Clients\StartMenuInternet\%CHRLAUNCHER_NAME_SHORT%\Capabilities\FileAssociations" /v ".htm" /t REG_SZ /d "%CHRLAUNCHER_NAME_SHORT%HTML" /f
		reg add "HKLM\Software\Clients\StartMenuInternet\%CHRLAUNCHER_NAME_SHORT%\Capabilities\FileAssociations" /v ".html" /t REG_SZ /d "%CHRLAUNCHER_NAME_SHORT%HTML" /f
		reg add "HKLM\Software\Clients\StartMenuInternet\%CHRLAUNCHER_NAME_SHORT%\Capabilities\FileAssociations" /v ".shtml" /t REG_SZ /d "%CHRLAUNCHER_NAME_SHORT%HTML" /f
		reg add "HKLM\Software\Clients\StartMenuInternet\%CHRLAUNCHER_NAME_SHORT%\Capabilities\FileAssociations" /v ".xht" /t REG_SZ /d "%CHRLAUNCHER_NAME_SHORT%HTML" /f
		reg add "HKLM\Software\Clients\StartMenuInternet\%CHRLAUNCHER_NAME_SHORT%\Capabilities\FileAssociations" /v ".xhtml" /t REG_SZ /d "%CHRLAUNCHER_NAME_SHORT%HTML" /f

		reg add "HKLM\Software\Clients\StartMenuInternet\%CHRLAUNCHER_NAME_SHORT%\Capabilities\StartMenu" /v "StartMenuInternet" /t REG_SZ /d "%CHRLAUNCHER_NAME_SHORT%" /f

		reg add "HKLM\Software\Clients\StartMenuInternet\%CHRLAUNCHER_NAME_SHORT%\Capabilities\URLAssociations" /v "ftp" /t REG_SZ /d "%CHRLAUNCHER_NAME_SHORT%URL" /f
		reg add "HKLM\Software\Clients\StartMenuInternet\%CHRLAUNCHER_NAME_SHORT%\Capabilities\URLAssociations" /v "http" /t REG_SZ /d "%CHRLAUNCHER_NAME_SHORT%URL" /f
		reg add "HKLM\Software\Clients\StartMenuInternet\%CHRLAUNCHER_NAME_SHORT%\Capabilities\URLAssociations" /v "https" /t REG_SZ /d "%CHRLAUNCHER_NAME_SHORT%URL" /f
		reg add "HKLM\Software\Clients\StartMenuInternet\%CHRLAUNCHER_NAME_SHORT%\Capabilities\URLAssociations" /v "mailto" /t REG_SZ /d "%CHRLAUNCHER_NAME_SHORT%URL" /f
		reg add "HKLM\Software\Clients\StartMenuInternet\%CHRLAUNCHER_NAME_SHORT%\Capabilities\URLAssociations" /v "webcal" /t REG_SZ /d "%CHRLAUNCHER_NAME_SHORT%URL" /f
		reg add "HKLM\Software\Clients\StartMenuInternet\%CHRLAUNCHER_NAME_SHORT%\Capabilities\URLAssociations" /v "urn" /t REG_SZ /d "%CHRLAUNCHER_NAME_SHORT%URL" /f
		reg add "HKLM\Software\Clients\StartMenuInternet\%CHRLAUNCHER_NAME_SHORT%\Capabilities\URLAssociations" /v "tel" /t REG_SZ /d "%CHRLAUNCHER_NAME_SHORT%URL" /f
		reg add "HKLM\Software\Clients\StartMenuInternet\%CHRLAUNCHER_NAME_SHORT%\Capabilities\URLAssociations" /v "smsto" /t REG_SZ /d "%CHRLAUNCHER_NAME_SHORT%URL" /f
		reg add "HKLM\Software\Clients\StartMenuInternet\%CHRLAUNCHER_NAME_SHORT%\Capabilities\URLAssociations" /v "sms" /t REG_SZ /d "%CHRLAUNCHER_NAME_SHORT%URL" /f
		reg add "HKLM\Software\Clients\StartMenuInternet\%CHRLAUNCHER_NAME_SHORT%\Capabilities\URLAssociations" /v "nntp" /t REG_SZ /d "%CHRLAUNCHER_NAME_SHORT%URL" /f
		reg add "HKLM\Software\Clients\StartMenuInternet\%CHRLAUNCHER_NAME_SHORT%\Capabilities\URLAssociations" /v "news" /t REG_SZ /d "%CHRLAUNCHER_NAME_SHORT%URL" /f
		reg add "HKLM\Software\Clients\StartMenuInternet\%CHRLAUNCHER_NAME_SHORT%\Capabilities\URLAssociations" /v "mms" /t REG_SZ /d "%CHRLAUNCHER_NAME_SHORT%URL" /f
		reg add "HKLM\Software\Clients\StartMenuInternet\%CHRLAUNCHER_NAME_SHORT%\Capabilities\URLAssociations" /v "irc" /t REG_SZ /d "%CHRLAUNCHER_NAME_SHORT%URL" /f

		%windir%\system32\control.exe /name Microsoft.DefaultPrograms /page pageDefaultProgram\pageAdvancedSettings?pszAppName=%CHRLAUNCHER_NAME_SHORT%
	)
)

pause

fix script

fix script


@echo off

REM BRouter standalone server
REM java -cp brouter.jar btools.brouter.RouteServer <segmentdir> <profile-map> <customprofiledir> <port> <maxthreads>

REM maxRunningTime is the request timeout in seconds, set to 0 to disable timeout
set JAVA_OPTS=-Xmx128M -Xms128M -Xmn8M -DmaxRunningTime=300
set CLASSPATH=../brouter.jar

java %JAVA_OPTS% -cp %CLASSPATH% btools.server.RouteServer ..\segments3 ..\profiles2 ..\customprofiles 17777 1

@echo off

REM BRouter standalone server
REM java -cp brouter.jar btools.brouter.RouteServer <segmentdir> <profile-map> <customprofiledir> <port> <maxthreads>

REM maxRunningTime is the request timeout in seconds, set to 0 to disable timeout
set JAVA_OPTS=-Xmx128M -Xms128M -Xmn8M -DmaxRunningTime=300
set CLASSPATH=../brouter.jar

java %JAVA_OPTS% -cp %CLASSPATH% btools.server.RouteServer ..\segments4 ..\profiles2 ..\customprofiles 17777 1

update standalone server.cmd to segments4


SET GOPATH=%CD%\gopath
SET GATSPATH=%GOPATH%\src\github.com\cloudfoundry\cli-acceptance-tests

SET PATH=C:\Go\bin;%PATH%
SET PATH=C:\Program Files\Git\cmd\;%PATH%
SET PATH=%GOPATH%\bin;%PATH%
SET PATH=C:\Program Files\7-Zip;%PATH%
SET PATH=C:\Program Files\cURL\bin;%PATH%
SET PATH=%CD%;%PATH%

SET /p DOMAIN=<%CD%\bosh-lite-lock\name
call %CD%\cli-ci\ci\tasks\create-cats-config.bat
SET CONFIG=%CD%\config.json

pushd %CD%\cf-cli-binaries
	7z x cf-cli-binaries.tgz
	7z x cf-cli-binaries.tar
	MOVE %CD%\cf-cli_winx64.exe ..\cf.exe
popd

go get -v github.com/onsi/ginkgo/ginkgo

cd %GATSPATH%
ginkgo.exe -r -nodes=4 -slowSpecThreshold=120 -randomizeSuites -skipPackage application ./gats
ginkgo.exe -r -nodes=4 -slowSpecThreshold=120 -randomizeSuites ./gats/application

SET GOPATH=%CD%\gopath
SET GATSPATH=%GOPATH%\src\github.com\cloudfoundry\cli-acceptance-tests

SET PATH=C:\Go\bin;%PATH%
SET PATH=C:\Program Files\Git\cmd\;%PATH%
SET PATH=%GOPATH%\bin;%PATH%
SET PATH=C:\Program Files\GnuWin32\bin;%PATH%
SET PATH=C:\Program Files\cURL\bin;%PATH%
SET PATH=%CD%;%PATH%

SET /p DOMAIN=<%CD%\bosh-lite-lock\name
call %CD%\cli-ci\ci\tasks\create-cats-config.bat
SET CONFIG=%CD%\config.json

pushd %CD%\cf-cli-binaries
	gzip -d cf-cli-binaries.tgz
	tar -xvf cf-cli-binaries.tar
	MOVE %CD%\cf-cli_winx64.exe ..\cf.exe
popd

go get -v github.com/onsi/ginkgo/ginkgo

cd %GATSPATH%
ginkgo.exe -r -nodes=4 -slowSpecThreshold=120 -randomizeSuites -skipPackage application ./gats
ginkgo.exe -r -nodes=4 -slowSpecThreshold=120 -randomizeSuites ./gats/application

Revert "switching to 7z as well, sourceforge still broke"

This reverts commit 9b2c32b64adb595d5c2e19ca7d0abf421eacc097.


:: Turn off script echoing.
@echo off

:: Set your env to here
set HADOOP_HOME=C:\hadoop-2.6.0
set JAVA_HOME=C:\Program Files\Java\jdk1.8.0_25

cd /d %~dp0

:: Set Hadoop Env

set PATH=%PATH%;%JAVA_HOME%\bin;%JAVA_HOME%\jre\bin;%JAVA_HOME%\jre\bin\server

:: Set the vdceye home
set VEH_HOME=C:\veh
::set VEH_HOME=%HADOOP_HOME%\share\hadoop\

rmdir  /q %VEH_HOME%
mklink /d %VEH_HOME% %HADOOP_HOME%\share\hadoop\

set HADOOP_CLASSPATH_COMMON=C:\
set HADOOP_COMMON=%VEH_HOME%\common\
pushd %HADOOP_COMMON%
for /R %%i in (*.jar) do (call :concat1 %%i)
popd

set HADOOP_CLASSPATH_HDFS=C:\
set HADOOP_HDFS=%VEH_HOME%\hdfs\
pushd %HADOOP_HDFS%
for /R %%i in (*.jar) do (call :concat2 %%i)
popd

set CLASSPATH=.;%JAVA_HOME%\lib;%JAVA_HOME%\lib\dt.jar;%JAVA_HOME%\lib\tools.jar;%HADOOP_CLASSPATH_COMMON%;%HADOOP_CLASSPATH_HDFS%

echo %CLASSPATH%

.\"vdceye Manager x64.exe"

:concat1
    set file=%1
    set HADOOP_CLASSPATH_COMMON=%HADOOP_CLASSPATH_COMMON%;%1

:concat2
    set file=%1
    set HADOOP_CLASSPATH_HDFS=%HADOOP_CLASSPATH_HDFS%;%1

add hadoop cmd

add hadoop cmd


### application.bat - 2015 - MAUBIAN ###
echo "Copyright company - 2015"
Build : 10:00
echo "version 1.1"

### application.bat - 2015 - MAUBIAN ###
version = "2"
build_hour = "11H00"

echo "Build ${build_hour}"
echo "version ${version}"

add var to script

add var to script


REM set "CXXFLAGS=%CXXFLAGS:-GL=%"
REM set "CFLAGS=%CFLAGS:-GL=%"
REM set "CXXFLAGS= -MD"

set "CMAKE_GENERATOR=NMake Makefiles"
"%PYTHON%" --version
"%PYTHON%" -m pip install . --no-deps -vv

REM set "CXXFLAGS=%CXXFLAGS:-GL=%"
REM set "CFLAGS=%CFLAGS:-GL=%"
REM set "CXXFLAGS= -MD"

set "CMAKE_GENERATOR=Visual Studio 15 2017"
"%PYTHON%" --version
"%PYTHON%" -m pip install . --no-deps -vv

use Visual Studio 15 2017 to build in Windows


@echo off
rem
rem Usage: get-scala-revison.bat [dir]
rem Figures out current scala revision of a git clone.
rem
rem If no dir is given, current working dir is used.

@setlocal
set _DIR=
if "%*"=="" (
  for /f "delims=;" %%i in ('cd') do set "_DIR=%%i"
) else (
  set "_DIR=%~1"
)
cd %_DIR%

if exist .git\NUL (
  git describe head --abbrev=7 --match dev
  echo 0
)

:end
@endlocal

@echo off
rem
rem Usage: get-scala-revison.bat [dir]
rem Figures out current scala revision of a git clone.
rem
rem If no dir is given, current working dir is used.

@setlocal
set _DIR=
if "%*"=="" (
  for /f "delims=;" %%i in ('cd') do set "_DIR=%%i"
) else (
  set "_DIR=%~1"
)
cd %_DIR%

if exist .git\NUL (
  git describe head --abbrev=7 --match dev
)

:end
@endlocal

Fix build on Windows.

Fix build on Windows.

a289465c70630719cbd3a74edf5502a156ef83c4 broke get-scala-revision.bat.


@echo off
rem -------------------------------------------------------------------------
rem Keycloak Startup Script
rem -------------------------------------------------------------------------

@if not "%ECHO%" == ""  echo %ECHO%
setlocal

rem Get the program name before using shift as the command modify the variable ~nx0
if "%OS%" == "Windows_NT" (
  set "PROGNAME=%~nx0%"
) else (
  set "PROGNAME=kc.bat"
)

if "%OS%" == "Windows_NT" (
  set "DIRNAME=%~dp0%"
) else (
  set DIRNAME=.\
)

set "SERVER_OPTS=-Djava.util.logging.manager=org.jboss.logmanager.LogManager -Dquarkus-log-max-startup-records=10000"

set DEBUG_MODE=false
set DEBUG_PORT_VAR=8787
set DEBUG_SUSPEND_VAR=n
set CONFIG_ARGS=

rem Read command-line args, the ~ removes the quotes from the parameter
:READ-ARGS
set "KEY=%~1"
if "%KEY%" == "" (
    goto MAIN
)
if "%KEY%" == "--debug" (
  set "DEBUG_MODE=true"
  set "DEBUG_PORT_VAR=%~2"
  if "%DEBUG_PORT_VAR%" == "" (
     set DEBUG_PORT_VAR=8787
  )
  if "%DEBUG_SUSPEND_VAR%" == "" (
     set DEBUG_SUSPEND_VAR=n
  )
  shift
  shift
  goto READ-ARGS
)
if "%KEY%" == "start-dev" (
  set "CONFIG_ARGS=%CONFIG_ARGS% --profile=dev %KEY% "
  shift
  goto READ-ARGS
)
if not "%KEY:~0,2%"=="--" if "%KEY:~0,2%"=="-D" (
  set "SERVER_OPTS=%SERVER_OPTS% %KEY%=%~2"
  shift
)
if not "%KEY:~0,2%"=="--" if not "%KEY:~0,1%"=="-" (
  set "CONFIG_ARGS=%CONFIG_ARGS% %KEY%"
)
if not "%KEY:~0,2%"=="-D" (
  if "%KEY:~0,1%"=="-" (
      if "%~2"=="" (
        set "CONFIG_ARGS=%CONFIG_ARGS% %KEY%"
      ) else (
        set "CONFIG_ARGS=%CONFIG_ARGS% %KEY% %~2%"
      )
      shift
  )
)
shift
goto READ-ARGS

:MAIN
if not "x%JAVA_OPTS%" == "x" (
  echo "JAVA_OPTS already set in environment; overriding default settings with values: %JAVA_OPTS%"
) else (
  set "JAVA_OPTS=-Xms64m -Xmx512m -XX:MetaspaceSize=96M -XX:MaxMetaspaceSize=256m -Djava.net.preferIPv4Stack=true -Dfile.encoding=UTF-8"
)

if not "x%JAVA_OPTS_APPEND%" == "x" (
  echo "Appending additional Java properties to JAVA_OPTS: %JAVA_OPTS_APPEND%"
  set "JAVA_OPTS=%JAVA_OPTS% %JAVA_OPTS_APPEND%"
)

if NOT "x%DEBUG%" == "x" (
  set "DEBUG_MODE=%DEBUG%
)

if NOT "x%DEBUG_PORT%" == "x" (
  set DEBUG_PORT_VAR=%DEBUG_PORT%
)

if NOT "x%DEBUG_SUSPEND%" == "x" (
  set DEBUG_SUSPEND_VAR=%DEBUG_SUSPEND%
)

rem Set debug settings if not already set
if "%DEBUG_MODE%" == "true" (
   echo "%JAVA_OPTS%" | findstr /I "\-agentlib:jdwp" > nul
  if errorlevel == 1 (
     set "JAVA_OPTS=%JAVA_OPTS% -agentlib:jdwp=transport=dt_socket,address=%DEBUG_PORT_VAR%,server=y,suspend=%DEBUG_SUSPEND_VAR%"
  ) else (
     echo Debug already enabled in JAVA_OPTS, ignoring --debug argument
  )
)

rem Setup Keycloak specific properties
set "JAVA_OPTS=-Dprogram.name=%PROGNAME% %JAVA_OPTS%"

if "x%JAVA_HOME%" == "x" (
  set  JAVA=java
  echo JAVA_HOME is not set. Unexpected results may occur.
  echo Set JAVA_HOME to the directory of your local JDK to avoid this message.
) else (
  if not exist "%JAVA_HOME%" (
    echo JAVA_HOME "%JAVA_HOME%" path doesn't exist
    goto END
   ) else (
     if not exist "%JAVA_HOME%\bin\java.exe" (
       echo "%JAVA_HOME%\bin\java.exe" does not exist
       goto END
     )
    set "JAVA=%JAVA_HOME%\bin\java"
  )
)

set "CLASSPATH_OPTS=%DIRNAME%..\lib\quarkus-run.jar:%DIRNAME%..\lib\bootstrap\*"

set "JAVA_RUN_OPTS=%JAVA_OPTS% -Dkc.home.dir="%DIRNAME%.." -Djboss.server.config.dir="%DIRNAME%..\conf" -Dkeycloak.theme.dir="%DIRNAME%..\themes" %SERVER_OPTS% -cp "%CLASSPATH_OPTS%" io.quarkus.bootstrap.runner.QuarkusEntryPoint %CONFIG_ARGS%"

SetLocal EnableDelayedExpansion

set "OPTIMIZED_OPTION=--optimized"
set "HELP_LONG_OPTION=--help"
set "BUILD_OPTION= build"
set IS_HELP_SHORT=false

echo "%CONFIG_ARGS%" | findstr /r "\<-h\>" > nul

if not errorlevel == 1 (
    set IS_HELP_SHORT=true
)

set START_SERVER=true

if "!CONFIG_ARGS:%OPTIMIZED_OPTION%=!"=="!CONFIG_ARGS!" if "!CONFIG_ARGS:%BUILD_OPTION%=!"=="!CONFIG_ARGS!" if "!CONFIG_ARGS:%HELP_LONG_OPTION%=!"=="!CONFIG_ARGS!" if "%IS_HELP_SHORT%" == "false" (
    setlocal enabledelayedexpansion

    "%JAVA%" -Dkc.config.build-and-exit=true %JAVA_RUN_OPTS%

    if not !errorlevel! == 0 (
        set START_SERVER=false
    )

    set "JAVA_RUN_OPTS=-Dkc.config.built=true %JAVA_RUN_OPTS%"
)

if "%START_SERVER%" == "true" (
    "%JAVA%" %JAVA_RUN_OPTS%
)

:END

@echo off
rem -------------------------------------------------------------------------
rem Keycloak Startup Script
rem -------------------------------------------------------------------------

@if not "%ECHO%" == ""  echo %ECHO%
setlocal

rem Get the program name before using shift as the command modify the variable ~nx0
if "%OS%" == "Windows_NT" (
  set "PROGNAME=%~nx0%"
) else (
  set "PROGNAME=kc.bat"
)

if "%OS%" == "Windows_NT" (
  set "DIRNAME=%~dp0%"
) else (
  set DIRNAME=.\
)

set "SERVER_OPTS=-Djava.util.logging.manager=org.jboss.logmanager.LogManager -Dquarkus-log-max-startup-records=10000"

set DEBUG_MODE=false
set DEBUG_PORT_VAR=8787
set DEBUG_SUSPEND_VAR=n
set CONFIG_ARGS=

rem Read command-line args, the ~ removes the quotes from the parameter
:READ-ARGS
set "KEY=%~1"
if "%KEY%" == "" (
    goto MAIN
)
if "%KEY%" == "--debug" (
  set "DEBUG_MODE=true"
  set "DEBUG_PORT_VAR=%~2"
  if "%DEBUG_PORT_VAR%" == "" (
     set DEBUG_PORT_VAR=8787
  )
  if "%DEBUG_SUSPEND_VAR%" == "" (
     set DEBUG_SUSPEND_VAR=n
  )
  shift
  shift
  goto READ-ARGS
)
if "%KEY%" == "start-dev" (
  set "CONFIG_ARGS=%CONFIG_ARGS% --profile=dev %KEY% "
  shift
  goto READ-ARGS
)
if not "%KEY:~0,2%"=="--" if "%KEY:~0,2%"=="-D" (
  set "SERVER_OPTS=%SERVER_OPTS% %KEY%=%~2"
  shift
)
if not "%KEY:~0,2%"=="--" if not "%KEY:~0,1%"=="-" (
  set "CONFIG_ARGS=%CONFIG_ARGS% %KEY%"
)
if not "%KEY:~0,2%"=="-D" (
  if "%KEY:~0,1%"=="-" (
      if "%~2"=="" (
        set "CONFIG_ARGS=%CONFIG_ARGS% %KEY%"
      ) else (
        set "CONFIG_ARGS=%CONFIG_ARGS% %KEY% %~2%"
      )
      shift
  )
)
shift
goto READ-ARGS

:MAIN
if not "x%JAVA_OPTS%" == "x" (
  echo "JAVA_OPTS already set in environment; overriding default settings with values: %JAVA_OPTS%"
) else (
  set "JAVA_OPTS=-Xms64m -Xmx512m -XX:MetaspaceSize=96M -XX:MaxMetaspaceSize=256m -Djava.net.preferIPv4Stack=true -Dfile.encoding=UTF-8"
)

if not "x%JAVA_OPTS_APPEND%" == "x" (
  echo "Appending additional Java properties to JAVA_OPTS: %JAVA_OPTS_APPEND%"
  set "JAVA_OPTS=%JAVA_OPTS% %JAVA_OPTS_APPEND%"
)

if NOT "x%DEBUG%" == "x" (
  set "DEBUG_MODE=%DEBUG%
)

if NOT "x%DEBUG_PORT%" == "x" (
  set DEBUG_PORT_VAR=%DEBUG_PORT%
)

if NOT "x%DEBUG_SUSPEND%" == "x" (
  set DEBUG_SUSPEND_VAR=%DEBUG_SUSPEND%
)

rem Set debug settings if not already set
if "%DEBUG_MODE%" == "true" (
   echo "%JAVA_OPTS%" | findstr /I "\-agentlib:jdwp" > nul
  if errorlevel == 1 (
     set "JAVA_OPTS=%JAVA_OPTS% -agentlib:jdwp=transport=dt_socket,address=%DEBUG_PORT_VAR%,server=y,suspend=%DEBUG_SUSPEND_VAR%"
  ) else (
     echo Debug already enabled in JAVA_OPTS, ignoring --debug argument
  )
)

rem Setup Keycloak specific properties
set "JAVA_OPTS=-Dprogram.name=%PROGNAME% %JAVA_OPTS%"

if "x%JAVA_HOME%" == "x" (
  set  JAVA=java
  echo JAVA_HOME is not set. Unexpected results may occur.
  echo Set JAVA_HOME to the directory of your local JDK to avoid this message.
) else (
  if not exist "%JAVA_HOME%" (
    echo JAVA_HOME "%JAVA_HOME%" path doesn't exist
    goto END
   ) else (
     if not exist "%JAVA_HOME%\bin\java.exe" (
       echo "%JAVA_HOME%\bin\java.exe" does not exist
       goto END
     )
    set "JAVA=%JAVA_HOME%\bin\java"
  )
)

set "CLASSPATH_OPTS=%DIRNAME%..\lib\quarkus-run.jar;%DIRNAME%..\lib\bootstrap\*"

set "JAVA_RUN_OPTS=%JAVA_OPTS% -Dkc.home.dir="%DIRNAME%.." -Djboss.server.config.dir="%DIRNAME%..\conf" -Dkeycloak.theme.dir="%DIRNAME%..\themes" %SERVER_OPTS% -cp "%CLASSPATH_OPTS%" io.quarkus.bootstrap.runner.QuarkusEntryPoint %CONFIG_ARGS%"

SetLocal EnableDelayedExpansion

set "OPTIMIZED_OPTION=--optimized"
set "HELP_LONG_OPTION=--help"
set "BUILD_OPTION= build"
set IS_HELP_SHORT=false

echo "%CONFIG_ARGS%" | findstr /r "\<-h\>" > nul

if not errorlevel == 1 (
    set IS_HELP_SHORT=true
)

set START_SERVER=true

if "!CONFIG_ARGS:%OPTIMIZED_OPTION%=!"=="!CONFIG_ARGS!" if "!CONFIG_ARGS:%BUILD_OPTION%=!"=="!CONFIG_ARGS!" if "!CONFIG_ARGS:%HELP_LONG_OPTION%=!"=="!CONFIG_ARGS!" if "%IS_HELP_SHORT%" == "false" (
    setlocal enabledelayedexpansion

    "%JAVA%" -Dkc.config.build-and-exit=true %JAVA_RUN_OPTS%

    if not !errorlevel! == 0 (
        set START_SERVER=false
    )

    set "JAVA_RUN_OPTS=-Dkc.config.built=true %JAVA_RUN_OPTS%"
)

if "%START_SERVER%" == "true" (
    "%JAVA%" %JAVA_RUN_OPTS%
)

:END

Fix classpath separator for windows startup script (#15300)

Closes #15281

Co-authored-by: Stian Thorgersen <b767fa2f68b1a7887c2db1fc2e076be12a2a2f5d@gmail.com>


REM query the DNS `TXT` record of `google.com` with a 15 second time out
nslookup -q=TXT -timeout=15 google.com

REM https://blogs.technet.microsoft.com/rmilne/2015/09/11/how-to-use-nslookup-to-check-dns-txt-record/
REM http://www.windowscommandline.com/nslookup/
REM https://www.owasp.org/index.php/OWASP_File_Hash_Repository
REM http://www.ghacks.net/2010/02/16/whitelist-hash-database-frontend/
REM https://github.com/rjhansen/nsrllookup

Update nslookup_example_txt.bat

Update nslookup_example_txt.bat

added links


git clone https://github.com/SFML/SFML.git
cd SFML

mkdir install
mkdir build
cd build

cmake .. -G "Visual Studio 15 Win64" -DCMAKE_INSTALL_PREFIX=../install -DSFML_DEPENDENCIES_INSTALL_PREFIX=../install -DSFML_BUILD_FRAMEWORKS=FALSE -DBUILD_SHARED_LIBS=TRUE

msbuild INSTALL.vcxproj

cd ../../

mkdir install
mkdir build
cd build

cmake .. -G "Visual Studio 15 Win64" -DCMAKE_BUILD_TYPE=$CONFIGURATION -DTARGET_CPU=$PLATFORM -DCMAKE_INSTALL_PREFIX=../install -DCMAKE_PREFIX_PATH=../SFML/install

git clone https://github.com/SFML/SFML.git
cd SFML

mkdir install
mkdir build
cd build

cmake .. -G "Visual Studio 15 Win64" -DCMAKE_INSTALL_PREFIX=../install -DSFML_DEPENDENCIES_INSTALL_PREFIX=../install -DSFML_BUILD_FRAMEWORKS=FALSE -DBUILD_SHARED_LIBS=TRUE

msbuild INSTALL.vcxproj

cd ../../

mkdir install
mkdir build
cd build

cmake .. -G "Visual Studio 15 Win64" -DCMAKE_BUILD_TYPE=$CONFIGURATION -DTARGET_CPU=$PLATFORM -DCMAKE_INSTALL_PREFIX=../install -DCMAKE_PREFIX_PATH=C:/projects/timle/SFML/install

Change SFML build path in the install script for manual check


@echo off
if not exist build-x64 mkdir build-x64
cd build-x64

REM Update your dependency directories below as necessary

cmake -G"Visual Studio 12" -A x64 -DOpenCV_DIR="C:\libs\opencv-2.4.10\build-x64" -DSFML_ROOT="C:\libs\SFML-2.3.2-64" -DPROTOBUF_SRC_ROOT_FOLDER="C:\libs\protobuf-2.6.1" .. && goto :copy_files

REM only if cmake failed...
GOTO end

:copy_files
xcopy ..\samples-aux\vs2013\copy_to_bin64_dir\*.* .\bin\Debug\ /E /Y
xcopy ..\samples-aux\vs2013\copy_to_bin64_dir\*.* .\bin\Release\ /E /Y
xcopy ..\samples-aux\vs2013\copy_to_bin64_dir\*.* .\bin\RelWithDebInfo\ /E /Y
echo Done!

:end
cd ..

@echo off
if not exist build-x64 mkdir build-x64
cd build-x64

REM Update your dependency directories below as necessary

cmake -G"Visual Studio 12" -Ax64 -DOpenCV_DIR="C:\libs\opencv-2.4.10\build-x64" -DSFML_ROOT="C:\libs\SFML-2.3.2-64" -DPROTOBUF_SRC_ROOT_FOLDER="C:\libs\protobuf-2.6.1" .. && goto :copy_files

REM only if cmake failed...
GOTO end

:copy_files
xcopy ..\samples-aux\vs2013\copy_to_bin64_dir\*.* .\bin\Debug\ /E /Y
xcopy ..\samples-aux\vs2013\copy_to_bin64_dir\*.* .\bin\Release\ /E /Y
xcopy ..\samples-aux\vs2013\copy_to_bin64_dir\*.* .\bin\RelWithDebInfo\ /E /Y
echo Done!

:end
cd ..

Remove extra space in project gen script


@ECHO off

:: ### Prepare the Command Processor
SETLOCAL ENABLEEXTENSIONS
SETLOCAL ENABLEDELAYEDEXPANSION

:: ### Version History - x.y.z_<timestamp YYYYMMDD-hhmm> Author Description
:: !! For a new version entry, copy the last entry down and modify Date, Author and Description
SET version=1.0.0_20151210-1042 &: Peter Kirschner   initial version of the script

SET version=%version: =%
SET title=%~nx0 - version %version%
TITLE %title%

:: ### default variables
SET prgPath=%~dp0
SET prgPath=%prgPath:~0,-1%

SET DOWNLOAD=^
	%prgPath%\download

SET EXECUTABLE=^
	%prgPath%\org.eclipse.oomph.setup.installer.product-win32.win32.x86_64\*^
	%prgPath%\.eclipse

::	%prgPath%\.p2

SET INSTALLED_ARTIFACTS=^
	%prgPath%\oomphInstaller^
	%prgPath%\install^
	%prgPath%\wrkspc^
    %prgPath%\oomph

SET LOCAL_OOMPH_PREFS=^
	%USERPROFILE%\.eclipse\org.eclipse.oomph.setup.installer^
	%USERPROFILE%\.eclipse\org.eclipse.oomph.jreinfo^
	%USERPROFILE%\.eclipse\org.eclipse.oomph.p2^
	%USERPROFILE%\.eclipse\org.eclipse.oomph.setup^
	%prgPath%\org.eclipse.oomph.setup.installer.product-win32.win32.x86_64\configuration\org.eclipse.core.runtime^
	%prgPath%\org.eclipse.oomph.setup.installer.product-win32.win32.x86_64\configuration\org.eclipse.equinox.app^
	%prgPath%\org.eclipse.oomph.setup.installer.product-win32.win32.x86_64\configuration\org.eclipse.equinox.launcher^
	%prgPath%\org.eclipse.oomph.setup.installer.product-win32.win32.x86_64\configuration\org.eclipse.osgi

SET "DELETE_PATTERNS=%DOWNLOAD% %EXECUTABLE% %INSTALLED_ARTIFACTS% %LOCAL_OOMPH_PREFS%"

ECHO.
ECHO # start cleaning
ECHO.

ECHO # delete all patterns for directories
ECHO.
FOR %%d IN (%DELETE_PATTERNS%) DO ECHO execute RMDIR /Q /S "%%d" & RMDIR /Q /S "%%d" > NUL 2>&1

ECHO # delete all patterns for files
ECHO.
FOR %%f IN (%DELETE_PATTERNS%) DO ECHO execute DEL /Q /S /F "%%f" & DEL /Q /S /F "%%f" > NUL 2>&1

ECHO cleanup completed

@ECHO off

:: ### Prepare the Command Processor
SETLOCAL ENABLEEXTENSIONS
SETLOCAL ENABLEDELAYEDEXPANSION

:: ### Version History - x.y.z_<timestamp YYYYMMDD-hhmm> Author Description
:: !! For a new version entry, copy the last entry down and modify Date, Author and Description
SET version=1.0.0_20151210-1042 &: Peter Kirschner   initial version of the script

SET version=%version: =%
SET title=%~nx0 - version %version%
TITLE %title%

:: ### default variables
SET prgPath=%~dp0
SET prgPath=%prgPath:~0,-1%

SET DOWNLOAD=^
	%prgPath%\download

SET EXECUTABLE=^
	%prgPath%\org.eclipse.oomph.setup.installer.product-win32.win32.x86_64\*^
	%prgPath%\.eclipse

::	%prgPath%\.p2

SET INSTALLED_ARTIFACTS=^
	%prgPath%\idefixInstaller^
	%prgPath%\install^
	%prgPath%\wrkspc^
    %prgPath%\oomph

SET LOCAL_OOMPH_PREFS=^
	%USERPROFILE%\.eclipse\org.eclipse.oomph.setup.installer^
	%USERPROFILE%\.eclipse\org.eclipse.oomph.jreinfo^
	%USERPROFILE%\.eclipse\org.eclipse.oomph.p2^
	%USERPROFILE%\.eclipse\org.eclipse.oomph.setup^
	%prgPath%\org.eclipse.oomph.setup.installer.product-win32.win32.x86_64\configuration\org.eclipse.core.runtime^
	%prgPath%\org.eclipse.oomph.setup.installer.product-win32.win32.x86_64\configuration\org.eclipse.equinox.app^
	%prgPath%\org.eclipse.oomph.setup.installer.product-win32.win32.x86_64\configuration\org.eclipse.equinox.launcher^
	%prgPath%\org.eclipse.oomph.setup.installer.product-win32.win32.x86_64\configuration\org.eclipse.osgi

SET "DELETE_PATTERNS=%DOWNLOAD% %EXECUTABLE% %INSTALLED_ARTIFACTS% %LOCAL_OOMPH_PREFS%"

ECHO.
ECHO # start cleaning
ECHO.

ECHO # delete all patterns for directories
ECHO.
FOR %%d IN (%DELETE_PATTERNS%) DO ECHO execute RMDIR /Q /S "%%d" & RMDIR /Q /S "%%d" > NUL 2>&1

ECHO # delete all patterns for files
ECHO.
FOR %%f IN (%DELETE_PATTERNS%) DO ECHO execute DEL /Q /S /F "%%f" & DEL /Q /S /F "%%f" > NUL 2>&1

ECHO cleanup completed

rework setup models

rework setup models


git init
touch README.md
git add README.md
git add .gitignore
git commit -m"initial commit"
cd external
git submodule add --depth 1 -- https://github.com/fmtlib/fmt.git
git submodule add --depth 1 -- https://github.com/gabime/spdlog.git
git submodule add --depth 1 -- https://github.com/onqtam/doctest.git
cd ..

git init
touch README.md
git add README.md
git add .gitignore
git commit -m"initial commit"
cd external
rmdir fmt
git submodule add --depth 1 -- https://github.com/fmtlib/fmt.git
rmdir spdlog
git submodule add --depth 1 -- https://github.com/gabime/spdlog.git
rmdir doctest
git submodule add --depth 1 -- https://github.com/onqtam/doctest.git
cd ..

Remove empty external dirs if present

Remove empty external dirs if present


set PYTHONPATH=.
python -c "import conda_build; assert conda_build.__version__ == 'tag: 1.8.1'"

Add a bld.bat to the source_url test recipe


@echo off
setlocal enableextensions enabledelayedexpansion

:: Script to build RStudio Desktop for Windows using Docker
::
:: Requires a Windows machine, with Docker installed and set to use Windows
:: containers, and the RStudio repo cloned onto the machine. Then simply execute
:: this script from a command prompt in rstudio\docker directory.
::
:: For best reproduction of an official build use a pristine repo containing no
:: previous local builds or installed dependencies. For example you could use
:: git clean -ffdx.
::
:: Reason: The entire repo is copied into the container on each run (see comment
:: later in this script on why this is).

set IMAGE=windows
set FLAVOR=desktop

REM set destination folder
set PKG_DIR="%cd%"\package
if not exist %PKG_DIR% (
    md %PKG_DIR%
)

REM move to the repo root (script's parent directory)
cd %~dp0\..

REM determine repo name
set CURRENTDIR="%cd%"
for /F "delims=" %%i in ("%cd%") do set REPO=%%~nxi

REM check to see if there's already a built image
set TEMPFILE=%TEMP%\docker-compile~%RANDOM%.txt
docker images %REPO%:%IMAGE% --format "{{.ID}}" > %TEMPFILE%
set /p IMAGEID= < %TEMPFILE%
del %TEMPFILE%
if DEFINED IMAGEID (
    echo Found image %IMAGEID% for %REPO%:%IMAGE%.
) else (
    echo No image found for %REPO%:%IMAGE%.
)

REM get build arg env vars, if any
if defined DOCKER_GITHUB_LOGIN (
    set "BUILD_ARGS=--build-arg GITHUB_LOGIN=%DOCKER_GITHUB_LOGIN%"
    echo "!BUILD_ARGS!"
)

REM rebuild the image if necessary
docker build --tag %REPO%:%IMAGE% --file docker\jenkins\Dockerfile.%IMAGE% %BUILD_ARGS% -m 2GB .\docker\jenkins

REM set up build flags
git rev-parse HEAD > %TEMPFILE%
set /p GIT_COMMIT= < %TEMPFILE%
del %TEMPFILE%
set BUILD_ID=local

REM infer make parallelism
set "MAKEFLAGS=-j%NUMBER_OF_PROCESSORS%"

REM remove previous image if it exists
set CONTAINER_ID=build-%REPO%-%IMAGE%
echo Cleaning up container %CONTAINER_ID% if it exists...
docker rm %CONTAINER_ID%

for %%A in ("%cd%") do set HOSTPATH=%%~sA

echo Creating container %CONTAINER_ID%...
docker create -i --name %CONTAINER_ID% %REPO%:%IMAGE% cmd.exe

:: Copy sources into the container; a volume mount doesn't work due to problems with the
:: MSVC toolchain used by RStudio: https://github.com/docker/for-win/issues/829
::
:: This issue is apparently fixed in latest MSVC 2019 so can reevaluate this approach when
:: we update to newer toolchain and use -v %HOSTPATH%:c:/src instead of copying repo.
::
:: A volume mount does work when using "--isolation process" but this Docker option isn't
:: available with Windows-10 Pro, only with Windows Server.
echo Copying repo into container...
docker cp %HOSTPATH% %CONTAINER_ID%:/src

echo Starting container...
docker start %CONTAINER_ID%

echo Installing dependencies...
docker exec %CONTAINER_ID% cmd.exe /C "cd \src\dependencies\windows && set RSTUDIO_SKIP_QT=1 && install-dependencies.cmd"

echo Building RStudio...
docker exec %CONTAINER_ID% cmd.exe /C "cd \src\package\win32 && make-package.bat clean"

echo Stopping container...
docker stop %CONTAINER_ID%

set PKG_FILENAME=RStudio-99.9.9-RelWithDebInfo
echo Copying build result (%PKG_FILENAME%.zip) to %HOSTPATH%/docker/package
docker cp %CONTAINER_ID%:/src/package/win32/build/%PKG_FILENAME%.zip %HOSTPATH%/docker/package/%PKG_FILENAME%.zip

echo Copying build result (%PKG_FILENAME%.exe) to %HOSTPATH%/docker/package
docker cp %CONTAINER_ID%:/src/package/win32/build/%PKG_FILENAME%.exe %HOSTPATH%/docker/package/%PKG_FILENAME%.exe

@echo off
setlocal enableextensions enabledelayedexpansion

:: Script to build RStudio Desktop for Windows using Docker
::
:: Requires a Windows machine, with Docker installed and set to use Windows
:: containers, and the RStudio repo cloned onto the machine. Then simply execute
:: this script from a command prompt in rstudio\docker directory.
::
:: For best reproduction of an official build use a pristine repo containing no
:: previous local builds or installed dependencies. For example you could use
:: git clean -ffdx.
::
:: Reason: The entire repo is copied into the container on each run (see comment
:: later in this script on why this is).

set IMAGE=windows
set FLAVOR=desktop

REM set destination folder
set PKG_DIR="%cd%"\package
if not exist %PKG_DIR% (
    md %PKG_DIR%
)

REM move to the repo root (script's parent directory)
cd %~dp0\..

REM determine repo name
set CURRENTDIR="%cd%"
for /F "delims=" %%i in ("%cd%") do set REPO=%%~nxi

REM check to see if there's already a built image
set TEMPFILE=%TEMP%\docker-compile~%RANDOM%.txt
docker images %REPO%:%IMAGE% --format "{{.ID}}" > %TEMPFILE%
set /p IMAGEID= < %TEMPFILE%
del %TEMPFILE%
if DEFINED IMAGEID (
    echo Found image %IMAGEID% for %REPO%:%IMAGE%.
) else (
    echo No image found for %REPO%:%IMAGE%.
)

REM get build arg env vars, if any
if defined DOCKER_GITHUB_LOGIN (
    set "BUILD_ARGS=--build-arg GITHUB_LOGIN=%DOCKER_GITHUB_LOGIN%"
    echo "!BUILD_ARGS!"
)

REM rebuild the image if necessary
docker build --tag %REPO%:%IMAGE% --file docker\jenkins\Dockerfile.%IMAGE% %BUILD_ARGS% -m 2GB .\docker\jenkins

REM set up build flags
git rev-parse HEAD > %TEMPFILE%
set /p GIT_COMMIT= < %TEMPFILE%
del %TEMPFILE%
set BUILD_ID=local

REM infer make parallelism
set "MAKEFLAGS=-j%NUMBER_OF_PROCESSORS%"

REM remove previous image if it exists
set CONTAINER_ID=build-%REPO%-%IMAGE%
echo Cleaning up container %CONTAINER_ID% if it exists...
docker rm %CONTAINER_ID%

for %%A in ("%cd%") do set HOSTPATH=%%~sA

echo Creating container %CONTAINER_ID%...
docker create -i --name %CONTAINER_ID% %REPO%:%IMAGE% cmd.exe

:: Copy sources into the container; a volume mount doesn't work due to problems with the
:: MSVC toolchain used by RStudio: https://github.com/docker/for-win/issues/829
::
:: This issue is apparently fixed in latest MSVC 2019 so can reevaluate this approach when
:: we update to newer toolchain and use -v %HOSTPATH%:c:/src instead of copying repo.
::
:: A volume mount does work when using "--isolation process" but this Docker option isn't
:: available with Windows-10 Pro, only with Windows Server.
echo Copying repo into container...
docker cp %HOSTPATH% %CONTAINER_ID%:/src

echo Starting container...
docker start %CONTAINER_ID%

echo Installing dependencies...
docker exec %CONTAINER_ID% cmd.exe /C "cd \src\dependencies\windows && set RSTUDIO_SKIP_QT=1 && install-dependencies.cmd"

echo Building RStudio...
docker exec %CONTAINER_ID% cmd.exe /C "cd \src\package\win32 && make-package.bat clean"

echo Stopping container...
docker stop %CONTAINER_ID%

if "%REPO%" == "rstudio-pro" (
    set PKG_FILENAME=RStudio-pro-99.9.9-RelWithDebInfo
) ELSE (
    set PKG_FILENAME=RStudio-99.9.9-RelWithDebInfo
)
echo Copying build result (%PKG_FILENAME%.zip) to %HOSTPATH%/docker/package
docker cp %CONTAINER_ID%:/src/package/win32/build/%PKG_FILENAME%.zip %HOSTPATH%/docker/package/%PKG_FILENAME%.zip

echo Copying build result (%PKG_FILENAME%.exe) to %HOSTPATH%/docker/package
docker cp %CONTAINER_ID%:/src/package/win32/build/%PKG_FILENAME%.exe %HOSTPATH%/docker/package/%PKG_FILENAME%.exe

tweak win-docker-compile script to also work with Desktop Pro building


:: Copyright 2018 The Outline Authors
::
:: Licensed under the Apache License, Version 2.0 (the "License");
:: you may not use this file except in compliance with the License.
:: You may obtain a copy of the License at
::
::      http://www.apache.org/licenses/LICENSE-2.0
::
:: Unless required by applicable law or agreed to in writing, software
:: distributed under the License is distributed on an "AS IS" BASIS,
:: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
:: See the License for the specific language governing permissions and
:: limitations under the License.

@echo off

set DEVICE_NAME=outline-tap0
set DEVICE_HWID=tap0901

:: Check whether the device already exists.
netsh interface show interface name=%DEVICE_NAME% >nul
if %errorlevel% equ 0 (
  echo %DEVICE_NAME% already exists.
  exit /b
)

:: Add the device, recording the names of devices before and after to help
:: us find the name of the new device.
::
:: Note:
::  - While we could limit the search to devices having ServiceName=%DEVICE_HWID%,
::    that will cause wmic to output just "no instances available" when there
::    are no other TAP devices present, messing up the diff.
::  - We do not use findstr, etc., to strip blank lines because those ancient tools
::    typically don't understand/output non-Latin characters (wmic *does*, even on
::    Windows 7).
set BEFORE_DEVICES=%tmp%\outlineinstaller-tap-devices-before.txt
set AFTER_DEVICES=%tmp%\outlineinstaller-tap-devices-after.txt

echo Storing current network device list...
wmic nic where "netconnectionid is not null" get netconnectionid > "%BEFORE_DEVICES%"
if %errorlevel% neq 0 (
  echo Could not store network device list. >&2
  exit /b 1
)
type "%BEFORE_DEVICES%"

echo Creating TAP network device...
tap-windows6\tapinstall install tap-windows6\OemVista.inf %DEVICE_HWID%
if %errorlevel% neq 0 (
  echo Could not create TAP network device. >&2
  exit /b 1
)
echo Storing new network device list...
wmic nic where "netconnectionid is not null" get netconnectionid > "%AFTER_DEVICES%"
if %errorlevel% neq 0 (
  echo Could not store network device list. >&2
  exit /b 1
)
type "%AFTER_DEVICES%"

:: Find the name of the new device and rename it.
::
:: Obviously, this command is a beast; roughly what it does, in this order, is:
::  - perform a diff on the *trimmed* (in case wmic uses different column widths) before and after
::    text files
::  - remove leading/trailing space and blank lines with trim()
::  - store the result in NEW_DEVICE
::  - print NEW_DEVICE, for debugging (though non-Latin characters may appear as ?)
::  - invoke netsh
::
:: Running all this in one go helps reduce the need to deal with temporary
:: files and the character encoding headaches that follow.
::
:: Note that we pipe input from /dev/null to prevent Powershell hanging forever
:: waiting on EOF.
echo Searching for new TAP network device name...
powershell "(compare-object (cat \"%BEFORE_DEVICES%\" | foreach-object {$_.trim()}) (cat \"%AFTER_DEVICES%\" | foreach-object {$_.trim()}) | format-wide -autosize | out-string).trim() | set-variable NEW_DEVICE; write-host \"New TAP device name: ${NEW_DEVICE}\"; netsh interface set interface name = \"${NEW_DEVICE}\" newname = \"%DEVICE_NAME%\"" <nul
if %errorlevel% neq 0 (
  echo Could not find or rename new TAP network device. >&2
  exit /b 1
)

:: We've occasionally seen delays before netsh will "see" the new device, at least for
:: purposes of configuring IP and DNS ("netsh interface show interface name=xxx" does not
:: seem to be affected).
echo Testing that the new TAP network device is visible to netsh...
netsh interface show interface name=%DEVICE_NAME% >nul
if %errorlevel% equ 0 goto :configure

:loop
echo waiting...
timeout /t 1 >nul
netsh interface show interface name=%DEVICE_NAME% >nul
if %errorlevel% neq 1 goto :loop

:configure
echo Configuring new TAP network device...

:: Give the device an IP address.
:: 10.0.85.x is a guess which we hope will work for most users (Docker for
:: Windows uses 10.0.75.x by default): if the address is already in use the
:: script will fail and the installer will show an error message to the user.
:: TODO: Actually search the system for an unused subnet or make the subnet
::       configurable in the Outline client.
netsh interface ip set address %DEVICE_NAME% static 10.0.85.2 255.255.255.0
if %errorlevel% neq 0 (
  echo Could not set TAP network device subnet. >&2
  exit /b 1
)

:: Windows has no system-wide DNS server; each network device can have its
:: "own" set of DNS servers. Windows seems to use the DNS server(s) of the
:: network device associated with the default gateway. This is good for us
:: as it means we do not have to modify the DNS settings of any other network
:: device in the system. Configure with OpenDNS and Dyn resolvers.
netsh interface ip set dnsservers %DEVICE_NAME% static address=208.67.222.222
if %errorlevel% neq 0 (
  echo Could not configure TAP device primary DNS. >&2
  exit /b 1
)
netsh interface ip add dnsservers %DEVICE_NAME% 216.146.35.35 index=2
if %errorlevel% neq 0 (
  echo Could not configure TAP device secondary DNS. >&2
  exit /b 1
)

:: Copyright 2018 The Outline Authors
::
:: Licensed under the Apache License, Version 2.0 (the "License");
:: you may not use this file except in compliance with the License.
:: You may obtain a copy of the License at
::
::      http://www.apache.org/licenses/LICENSE-2.0
::
:: Unless required by applicable law or agreed to in writing, software
:: distributed under the License is distributed on an "AS IS" BASIS,
:: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
:: See the License for the specific language governing permissions and
:: limitations under the License.

@echo off

set DEVICE_NAME=outline-tap0
set DEVICE_HWID=tap0901

:: Check whether the device already exists.
netsh interface show interface name=%DEVICE_NAME% >nul
if %errorlevel% equ 0 (
  echo %DEVICE_NAME% already exists.
  exit /b
)

:: Add the device, recording the names of devices before and after to help
:: us find the name of the new device.
::
:: Note:
::  - While we could limit the search to devices having ServiceName=%DEVICE_HWID%,
::    that will cause wmic to output just "no instances available" when there
::    are no other TAP devices present, messing up the diff.
::  - We do not use findstr, etc., to strip blank lines because those ancient tools
::    typically don't understand/output non-Latin characters (wmic *does*, even on
::    Windows 7).
set BEFORE_DEVICES=%tmp%\outlineinstaller-tap-devices-before.txt
set AFTER_DEVICES=%tmp%\outlineinstaller-tap-devices-after.txt

echo Storing current network device list...
wmic nic where "netconnectionid is not null" get netconnectionid > "%BEFORE_DEVICES%"
if %errorlevel% neq 0 (
  echo Could not store network device list. >&2
  exit /b 1
)
type "%BEFORE_DEVICES%"

echo Creating TAP network device...
tap-windows6\tapinstall install tap-windows6\OemVista.inf %DEVICE_HWID%
if %errorlevel% neq 0 (
  echo Could not create TAP network device. >&2
  exit /b 1
)
echo Storing new network device list...
wmic nic where "netconnectionid is not null" get netconnectionid > "%AFTER_DEVICES%"
if %errorlevel% neq 0 (
  echo Could not store network device list. >&2
  exit /b 1
)
type "%AFTER_DEVICES%"

:: Find the name of the new device and rename it.
::
:: Obviously, this command is a beast; roughly what it does, in this order, is:
::  - perform a diff on the *trimmed* (in case wmic uses different column widths) before and after
::    text files
::  - remove leading/trailing space and blank lines with trim()
::  - store the result in NEW_DEVICE
::  - print NEW_DEVICE, for debugging (though non-Latin characters may appear as ?)
::  - invoke netsh
::
:: Running all this in one go helps reduce the need to deal with temporary
:: files and the character encoding headaches that follow.
::
:: Note that we pipe input from /dev/null to prevent Powershell hanging forever
:: waiting on EOF.
echo Searching for new TAP network device name...
powershell "(compare-object (cat \"%BEFORE_DEVICES%\" | foreach-object {$_.trim()}) (cat \"%AFTER_DEVICES%\" | foreach-object {$_.trim()}) | format-wide -autosize | out-string).trim() | set-variable NEW_DEVICE; write-host \"New TAP device name: ${NEW_DEVICE}\"; netsh interface set interface name = \"${NEW_DEVICE}\" newname = \"%DEVICE_NAME%\"" <nul
if %errorlevel% neq 0 (
  echo Could not find or rename new TAP network device. >&2
  exit /b 1
)

:: We've occasionally seen delays before netsh will "see" the new device, at least for
:: purposes of configuring IP and DNS ("netsh interface show interface name=xxx" does not
:: seem to be affected).
echo Testing that the new TAP network device is visible to netsh...
netsh interface ip show interfaces | find "%DEVICE_NAME%" >nul
if %errorlevel% equ 0 goto :configure

:loop
echo waiting...
timeout /t 10 >nul
netsh interface ip show interfaces | find "%DEVICE_NAME%" >nul
if %errorlevel% neq 0 goto :loop

:configure
echo Configuring new TAP network device...

:: Give the device an IP address.
:: 10.0.85.x is a guess which we hope will work for most users (Docker for
:: Windows uses 10.0.75.x by default): if the address is already in use the
:: script will fail and the installer will show an error message to the user.
:: TODO: Actually search the system for an unused subnet or make the subnet
::       configurable in the Outline client.
netsh interface ip set address %DEVICE_NAME% static 10.0.85.2 255.255.255.0
if %errorlevel% neq 0 (
  echo Could not set TAP network device subnet. >&2
  exit /b 1
)

:: Windows has no system-wide DNS server; each network device can have its
:: "own" set of DNS servers. Windows seems to use the DNS server(s) of the
:: network device associated with the default gateway. This is good for us
:: as it means we do not have to modify the DNS settings of any other network
:: device in the system. Configure with OpenDNS and Dyn resolvers.
netsh interface ip set dnsservers %DEVICE_NAME% static address=208.67.222.222
if %errorlevel% neq 0 (
  echo Could not configure TAP device primary DNS. >&2
  exit /b 1
)
netsh interface ip add dnsservers %DEVICE_NAME% 216.146.35.35 index=2
if %errorlevel% neq 0 (
  echo Could not configure TAP device secondary DNS. >&2
  exit /b 1
)

fix 338

fix 338

(finally, i hope)
* change `netsh interface show interface name=xxx` to `netsh interface ip show interfaces | find "%DEVICE_NAME%"` because ` netsh interface show interface name=xxx` doesn't have delay
* increase timeout
* fix check for error level


:: Script that takes either a single .pdb file or a directory
:: that contains .pdb files (search for files is recursive).
::
:: Parses each .pdb file and creates a corresponding .pdb.xml
:: file in the same location as the original file.
::
:: The .pdb.xml files can be used to apply debugging information
:: when running Ghidra on non-Windows systems.

@echo off
setlocal

REM Get parent of current folder
set "SCRIPT_DIR=%~dp0"

set "GHIDRA_DIR=%SCRIPT_DIR%..\Ghidra"
set OS_DIR=os

REM Production Environment
if exist "%GHIDRA_DIR%" goto continue

REM Development Environment
set "GHIDRA_DIR=%SCRIPT_DIR%..\..\.."
set OS_DIR=build\os

:continue

REM create absolute path
for /f "delims=" %%i in ("%GHIDRA_DIR%") do set GHIDRA_DIR=%%~fi

REM Determine if 64-bit or 32-bit
if exist "%PROGRAMFILES(X86)%" (
	set OS_TYPE=win_x86_64
) else (
	set OS_TYPE=win32
)

set "PDB_EXE=%GHIDRA_DIR%\Features\PDB\%OS_DIR%\%OS_TYPE%\pdb.exe"

if not exist "%PDB_EXE%" (
	echo "%PDB_EXE% not found"
	Exit /B 1
)

if "%~1" == "" (
	echo "Usage: createPdbXmlFiles.bat <path to .pdb file|path to directory of .pdb files>"
	Exit /B 1
)

set arg1="%~1"

set /a count=0

REM Recursively traverse through the given directory
REM Create the .pdb.xml file in the same directory as the .pdb file
for /f "tokens=* delims=" %%a in ('dir %arg1% /s /b') do (

	REM Check if we are dealing with a file
	if not exist %%a\ (

		REM Run pdb.exe on found .pdb file
		if %%~xa equ .pdb (

			setlocal enableDelayedExpansion
			(
				echo "Processing file: %%a"
				START /B /WAIT "" "%PDB_EXE%" "%%a" > "%%a.xml"

				REM Exit if executable returned non-zero error code (signifies that there is a problem).
				if !errorlevel! neq 0 (
					REM Delete empty XML file that was just created
					del "%%a.xml"

					if !count! geq 1 (
						echo "Error detected. Created !count! .pdb.xml file(s) before exiting"
					) else (
						echo Error detected. Exiting...
					)

					Exit /B 1
				)
			)

			set /a count+=1
		)
	)
)

echo Created %count% .pdb.xml file(s).

:: Script that takes either a single .pdb file or a directory
:: that contains .pdb files (search for files is recursive).
::
:: Parses each .pdb file and creates a corresponding .pdb.xml
:: file in the same location as the original file.
::
:: The .pdb.xml files can be used to apply debugging information
:: when running Ghidra on non-Windows systems.

@echo off
setlocal

REM Get parent of current folder
set "SCRIPT_DIR=%~dp0"

set "GHIDRA_DIR=%SCRIPT_DIR%..\Ghidra"
set OS_DIR=os

REM Production Environment
if exist "%GHIDRA_DIR%" goto continue

REM Development Environment
set "GHIDRA_DIR=%SCRIPT_DIR%..\..\.."
set OS_DIR=build\os

:continue

REM create absolute path
for /f "delims=" %%i in ("%GHIDRA_DIR%") do set GHIDRA_DIR=%%~fi

set "PDB_EXE=%GHIDRA_DIR%\Features\PDB\%OS_DIR%\win_x86_64\pdb.exe"

if not exist "%PDB_EXE%" (
	echo "%PDB_EXE% not found"
	Exit /B 1
)

if "%~1" == "" (
	echo "Usage: createPdbXmlFiles.bat <path to .pdb file|path to directory of .pdb files>"
	Exit /B 1
)

set arg1="%~1"

set /a count=0

REM Recursively traverse through the given directory
REM Create the .pdb.xml file in the same directory as the .pdb file
for /f "tokens=* delims=" %%a in ('dir %arg1% /s /b') do (

	REM Check if we are dealing with a file
	if not exist %%a\ (

		REM Run pdb.exe on found .pdb file
		if %%~xa equ .pdb (

			setlocal enableDelayedExpansion
			(
				echo "Processing file: %%a"
				START /B /WAIT "" "%PDB_EXE%" "%%a" > "%%a.xml"

				REM Exit if executable returned non-zero error code (signifies that there is a problem).
				if !errorlevel! neq 0 (
					REM Delete empty XML file that was just created
					del "%%a.xml"

					if !count! geq 1 (
						echo "Error detected. Created !count! .pdb.xml file(s) before exiting"
					) else (
						echo Error detected. Exiting...
					)

					Exit /B 1
				)
			)

			set /a count+=1
		)
	)
)

echo Created %count% .pdb.xml file(s).

remove check for OS architecture in createPdbXmlFiles.bat

due to removal of 32-bit support it's no longer needed to check for OS
type.


%~d0
cd %~p0
play
eclipse with-source=true

Create play_setup.bat

Create play_setup.bat


::
:: Licensed under the Apache License, Version 2.0 (the "License");
:: you may not use this file except in compliance with the License.
:: You may obtain a copy of the License at
::
::     http://www.apache.org/licenses/LICENSE-2.0
::
:: Unless required by applicable law or agreed to in writing, software
:: distributed under the License is distributed on an "AS IS" BASIS,
:: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
:: See the License for the specific language governing permissions and
:: limitations under the License.
::

       IF "%PROFILE%" == "MSVC2010" (
  CALL "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat" %PLATFORM%
) ELSE IF "%PROFILE%" == "MSVC2012" (
  CALL "C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\vcvarsall.bat" %PLATFORM%
) ELSE IF "%PROFILE%" == "MSVC2013" (
  CALL "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" %PLATFORM%
) ELSE IF "%PROFILE%" == "MSVC2015" (
  CALL "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" %PLATFORM%
) ELSE IF "%PROFILE%" == "MSVC2017" (
  CALL "C:\Program Files (x86)\Microsoft Visual Studio 15.0\VC\vcvarsall.bat" %PLATFORM%
) ELSE IF "%PROFILE%" == "MINGW" (
  SET MSYS2_PATH_TYPE=stock
) ELSE IF "%PROFILE%" == "MSYS" (
  SET MSYS2_PATH_TYPE=stock
) ELSE (
  ECHO Unsupported PROFILE=%PROFILE% or PLATFORM=%PLATFORM%
  EXIT /B 1
)

CALL cl_setcompiler.bat   || EXIT /B
CALL cl_setgenerator.bat  || EXIT /B

SET APPVEYOR_SCRIPTS=%APPVEYOR_BUILD_FOLDER%\build\appveyor
SET BUILDCACHE=%APPVEYOR_BUILD_FOLDER%\buildcache
SET BUILDDIR=%APPVEYOR_BUILD_FOLDER%\local-thrift-build
SET INSTDIR=%APPVEYOR_BUILD_FOLDER%\local-thrift-inst
SET SRCDIR=%APPVEYOR_BUILD_FOLDER%

: PLATFORM is x64 or x86, but we want x86 to become "32" when we strip it down for paths:
SET NORM_PLATFORM=%PLATFORM:~-2,2%
IF "%NORM_PLATFORM%" == "86" (SET NORM_PLATFORM=32)

SET BOOST_ROOT=C:\Libraries\boost_%BOOST_VERSION:.=_%
SET BOOST_LIBRARYDIR=%BOOST_ROOT%\lib%NORM_PLATFORM%-msvc-%COMPILER:~-3,2%.0
SET OPENSSL_ROOT=C:\OpenSSL-Win%NORM_PLATFORM%
SET WIN3P=%APPVEYOR_BUILD_FOLDER%\thirdparty

:: MSVC2010 doesn't "do" std::thread
IF "%COMPILER%" == "vc100" (
  SET THREADMODEL=BOOST
) ELSE (
  SET THREADMODEL=STD
)

IF "%PYTHON_VERSION%" == "" (
  SET WITH_PYTHON=OFF
) ELSE (
  SET WITH_PYTHON=ON
  SET PATH=C:\Python%PYTHON_VERSION:.=%\scripts;C:\Python%PYTHON_VERSION:.=%;!PATH!
)
IF "%CONFIGURATION%" == "Debug" (SET ZLIB_LIB_SUFFIX=d)

IF NOT "%QT_VERSION%" == "" (
  IF /i "%PLATFORM%" == "x64" SET QTEXT=_64
  SET PATH=C:\Qt\%QT_VERSION%\%PROFILE%!QTEXT!\bin;!PATH!
)

IF NOT "%PROFILE:~0,4%" == "MSVC" (

  SET BASH=C:\msys64\usr\bin\bash.exe
  SET BOOST_ROOT=
  SET BOOST_INCLUDEDIR=/mingw64/include
  SET BOOST_LIBRARYDIR=/mingw64/lib
  SET OPENSSL_LIBRARIES=/mingw64/lib
  SET OPENSSL_ROOT=/mingw64
  SET WIN3P=

  !BASH! -lc "sed -i '/export PATH=\/mingw64\/bin/d' ~/.bash_profile && echo 'export PATH=/mingw64/bin:$PATH' >> ~/.bash_profile" || EXIT /B

)

SET BUILDDIR_MSYS=%BUILDDIR:\=/%
SET BUILDDIR_MSYS=/c%BUILDDIR_MSYS:~2%
SET INSTDIR_MSYS=%INSTDIR:\=/%
SET INSTDIR_MSYS=/c%INSTDIR_MSYS:~2%
SET SRCDIR_MSYS=%SRCDIR:\=/%
SET SRCDIR_MSYS=/c%SRCDIR_MSYS:~2%

::
:: Licensed under the Apache License, Version 2.0 (the "License");
:: you may not use this file except in compliance with the License.
:: You may obtain a copy of the License at
::
::     http://www.apache.org/licenses/LICENSE-2.0
::
:: Unless required by applicable law or agreed to in writing, software
:: distributed under the License is distributed on an "AS IS" BASIS,
:: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
:: See the License for the specific language governing permissions and
:: limitations under the License.
::

       IF "%PROFILE%" == "MSVC2010" (
  CALL "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat" %PLATFORM%
) ELSE IF "%PROFILE%" == "MSVC2012" (
  CALL "C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\vcvarsall.bat" %PLATFORM%
) ELSE IF "%PROFILE%" == "MSVC2013" (
  CALL "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" %PLATFORM%
) ELSE IF "%PROFILE%" == "MSVC2015" (
  CALL "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" %PLATFORM%
) ELSE IF "%PROFILE%" == "MSVC2017" (
  CALL "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\Tools\VsDevCmd.bat" %PLATFORM%
) ELSE IF "%PROFILE%" == "MINGW" (
  SET MSYS2_PATH_TYPE=stock
) ELSE IF "%PROFILE%" == "MSYS" (
  SET MSYS2_PATH_TYPE=stock
) ELSE (
  ECHO Unsupported PROFILE=%PROFILE% or PLATFORM=%PLATFORM%
  EXIT /B 1
)

CALL cl_setcompiler.bat   || EXIT /B
CALL cl_setgenerator.bat  || EXIT /B

SET APPVEYOR_SCRIPTS=%APPVEYOR_BUILD_FOLDER%\build\appveyor
SET BUILDCACHE=%APPVEYOR_BUILD_FOLDER%\buildcache
SET BUILDDIR=%APPVEYOR_BUILD_FOLDER%\local-thrift-build
SET INSTDIR=%APPVEYOR_BUILD_FOLDER%\local-thrift-inst
SET SRCDIR=%APPVEYOR_BUILD_FOLDER%

: PLATFORM is x64 or x86, but we want x86 to become "32" when we strip it down for paths:
SET NORM_PLATFORM=%PLATFORM:~-2,2%
IF "%NORM_PLATFORM%" == "86" (SET NORM_PLATFORM=32)

:: FindBoost needs forward slashes so cmake doesn't see something as an escaped character
SET BOOST_ROOT=C:/Libraries/boost_%BOOST_VERSION:.=_%
SET BOOST_LIBRARYDIR=%BOOST_ROOT%/lib%NORM_PLATFORM%-msvc-%COMPILER:~-3,2%.0
SET OPENSSL_ROOT=C:\OpenSSL-Win%NORM_PLATFORM%
SET WIN3P=%APPVEYOR_BUILD_FOLDER%\thirdparty

:: MSVC2010 doesn't "do" std::thread
IF "%COMPILER%" == "vc100" (
  SET THREADMODEL=BOOST
) ELSE (
  SET THREADMODEL=STD
)

IF "%PYTHON_VERSION%" == "" (
  SET WITH_PYTHON=OFF
) ELSE (
  SET WITH_PYTHON=ON
  SET PATH=C:\Python%PYTHON_VERSION:.=%\scripts;C:\Python%PYTHON_VERSION:.=%;!PATH!
)
IF "%CONFIGURATION%" == "Debug" (SET ZLIB_LIB_SUFFIX=d)

IF NOT "%QT_VERSION%" == "" (
  IF /i "%PLATFORM%" == "x64" SET QTEXT=_64
  SET PATH=C:\Qt\%QT_VERSION%\%PROFILE%!QTEXT!\bin;!PATH!
)

IF NOT "%PROFILE:~0,4%" == "MSVC" (

  SET BASH=C:\msys64\usr\bin\bash.exe
  SET BOOST_ROOT=
  SET BOOST_INCLUDEDIR=/mingw64/include
  SET BOOST_LIBRARYDIR=/mingw64/lib
  SET OPENSSL_LIBRARIES=/mingw64/lib
  SET OPENSSL_ROOT=/mingw64
  SET WIN3P=

  !BASH! -lc "sed -i '/export PATH=\/mingw64\/bin/d' ~/.bash_profile && echo 'export PATH=/mingw64/bin:$PATH' >> ~/.bash_profile" || EXIT /B

)

SET BUILDDIR_MSYS=%BUILDDIR:\=/%
SET BUILDDIR_MSYS=/c%BUILDDIR_MSYS:~2%
SET INSTDIR_MSYS=%INSTDIR:\=/%
SET INSTDIR_MSYS=/c%INSTDIR_MSYS:~2%
SET SRCDIR_MSYS=%SRCDIR:\=/%
SET SRCDIR_MSYS=/c%SRCDIR_MSYS:~2%

THRIFT-4184: fix appveyor build issue with escaped character sequence in boost path

This closes #1259


:: Project API
::
:: This file is called whenever a user enters a project, such p999_Meindbender_Sync
::
:: Arguments:
::   %1: Path = Absolute path to projects
:: 	 %2: Name = Name of project
::   %3: \f02_prod
:: 	 %4: Silo = Parent directory name of assets
::
:: Variables:
::   %PROJECTDIR%: Absolute path to project directory
::
:: Example:
::   $ call _mkproject.bat %~dp0ProjectName assets

@echo off

if "%1"=="" goto :missing_projectdir
if not "%4"=="assets" (
  if not "%4"=="film" goto :missing_silo
)

if "%2"=="" goto :missing_name
if "%4"=="" goto :missing_silo

set PROJECTDIR=%1%2%3
:: This is a variable for the function back.bat.
set PROJECT=%1
set PROJECTNAME=%2

if not exist %PROJECTDIR% (
  echo Creating new project "%PROJECT%"..

  mkdir %PROJECTDIR%\assets
  mkdir %PROJECTDIR%\film
  rem etc..
)

:: Establish base directories for ls() and search() functions.
set MINDBENDER_ROOT=%PROJECTDIR%
set MINDBENDER_SILO=%4

pushd %PROJECTDIR%\%MINDBENDER_SILO%

:: Clear screen
cls

echo+
echo  ASSETS CATEGORY ---
echo+

:: List available assets, without their .bat suffix
setlocal enabledelayedexpansion
for %%i in (*.bat) do (
    set temp=%%i
    echo   !temp:.bat=!
)
endlocal

echo+
echo   1. Type first letters of asset category
echo   2. Press [TAB] to auto-complete
echo+
echo  --------------------------------------

goto :eof

:missing_name
   	echo ERROR: Missing FULLPATH
   	exit /b
:missing_projectdir
	exit /b
:missing_silo
    echo  Uh oh..
    echo    Specify either "assets" or "film"
    echo+
    echo  Example:
    set temp=%2
    echo    $ %temp% assets
    echo    $ %temp% film
    exit /b

echo+
echo Syntax: _mkproject FULLPATH SUBFOLDER

:: Project API
::
:: This file is called whenever a user enters a project, such p999_Meindbender_Sync
::
:: Arguments:
::   %1: Path = Absolute path to projects
:: 	 %2: Name = Name of project
::   %3: \f02_prod
:: 	 %4: Silo = Parent directory name of assets
::
:: Variables:
::   %PROJECTDIR%: Absolute path to project directory
::
:: Example:
::   $ call _mkproject.bat %~dp0ProjectName assets

@echo off

if "%1"=="" goto :missing_projectdir
if not "%4"=="assets" (
  if not "%4"=="film" goto :missing_silo
)

if "%2"=="" goto :missing_name
if "%4"=="" goto :missing_silo

set PROJECTDIR=%1%2%3
:: This is a variable for the function back.bat.
set PROJECT=%1
set PROJECTNAME=%2

if not exist %PROJECTDIR% (
  echo Creating new project "%PROJECT%"..

  mkdir %PROJECTDIR%\assets
  mkdir %PROJECTDIR%\film
  rem etc..
)

:: Establish base directories for ls() and search() functions.
set MINDBENDER_ROOT=%PROJECTDIR%
set MINDBENDER_SILO=%4

pushd %PROJECTDIR%\%MINDBENDER_SILO%

:: Clear screen
cls

echo+
echo    Active Project: %PROJECTNAME%
echo    You are in: %MINDBENDER_SILO%
echo+

:: List available assets, without their .bat suffix
setlocal enabledelayedexpansion
for %%i in (*.bat) do (
    set temp=%%i
    echo   !temp:.bat=!
)
endlocal

echo+
echo   1. Type first letters of asset category
echo   2. Press [TAB] to auto-complete
echo+
echo  --------------------------------------

goto :eof

:missing_name
   	echo ERROR: Missing FULLPATH
   	exit /b
:missing_projectdir
	exit /b
:missing_silo
    echo  Uh oh..
    echo    Specify either "assets" or "film"
    echo+
    echo  Example:
    set temp=%2
    echo    $ %temp% assets
    echo    $ %temp% film
    exit /b

echo+
echo Syntax: _mkproject FULLPATH SUBFOLDER

update of presentation text

update of presentation text


echo Extend drive C to maximum
echo select volume 0 >%TEMP%\extendC.txt
echo extend >>%TEMP%\extendC.txt
diskpart.exe /s %TEMP%\extendC.txt
set WORKDRIVE=C:

if exist %WinDir%\microsoft.net\framework\v4.0.30319 goto :have_net4
echo Ensuring .NET 4.0 is installed
@powershell -NoProfile -ExecutionPolicy unrestricted -Command "iex ((new-object net.webclient).DownloadString('https://raw.github.com/StefanScherer/arduino-ide/install/InstallNet4.ps1'))"
:have_net4
if "%ChocolateyInstall%x"=="x" set ChocolateyInstall=%SystemDrive%\Chocolatey
if exist %ChocolateyInstall% goto :have_chocolatey
echo Installing Chocolatey
@powershell -NoProfile -ExecutionPolicy unrestricted -Command "iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))" && SET PATH=%PATH%;%systemdrive%\chocolatey\bin
:have_chocolatey

where cinst
if ERRORLEVEL 1 goto set_chocolatey
goto inst
:set_chocolatey
set PATH=%PATH%;%ChocolateyInstall%\bin
:inst

call cinst wget

call cinst msysgit
where git
if ERRORLEVEL 1 call :addGitToUserPath
goto GIT_DONE
:addGitToUserPath
for /F "tokens=2* delims= " %%f IN ('reg query "HKCU\Environment" /v Path ^| findstr /i path') do set OLD_USER_PATH=%%g
reg add HKCU\Environment /v Path /d "%OLD_USER_PATH%;C:\Program Files (x86)\Git\cmd" /f
set PATH=%PATH%;C:\Program Files (x86)\Git\cmd
exit /b
:GIT_DONE

call C:\vagrant\scripts\install-packer-from-source.bat
goto packer_firewall

call cinst packer
where packer
if ERRORLEVEL 1 call :addPackerToUserPath
goto PACKER_DONE
:addPackerToUserPath
for /F "tokens=2* delims= " %%f IN ('reg query "HKCU\Environment" /v Path ^| findstr /i path') do set OLD_USER_PATH=%%g
reg add HKCU\Environment /v Path /d "%OLD_USER_PATH%;C:\hashicorp\packer" /f
set PATH=%PATH%;C:\hashicorp\packer
exit /b
:PACKER_DONE
call cinst packer-post-processor-vagrant-vmware-ovf

:packer_firewall
netsh advfirewall firewall add rule name="packer-builder-vmware-iso" dir=in program="c:\HashiCorp\packer\packer-builder-vmware-iso.exe" action=allow
netsh advfirewall firewall add rule name="packer-builder-virtualbox-iso" dir=in program="c:\HashiCorp\packer\packer-builder-virtualbox-iso.exe" action=allow
netsh advfirewall firewall add rule name="packer-builder-vmware-iso" dir=in program="c:\Users\vagrant\go\bin\packer-builder-vmware-iso.exe" action=allow
netsh advfirewall firewall add rule name="packer-builder-virtualbox-iso" dir=in program="c:\Users\vagrant\go\bin\packer-builder-virtualbox-iso.exe" action=allow

if exist c:\hashicorp\vagrant goto :have_vagrant
echo Installing Vagrant ...
call cinst vagrant
set PATH=%PATH%;C:\hashicorp\vagrant\bin
:have_vagrant
echo Installing vagrant-vcloud plugin ...
vagrant plugin install vagrant-vcloud
if exist C:\Users\vagrant\.vagrant.d\Vagrantfile goto :have_vagrantfile
if exist C:\vagrant\resources\Vagrantfile-global (
  copy C:\vagrant\resources\Vagrantfile-global C:\Users\vagrant\.vagrant.d\Vagrantfile
)
:have_vagrantfile
if exist C:\HashiCorp\Vagrant\embedded\gems\gems\vagrant-1.6.3\plugins\hosts\windows\cap\rdp.rb (
  echo Patching Vagrant 1.6.3
  copy /Y C:\vagrant\scripts\rdp.rb C:\HashiCorp\Vagrant\embedded\gems\gems\vagrant-1.6.3\plugins\hosts\windows\cap\rdp.rb
)

rem Install VMware Workstation
if not exist "c:\Program Files (x86)\VMware\VMware Workstation" (
  if not exist "%TEMP%\VMware-workstation.exe" (
    echo Downloading VMware Workstation...
    call wget --no-verbose --no-check-certificate -O "%TEMP%\VMware-workstation.exe" http://www.vmware.com/go/tryworkstation-win
  )
  echo Install VMware Workstation...
  rem "%TEMP%\VMware-workstation.exe" /s /nsr /v EULAS_AGREED=1 SERIALNUMBER="xxxxx-xxxxx-xxxxx-xxxxx-xxxxx"
  "%TEMP%\VMware-workstation.exe" /s /nsr /v EULAS_AGREED=1
  del "%TEMP%\VMware-workstation.exe"
)

rem put ovftool in path (not necessary for packer, but for jenkins test-box-vcloud.bat)
where ovftool
if ERRORLEVEL 1 call :addOvfToolToUserPath
goto OVFTOOL_DONE
:addOvfToolToUserPath
for /F "tokens=2* delims= " %%f IN ('reg query "HKCU\Environment" /v Path ^| findstr /i path') do set OLD_USER_PATH=%%g
reg add HKCU\Environment /v Path /d "%OLD_USER_PATH%;C:\Program Files (x86)\VMware\VMware Workstation\OVFTool" /f
set PATH=%PATH%;C:\Program Files (x86)\VMware\VMware Workstation\OVFTool
exit /b
:OVFTOOL_DONE

if exist C:\vagrant\resources\hosts (
  echo Appending additional hosts entries
  copy C:\Windows\System32\drivers\etc\hosts + C:\vagrant\resources\hosts C:\Windows\System32\drivers\etc\hosts
)

echo Extend drive C to maximum
echo select volume 0 >%TEMP%\extendC.txt
echo extend >>%TEMP%\extendC.txt
diskpart.exe /s %TEMP%\extendC.txt
set WORKDRIVE=C:

if exist %WinDir%\microsoft.net\framework\v4.0.30319 goto :have_net4
echo Ensuring .NET 4.0 is installed
@powershell -NoProfile -ExecutionPolicy unrestricted -Command "iex ((new-object net.webclient).DownloadString('https://raw.github.com/StefanScherer/arduino-ide/install/InstallNet4.ps1'))"
:have_net4
if "%ChocolateyInstall%x"=="x" set ChocolateyInstall=%SystemDrive%\Chocolatey
if exist %ChocolateyInstall% goto :have_chocolatey
echo Installing Chocolatey
@powershell -NoProfile -ExecutionPolicy unrestricted -Command "iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))" && SET PATH=%PATH%;%systemdrive%\chocolatey\bin
:have_chocolatey

where cinst
if ERRORLEVEL 1 goto set_chocolatey
goto inst
:set_chocolatey
set PATH=%PATH%;%ChocolateyInstall%\bin
:inst

call cinst wget

call cinst msysgit
where git
if ERRORLEVEL 1 call :addGitToUserPath
goto GIT_DONE
:addGitToUserPath
for /F "tokens=2* delims= " %%f IN ('reg query "HKCU\Environment" /v Path ^| findstr /i path') do set OLD_USER_PATH=%%g
reg add HKCU\Environment /v Path /d "%OLD_USER_PATH%;C:\Program Files (x86)\Git\cmd" /f
set PATH=%PATH%;C:\Program Files (x86)\Git\cmd
exit /b
:GIT_DONE

rem Install unreleased packer from GitHub sources
rem call C:\vagrant\scripts\install-packer-from-source.bat
rem goto packer_firewall

call cinst packer
where packer
if ERRORLEVEL 1 call :addPackerToUserPath
goto PACKER_DONE
:addPackerToUserPath
for /F "tokens=2* delims= " %%f IN ('reg query "HKCU\Environment" /v Path ^| findstr /i path') do set OLD_USER_PATH=%%g
reg add HKCU\Environment /v Path /d "%OLD_USER_PATH%;C:\hashicorp\packer" /f
set PATH=%PATH%;C:\hashicorp\packer
exit /b
:PACKER_DONE
call cinst packer-post-processor-vagrant-vmware-ovf

:packer_firewall
netsh advfirewall firewall add rule name="packer-builder-vmware-iso" dir=in program="c:\HashiCorp\packer\packer-builder-vmware-iso.exe" action=allow
netsh advfirewall firewall add rule name="packer-builder-virtualbox-iso" dir=in program="c:\HashiCorp\packer\packer-builder-virtualbox-iso.exe" action=allow
netsh advfirewall firewall add rule name="packer-builder-vmware-iso" dir=in program="c:\Users\vagrant\go\bin\packer-builder-vmware-iso.exe" action=allow
netsh advfirewall firewall add rule name="packer-builder-virtualbox-iso" dir=in program="c:\Users\vagrant\go\bin\packer-builder-virtualbox-iso.exe" action=allow

if exist c:\hashicorp\vagrant goto :have_vagrant
echo Installing Vagrant ...
call cinst vagrant
set PATH=%PATH%;C:\hashicorp\vagrant\bin
:have_vagrant
echo Installing vagrant-vcloud plugin ...
vagrant plugin install vagrant-vcloud
if exist C:\Users\vagrant\.vagrant.d\Vagrantfile goto :have_vagrantfile
if exist C:\vagrant\resources\Vagrantfile-global (
  copy C:\vagrant\resources\Vagrantfile-global C:\Users\vagrant\.vagrant.d\Vagrantfile
)
:have_vagrantfile
if exist C:\HashiCorp\Vagrant\embedded\gems\gems\vagrant-1.6.3\plugins\hosts\windows\cap\rdp.rb (
  echo Patching Vagrant 1.6.3
  copy /Y C:\vagrant\scripts\rdp.rb C:\HashiCorp\Vagrant\embedded\gems\gems\vagrant-1.6.3\plugins\hosts\windows\cap\rdp.rb
)

rem Install VMware Workstation
if not exist "c:\Program Files (x86)\VMware\VMware Workstation" (
  if not exist "%TEMP%\VMware-workstation.exe" (
    echo Downloading VMware Workstation...
    call wget --no-verbose --no-check-certificate -O "%TEMP%\VMware-workstation.exe" http://www.vmware.com/go/tryworkstation-win
  )
  echo Install VMware Workstation...
  rem "%TEMP%\VMware-workstation.exe" /s /nsr /v EULAS_AGREED=1 SERIALNUMBER="xxxxx-xxxxx-xxxxx-xxxxx-xxxxx"
  "%TEMP%\VMware-workstation.exe" /s /nsr /v EULAS_AGREED=1
  del "%TEMP%\VMware-workstation.exe"
)

rem put ovftool in path (not necessary for packer, but for jenkins test-box-vcloud.bat)
where ovftool
if ERRORLEVEL 1 call :addOvfToolToUserPath
goto OVFTOOL_DONE
:addOvfToolToUserPath
for /F "tokens=2* delims= " %%f IN ('reg query "HKCU\Environment" /v Path ^| findstr /i path') do set OLD_USER_PATH=%%g
reg add HKCU\Environment /v Path /d "%OLD_USER_PATH%;C:\Program Files (x86)\VMware\VMware Workstation\OVFTool" /f
set PATH=%PATH%;C:\Program Files (x86)\VMware\VMware Workstation\OVFTool
exit /b
:OVFTOOL_DONE

if exist C:\vagrant\resources\hosts (
  echo Appending additional hosts entries
  copy C:\Windows\System32\drivers\etc\hosts + C:\vagrant\resources\hosts C:\Windows\System32\drivers\etc\hosts
)

install official packer 0.6.1 with cinst


@ECHO OFF

:: 1. Prepare environment
SET DNVM_CMD_PATH_FILE="%USERPROFILE%\.dnx\temp-set-envvars.cmd"

:: 2. Install DNX
IF EXIST global.json (
    CALL PowerShell -NoProfile -NoLogo -ExecutionPolicy unrestricted -Command "[System.Threading.Thread]::CurrentThread.CurrentCulture = ''; [System.Threading.Thread]::CurrentThread.CurrentUICulture = '';$CmdPathFile='%DNVM_CMD_PATH_FILE%';& '%SCM_DNVM_PS_PATH%' " install -File global.json
    IF ERRORLEVEL 1 GOTO ERROR
) ELSE (
    CALL PowerShell -NoProfile -NoLogo -ExecutionPolicy unrestricted -Command "[System.Threading.Thread]::CurrentThread.CurrentCulture = ''; [System.Threading.Thread]::CurrentThread.CurrentUICulture = '';$CmdPathFile='%DNVM_CMD_PATH_FILE%';& '%SCM_DNVM_PS_PATH%' " install latest
    IF ERRORLEVEL 1 GOTO ERROR
)

:: 3. Put DNX on the path
IF EXIST %DNVM_CMD_PATH_FILE% (
    CALL %DNVM_CMD_PATH_FILE%
    DEL %DNVM_CMD_PATH_FILE%
)

:: 4. Run dnu restore
CALL dnu restore
IF ERRORLEVEL 1 GOTO ERROR

:: 5. Run the WebJob
CALL dnx . run
IF ERRORLEVEL 1 GOTO ERROR

GOTO END

:ERROR
ENDLOCAL
ECHO An error has occurred during running DNX WebJob.
CALL :EXITSETERRORLEVEL
CALL :EXITFROMFUNCTION 2>NUL

:EXITSETERRORLEVEL
EXIT /b 1

:EXITFROMFUNCTION
()

:END
ECHO DNX WebJob ended

@ECHO OFF

:: 1. Prepare environment
SET DNVM_CMD_PATH_FILE="%USERPROFILE%\.dnx\temp-set-envvars.cmd"

:: 2. Install DNX
IF EXIST global.json (
    CALL PowerShell -NoProfile -NoLogo -ExecutionPolicy unrestricted -Command "[System.Threading.Thread]::CurrentThread.CurrentCulture = ''; [System.Threading.Thread]::CurrentThread.CurrentUICulture = '';$CmdPathFile='%DNVM_CMD_PATH_FILE%';& '%SCM_DNVM_PS_PATH%' " install -File global.json
    IF ERRORLEVEL 1 GOTO ERROR
) ELSE (
    CALL PowerShell -NoProfile -NoLogo -ExecutionPolicy unrestricted -Command "[System.Threading.Thread]::CurrentThread.CurrentCulture = ''; [System.Threading.Thread]::CurrentThread.CurrentUICulture = '';$CmdPathFile='%DNVM_CMD_PATH_FILE%';& '%SCM_DNVM_PS_PATH%' " install latest
    IF ERRORLEVEL 1 GOTO ERROR
)

:: 3. Put DNX on the path
IF EXIST %DNVM_CMD_PATH_FILE% (
    CALL %DNVM_CMD_PATH_FILE%
    DEL %DNVM_CMD_PATH_FILE%
)

:: 4. Run dnu restore
CALL dnu restore
IF ERRORLEVEL 1 GOTO ERROR

:: 5. Run the WebJob
CALL dnx run
IF ERRORLEVEL 1 GOTO ERROR

GOTO END

:ERROR
ENDLOCAL
ECHO An error has occurred during running DNX WebJob.
CALL :EXITSETERRORLEVEL
CALL :EXITFROMFUNCTION 2>NUL

:EXITSETERRORLEVEL
EXIT /b 1

:EXITFROMFUNCTION
()

:END
ECHO DNX WebJob ended

Change 'dnx . run' to 'dnx run' based on aspnet/Announcements#52