@echo off
cd ..
cls
echo.
echo Prepare binary package (./bin) of D2TM.
echo.
echo Will copy "Dune 2.exe" from the Default dir created by Eclipse CDT.
echo Will copy DLL files from dll/mingw32
echo.
echo 1. Removing bin directory
rd /S /Q bin
echo 2. Creating new bin directory
mkdir bin
echo 3. Creating campaign directory
mkdir bin\campaign
mkdir bin\campaign\atreides
mkdir bin\campaign\ordos
mkdir bin\campaign\harkonnen
mkdir bin\campaign\maps
mkdir bin\campaign\maps\seed
mkdir bin\campaign\briefings
echo 4. Copying campaign files
copy resources\campaign\atreides\*.* bin\campaign\atreides
copy resources\campaign\ordos\*.* bin\campaign\ordos
copy resources\campaign\harkonnen\*.* bin\campaign\harkonnen
copy resources\campaign\maps\*.* bin\campaign\maps
copy resources\campaign\maps\seed\*.* bin\campaign\maps\seed
copy resources\campaign\briefings\*.* bin\campaign\briefings
copy resources\campaign\info.txt bin\campaign\info.txt
echo 5. Creating new data directory
mkdir bin\data
mkdir bin\data\scenes
echo 6. Copying data files
copy resources\data\*.dat bin\data
copy resources\data\*.fon bin\data
copy resources\data\*.ttf bin\data
echo 7. Copying scenes
copy resources\data\scenes\*.* bin\data\scenes
echo 8. Create save game directories
mkdir bin\save
mkdir bin\save\atreides
mkdir bin\save\harkonnen
mkdir bin\save\ordos
mkdir bin\save\skirmish
echo 9. Create skirmish directory
mkdir bin\skirmish
copy resources\skirmish\*.ini bin\skirmish
echo 10. Copying dll files
copy resources\dll\mingw32\*.* bin
echo 11. Copy executable from %1
copy Default\*.exe bin
echo 12. Copy game rules file (game.ini)
copy resources\game.ini bin
echo 13. Copy txt files
copy resources\*.txt bin
echo Done.
pause

@echo off
cd %D2TM_HOME%
cls
echo.
echo Prepare binary package (./bin) of D2TM.
echo.
echo Will copy "Dune 2.exe" from the Default dir created by Eclipse CDT.
echo Will copy DLL files from dll/mingw32
echo.
echo 1. Removing bin directory
rd /S /Q bin
echo 2. Creating new bin directory
mkdir bin
echo 3. Creating campaign directory
mkdir bin\campaign
mkdir bin\campaign\atreides
mkdir bin\campaign\ordos
mkdir bin\campaign\harkonnen
mkdir bin\campaign\maps
mkdir bin\campaign\maps\seed
mkdir bin\campaign\briefings
echo 4. Copying campaign files
copy resources\campaign\atreides\*.* bin\campaign\atreides
copy resources\campaign\ordos\*.* bin\campaign\ordos
copy resources\campaign\harkonnen\*.* bin\campaign\harkonnen
copy resources\campaign\maps\*.* bin\campaign\maps
copy resources\campaign\maps\seed\*.* bin\campaign\maps\seed
copy resources\campaign\briefings\*.* bin\campaign\briefings
copy resources\campaign\info.txt bin\campaign\info.txt
echo 5. Creating new data directory
mkdir bin\data
mkdir bin\data\scenes
echo 6. Copying data files
copy resources\data\*.dat bin\data
copy resources\data\*.fon bin\data
copy resources\data\*.ttf bin\data
echo 7. Copying scenes
copy resources\data\scenes\*.* bin\data\scenes
echo 8. Create save game directories
mkdir bin\save
mkdir bin\save\atreides
mkdir bin\save\harkonnen
mkdir bin\save\ordos
mkdir bin\save\skirmish
echo 9. Create skirmish directory
mkdir bin\skirmish
copy resources\skirmish\*.ini bin\skirmish
echo 10. Copying dll files
copy resources\dll\mingw32\*.* bin
echo 11. Copy executable from %1
copy Default\*.exe bin
echo 12. Copy game rules file (game.ini)
copy resources\game.ini bin
echo 13. Copy txt files
copy resources\*.txt bin
echo Done.
pause

use D2TM_HOME env variable so the batch file can work on any environment


@ECHO OFF
REM -- Automates cygwin installation

SETLOCAL

REM -- Change to the directory of the executing batch file
CD %~dp0

REM -- Configure our paths
SET ROOTDIR=C:\cygwin
SET SITE=http://cygwin.mirrors.pair.com/
SET SSHD_PORT=13610

REM -- Additional variables
SET ADD_ARGS="-K http://cygwinports.org/ports.gpg -s ftp://ftp.cygwinports.org/pub/cygwinports"
SET LOCALDIR="%ROOTDIR%\setup"
set HSTART_URL=http://files.ntwind.com/download/Hstart_4.2-bin.zip
IF "%PROCESSOR_ARCHITECTURE%" == "x86" (
	SET SETUP_NAME=setup.exe
	SET HSTART_BIN=hstart.exe
) else (
	SET SETUP_NAME=setup-x86_64.exe
	SET HSTART_BIN=hstart64.exe
)

REM -- STARTING SCRIPT
set DLOAD_SCRIPT=download.vbs
REM -- Get the user's startup directory
for /F "skip=2 tokens=2*" %%j in ('reg query "HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" /v "Startup"') do set STARTUP_DIR=%%k

REM -- pure batch downloader: https://semitwist.com/articles/article/view/downloading-files-from-plain-batch-with-zero-dependencies
REM -- Windows has no built-in wget or curl, so generate a VBS script to do it:
REM -------------------------------------------------------------------------
ECHO Option Explicit                                                    >  %DLOAD_SCRIPT%
ECHO Dim args, http, fileSystem, adoStream, url, target, status         >> %DLOAD_SCRIPT%
ECHO.                                                                   >> %DLOAD_SCRIPT%
ECHO Set args = Wscript.Arguments                                       >> %DLOAD_SCRIPT%
ECHO Set http = CreateObject("WinHttp.WinHttpRequest.5.1")              >> %DLOAD_SCRIPT%
ECHO url = args(0)                                                      >> %DLOAD_SCRIPT%
ECHO target = args(1)                                                   >> %DLOAD_SCRIPT%
ECHO WScript.Echo "Getting '" ^& target ^& "' from '" ^& url ^& "'..."  >> %DLOAD_SCRIPT%
ECHO.                                                                   >> %DLOAD_SCRIPT%
ECHO http.Open "GET", url, False                                        >> %DLOAD_SCRIPT%
ECHO http.Send                                                          >> %DLOAD_SCRIPT%
ECHO status = http.Status                                               >> %DLOAD_SCRIPT%
ECHO.                                                                   >> %DLOAD_SCRIPT%
ECHO If status ^<^> 200 Then                                            >> %DLOAD_SCRIPT%
ECHO 	WScript.Echo "FAILED to download: HTTP Status " ^& status       >> %DLOAD_SCRIPT%
ECHO 	WScript.Quit 1                                                  >> %DLOAD_SCRIPT%
ECHO End If                                                             >> %DLOAD_SCRIPT%
ECHO.                                                                   >> %DLOAD_SCRIPT%
ECHO Set adoStream = CreateObject("ADODB.Stream")                       >> %DLOAD_SCRIPT%
ECHO adoStream.Open                                                     >> %DLOAD_SCRIPT%
ECHO adoStream.Type = 1                                                 >> %DLOAD_SCRIPT%
ECHO adoStream.Write http.ResponseBody                                  >> %DLOAD_SCRIPT%
ECHO adoStream.Position = 0                                             >> %DLOAD_SCRIPT%
ECHO.                                                                   >> %DLOAD_SCRIPT%
ECHO Set fileSystem = CreateObject("Scripting.FileSystemObject")        >> %DLOAD_SCRIPT%
ECHO If fileSystem.FileExists(target) Then fileSystem.DeleteFile target >> %DLOAD_SCRIPT%
ECHO adoStream.SaveToFile target                                        >> %DLOAD_SCRIPT%
ECHO adoStream.Close                                                    >> %DLOAD_SCRIPT%
ECHO.                                                                   >> %DLOAD_SCRIPT%
REM -------------------------------------------------------------------------

mkdir "%ROOTDIR%"
mkdir "%LOCALDIR%"

IF NOT EXIST "%ROOTDIR%\%SETUP_NAME%" cscript //Nologo "%DLOAD_SCRIPT%" http://cygwin.com/%SETUP_NAME% "%ROOTDIR%\%SETUP_NAME%"

REM -- cleanup temp files
del "%DLOAD_SCRIPT%"

REM -- These are the packages we will install (in addition to the default packages)
SET PACKAGES=bash-completion,bc,bind,ca-certificates,curl,fdupes,git,git-completion,git-svn
SET PACKAGES=%PACKAGES%,inetutils,ncurses,openssh,openssl,procps,rsync,screen,unzip,vim,wget,xxd
REM -- Extra packages
SET PACKAGES=%PACKAGES%,heimdal

REM -- Do it!
ECHO *** INSTALLING DEFAULT PACKAGES
"%ROOTDIR%\%SETUP_NAME%" -q -d -D -L -X -s "%SITE%" -l "%LOCALDIR%" -R "%ROOTDIR%" "%ADD_ARGS%"
ECHO.
ECHO.
ECHO *** INSTALLING CUSTOM PACKAGES
"%ROOTDIR%\%SETUP_NAME%" -q -d -D -L -X -s "%SITE%" -l "%LOCALDIR%" -R "%ROOTDIR%" "%ADD_ARGS%" -P "%PACKAGES%"

REM -- Show what we did
ECHO.
ECHO.
ECHO cygwin installation updated
ECHO - "%PACKAGES%"
ECHO.

REM -- make cygdrive root / instead of /cygdrive
ECHO.
ECHO.
ECHO updating cygdrive fstab
"%ROOTDIR%\bin\bash.exe" --login -c "sed -i 's/# none \/cygdrive cygdrive /none \/ cygdrive /' /etc/fstab"
ECHO.
ECHO.

REM -- make the home directory
ECHO.
ECHO.
ECHO making the home directory be the windows home
REM -- WIN XP-
"%ROOTDIR%\bin\bash.exe" --login -c "if [[ -d \"/c/Documents and Settings/$USER\" ]]; then mv \"/home/$USER\" \"/home/$USER.bak\"; ln -s \"/c/Documents and Settings/$USER\" \"/home/$USER\"; fi;"
REM -- WIN Vista+
"%ROOTDIR%\bin\bash.exe" --login -c "if [[ -d \"/c/Users/$USER\" ]]; then mv \"/home/$USER\" \"/home/$USER.bak\"; ln -s \"/c/Users/$USER\" \"/home/$USER\"; fi;"
ECHO.
ECHO.

REM -- setup sshd for local user only
ECHO.
ECHO.
ECHO setup sshd for local user only
"%ROOTDIR%\bin\bash.exe" --login -c "ssh-host-config --no --port %SSHD_PORT%"
"%ROOTDIR%\bin\bash.exe" --login -c "sed -i 's/^#ListenAddress 0.0.0.0$/ListenAddress 127.0.0.1/' /etc/sshd_config"
"%ROOTDIR%\bin\bash.exe" --login -c "sed -i 's/^#ListenAddress ::$/ListenAddress ::1/' /etc/sshd_config"
"%ROOTDIR%\bin\bash.exe" --login -c "sed -i 's/^#PasswordAuthentication yes$/PasswordAuthentication no/' /etc/sshd_config"
"%ROOTDIR%\bin\bash.exe" --login -c "sed -i 's/^UsePrivilegeSeparation sandbox/UsePrivilegeSeparation no/' /etc/sshd_config"
"%ROOTDIR%\bin\bash.exe" --login -c "if [[ ! -f ~/.ssh/id_rsa ]]; then ssh-keygen -q -t rsa -N '' -f ~/.ssh/id_rsa && cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys && chmod 0600 ~/.ssh/authorized_keys; fi;"
"%ROOTDIR%\bin\bash.exe" --login -c "echo '' > /etc/motd"

REM -- download hstart
IF NOT EXIST "%ROOTDIR%\startup\%HSTART_BIN%" (
	"%ROOTDIR%\bin\bash.exe" --login -c "mkdir /startup"
	"%ROOTDIR%\bin\bash.exe" --login -c "wget -O /tmp/hstart.zip %HSTART_URL% && unzip -p /tmp/hstart.zip %HSTART_BIN% > /startup/%HSTART_BIN%"
	"%ROOTDIR%\bin\bash.exe" --login -c "rm -f /tmp/hstart.zip"
)

REM -- create the startup entry for ssh to run on login
IF NOT EXIST "%STARTUP_DIR%\sshd.cmd" (
echo ^
SET PATH=%%PATH%%;%ROOTDIR%\bin^

chdir %ROOTDIR%^

start "" "%ROOTDIR%\startup\%HSTART_BIN%" /noconsole /elevate "%ROOTDIR%\usr\sbin\sshd.exe -D"^
 > "%STARTUP_DIR%\sshd.cmd"
)

ECHO.
ECHO.

ENDLOCAL

PAUSE
EXIT /B 0

@ECHO OFF
REM -- Automates cygwin installation

SETLOCAL

REM -- Change to the directory of the executing batch file
CD %~dp0

REM -- Configure our paths
SET ROOTDIR=C:\cygwin
SET SITE=http://cygwin.mirrors.pair.com/
SET SSHD_PORT=13610

REM -- Additional variables
SET ADD_ARGS="-K http://cygwinports.org/ports.gpg -s ftp://ftp.cygwinports.org/pub/cygwinports"
SET LOCALDIR="%ROOTDIR%\setup"
set HSTART_URL=http://files.ntwind.com/download/Hstart_4.2-bin.zip
IF "%PROCESSOR_ARCHITECTURE%" == "x86" (
	SET SETUP_NAME=setup.exe
	SET HSTART_BIN=hstart.exe
) else (
	SET SETUP_NAME=setup-x86_64.exe
	SET HSTART_BIN=hstart64.exe
)

REM -- STARTING SCRIPT
set DLOAD_SCRIPT=download.vbs
REM -- Get the user's startup directory
for /F "skip=2 tokens=2*" %%j in ('reg query "HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" /v "Startup"') do set STARTUP_DIR=%%k

REM -- pure batch downloader: https://semitwist.com/articles/article/view/downloading-files-from-plain-batch-with-zero-dependencies
REM -- Windows has no built-in wget or curl, so generate a VBS script to do it:
REM -------------------------------------------------------------------------
ECHO Option Explicit                                                    >  %DLOAD_SCRIPT%
ECHO Dim args, http, fileSystem, adoStream, url, target, status         >> %DLOAD_SCRIPT%
ECHO.                                                                   >> %DLOAD_SCRIPT%
ECHO Set args = Wscript.Arguments                                       >> %DLOAD_SCRIPT%
ECHO Set http = CreateObject("WinHttp.WinHttpRequest.5.1")              >> %DLOAD_SCRIPT%
ECHO url = args(0)                                                      >> %DLOAD_SCRIPT%
ECHO target = args(1)                                                   >> %DLOAD_SCRIPT%
ECHO WScript.Echo "Getting '" ^& target ^& "' from '" ^& url ^& "'..."  >> %DLOAD_SCRIPT%
ECHO.                                                                   >> %DLOAD_SCRIPT%
ECHO http.Open "GET", url, False                                        >> %DLOAD_SCRIPT%
ECHO http.Send                                                          >> %DLOAD_SCRIPT%
ECHO status = http.Status                                               >> %DLOAD_SCRIPT%
ECHO.                                                                   >> %DLOAD_SCRIPT%
ECHO If status ^<^> 200 Then                                            >> %DLOAD_SCRIPT%
ECHO 	WScript.Echo "FAILED to download: HTTP Status " ^& status       >> %DLOAD_SCRIPT%
ECHO 	WScript.Quit 1                                                  >> %DLOAD_SCRIPT%
ECHO End If                                                             >> %DLOAD_SCRIPT%
ECHO.                                                                   >> %DLOAD_SCRIPT%
ECHO Set adoStream = CreateObject("ADODB.Stream")                       >> %DLOAD_SCRIPT%
ECHO adoStream.Open                                                     >> %DLOAD_SCRIPT%
ECHO adoStream.Type = 1                                                 >> %DLOAD_SCRIPT%
ECHO adoStream.Write http.ResponseBody                                  >> %DLOAD_SCRIPT%
ECHO adoStream.Position = 0                                             >> %DLOAD_SCRIPT%
ECHO.                                                                   >> %DLOAD_SCRIPT%
ECHO Set fileSystem = CreateObject("Scripting.FileSystemObject")        >> %DLOAD_SCRIPT%
ECHO If fileSystem.FileExists(target) Then fileSystem.DeleteFile target >> %DLOAD_SCRIPT%
ECHO adoStream.SaveToFile target                                        >> %DLOAD_SCRIPT%
ECHO adoStream.Close                                                    >> %DLOAD_SCRIPT%
ECHO.                                                                   >> %DLOAD_SCRIPT%
REM -------------------------------------------------------------------------

mkdir "%ROOTDIR%"
mkdir "%LOCALDIR%"

IF NOT EXIST "%ROOTDIR%\%SETUP_NAME%" cscript //Nologo "%DLOAD_SCRIPT%" http://cygwin.com/%SETUP_NAME% "%ROOTDIR%\%SETUP_NAME%"

REM -- cleanup temp files
del "%DLOAD_SCRIPT%"

REM -- These are the packages we will install (in addition to the default packages)
SET PACKAGES=bash-completion,bc,bind,ca-certificates,curl,fdupes,git,git-completion,git-svn
SET PACKAGES=%PACKAGES%,inetutils,ncurses,openssh,openssl,procps,rsync,screen,unzip,vim,wget,xxd
REM -- Extra packages
SET PACKAGES=%PACKAGES%,heimdal

REM -- Do it!
ECHO *** INSTALLING DEFAULT PACKAGES
"%ROOTDIR%\%SETUP_NAME%" -q -d -D -L -X -s "%SITE%" -l "%LOCALDIR%" -R "%ROOTDIR%" "%ADD_ARGS%"
ECHO.
ECHO.
ECHO *** INSTALLING CUSTOM PACKAGES
"%ROOTDIR%\%SETUP_NAME%" -q -d -D -L -X -s "%SITE%" -l "%LOCALDIR%" -R "%ROOTDIR%" "%ADD_ARGS%" -P "%PACKAGES%"

REM -- Show what we did
ECHO.
ECHO.
ECHO cygwin installation updated
ECHO - "%PACKAGES%"
ECHO.

REM -- make cygdrive root / instead of /cygdrive
ECHO.
ECHO.
ECHO updating cygdrive fstab
"%ROOTDIR%\bin\bash.exe" --login -c "sed -i 's/# none \/cygdrive cygdrive /none \/ cygdrive /' /etc/fstab"
"%ROOTDIR%\bin\bash.exe" --login -c "sed -i 's/none \/cygdrive cygdrive /none \/ cygdrive /' /etc/fstab"
ECHO.
ECHO.

REM -- make the home directory
ECHO.
ECHO.
ECHO making the home directory be the windows home
REM -- WIN XP-
"%ROOTDIR%\bin\bash.exe" --login -c "if [[ -d \"/c/Documents and Settings/$USER\" ]]; then mv \"/home/$USER\" \"/home/$USER.bak\"; ln -s \"/c/Documents and Settings/$USER\" \"/home/$USER\"; fi;"
REM -- WIN Vista+
"%ROOTDIR%\bin\bash.exe" --login -c "if [[ -d \"/c/Users/$USER\" ]]; then mv \"/home/$USER\" \"/home/$USER.bak\"; ln -s \"/c/Users/$USER\" \"/home/$USER\"; fi;"
ECHO.
ECHO.

REM -- setup sshd for local user only
ECHO.
ECHO.
ECHO setup sshd for local user only
"%ROOTDIR%\bin\bash.exe" --login -c "ssh-host-config --no --port %SSHD_PORT%"
"%ROOTDIR%\bin\bash.exe" --login -c "sed -i 's/^#ListenAddress 0.0.0.0$/ListenAddress 127.0.0.1/' /etc/sshd_config"
"%ROOTDIR%\bin\bash.exe" --login -c "sed -i 's/^#ListenAddress ::$/ListenAddress ::1/' /etc/sshd_config"
"%ROOTDIR%\bin\bash.exe" --login -c "sed -i 's/^#PasswordAuthentication yes$/PasswordAuthentication no/' /etc/sshd_config"
"%ROOTDIR%\bin\bash.exe" --login -c "sed -i 's/^UsePrivilegeSeparation sandbox/UsePrivilegeSeparation no/' /etc/sshd_config"
"%ROOTDIR%\bin\bash.exe" --login -c "if [[ ! -f ~/.ssh/id_rsa ]]; then ssh-keygen -q -t rsa -N '' -f ~/.ssh/id_rsa && cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys && chmod 0600 ~/.ssh/authorized_keys; fi;"
"%ROOTDIR%\bin\bash.exe" --login -c "echo '' > /etc/motd"

REM -- download hstart
IF NOT EXIST "%ROOTDIR%\startup\%HSTART_BIN%" (
	"%ROOTDIR%\bin\bash.exe" --login -c "mkdir /startup"
	"%ROOTDIR%\bin\bash.exe" --login -c "wget -O /tmp/hstart.zip %HSTART_URL% && unzip -p /tmp/hstart.zip %HSTART_BIN% > /startup/%HSTART_BIN%"
	"%ROOTDIR%\bin\bash.exe" --login -c "rm -f /tmp/hstart.zip"
)

REM -- create the startup entry for ssh to run on login
IF NOT EXIST "%STARTUP_DIR%\sshd.cmd" (
echo ^
SET PATH=%%PATH%%;%ROOTDIR%\bin^

chdir %ROOTDIR%^

start "" "%ROOTDIR%\startup\%HSTART_BIN%" /noconsole /elevate "%ROOTDIR%\usr\sbin\sshd.exe -D"^
 > "%STARTUP_DIR%\sshd.cmd"
)

ECHO.
ECHO.

ENDLOCAL

PAUSE
EXIT /B 0

Add additional line incase fstab is uncommented


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

@echo "Starting Windows build"

cd /d %~dp0
cd ..

call npm install -g npm@latest || goto :error
call npm install || goto :error
call npm run test || goto :error

goto :EOF

:error
exit /b 1

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

@echo "Starting Windows build"

cd /d %~dp0
cd ..

@rem The image we're currently running has a broken version of Node.js enabled
@rem by nvm (v10.15.3), which has no npm bin. This hack uses the functional
@rem Node v8.9.1 to install npm@latest, it then uses this version of npm to
@rem install npm for v10.15.3.
call nvm use v8.9.1 || goto :error
call node C:\Users\kbuilder\AppData\Roaming\nvm-ps\versions\v8.9.1\node_modules\npm-bootstrap\bin\npm-cli.js i npm -g || goto :error
call nvm use v10.15.3 || goto :error
call node C:\Users\kbuilder\AppData\Roaming\nvm-ps\versions\v8.9.1\node_modules\npm\bin\npm-cli.js i npm -g || goto :error

call npm install || goto :error
call npm run test || goto :error

goto :EOF

:error
exit /b 1

build: patch Windows container, fixing Node 10 (#235)


@ECHO OFF
PUSHD %~DP0
SET CURDIR=%CD%
PUSHD ..
SET TOPDIR=%CD%
POPD
POPD

SET GDAL_ROOT=%TOPDIR%\bin\gdal
rem SET GDAL_PAM_PROXY_DIR=%TEMP%
SET GDAL_DATA=%GDAL_ROOT%\share\gdal-data
SET GEOTIFF_CSV=%GDAL_DATA%
SET PROJ_LIB=%GDAL_ROOT%\share\proj
SET GDAL_DRIVER_PATH=%GDAL_ROOT%\bin\plugins

SET PYTHONHOME=%TOPDIR%\bin\Python26
SET PYTHONPATH=%PYTHONHOME%\Lib\lib-tk
SET PYTHONPATH=%PYTHONHOME%\Lib\site-packages\pywin32_system32;%PYTHONHOME%\Lib\site-packages\win32;%PYTHONHOME%\Lib\site-packages\win32\lib;%PYTHONHOME%\Lib\site-packages\pythonwin;%PYTHONPATH%
SET PYTHONPATH=%GDAL_ROOT%\bin;%GDAL_ROOT%\lib;%PYTHONPATH%
SET PYTHONPATH=%CURDIR%;%PYTHONPATH%

PATH=%GDAL_ROOT%\bin;%PATH%
PATH=%GDAL_ROOT%\bin\gdal\apps;%PATH%
PATH=%GDAL_DRIVER_PATH%;%PATH%
PATH=%PYTHONPATH%;%PATH%
PATH=%PYTHONHOME%;%PATH%
PATH=%CURDIR%;%PATH%

@ECHO OFF
PUSHD %~DP0
SET CURDIR=%CD%
PUSHD ..
SET TOPDIR=%CD%
POPD
POPD

SET GDAL_ROOT=%TOPDIR%\bin\gdal
rem SET GDAL_PAM_PROXY_DIR=%TEMP%
SET GDAL_DATA=%GDAL_ROOT%\share\gdal-data
SET GEOTIFF_CSV=%GDAL_DATA%
SET PROJ_LIB=%GDAL_ROOT%\share\proj
SET GDAL_DRIVER_PATH=%GDAL_ROOT%\bin\plugins

SET PYTHONHOME=%TOPDIR%\bin\Python26
SET PYTHONPATH=%PYTHONHOME%\Lib\lib-tk
SET PYTHONPATH=%PYTHONHOME%\Lib\site-packages\pywin32_system32;%PYTHONHOME%\Lib\site-packages\win32;%PYTHONHOME%\Lib\site-packages\win32\lib;%PYTHONHOME%\Lib\site-packages\pythonwin;%PYTHONPATH%
SET PYTHONPATH=%GDAL_ROOT%\bin;%GDAL_ROOT%\lib;%PYTHONPATH%
SET PYTHONPATH=%CURDIR%;%PYTHONPATH%

set path=
set path=%WINDIR%;%WINDIR%\system32
PATH=%GDAL_ROOT%\bin;%PATH%
PATH=%GDAL_ROOT%\bin\gdal\apps;%PATH%
PATH=%GDAL_DRIVER_PATH%;%PATH%
PATH=%PYTHONPATH%;%PATH%
PATH=%PYTHONHOME%;%PATH%
PATH=%CURDIR%;%PATH%

Clean out the PAHT env var to hopefully avoid more missing/extra dependencies


@setlocal enableextensions enabledelayedexpansion & set "PATH0=%~f0" & PowerShell.exe -Command "& (Invoke-Expression -Command ('{#' + ((Get-Content '!PATH0:'=''!') -join \"`n\") + '}'))" %* & exit /b !errorlevel!
#
# - Name
#     ssh.bat
#
# - Contents
#     Simplify SSH Connect by Tera Term.
#     <Windows> + <R> => ssh root@192.168.1.100
#
# - Install
#     powershell.exe -Command "Invoke-RestMethod -Uri "https://initsh.github.io/ps1/ssh.bat" | Out-File -Encoding utf8 "$env:USERPROFILE\ssh.bat""
#
# - Reference
#     http://pf-j.sakura.ne.jp/program/tips/ps1bat2.htm
#
# - Revision
#     2016-12-28 created.
#     2017-04-14 modified.
#     2017-05-22 modified.
#     yyyy-MM-dd modified.
#

################
# constant
################
#[System.String] $base_dir = "$env:Userprofile"
[System.String] $base_dir = "$env:Userprofile\GoogleDrive"
[System.String] $ssh_dir  = "$base_dir\ssh"
[System.String] $log_dir  = "$ssh_dir\log"
[System.String] $key_dir  = "$ssh_dir\key"
[System.String] $csv_file = "$ssh_dir\hosts.csv"
[System.String] $tt_install_uri = "https://ja.osdn.net/frs/redir.php?m=ymu&f=%2Fttssh2%2F67179%2Fteraterm-4.94.exe"
[System.String] $tt_install_exe = "$env:USERPROFILE\Downloads\teraterm-4.94.exe"

################
# variable
################
[System.String] $date = Get-Date -Format yyyyMMdd
[System.String] $time = Get-Date -Format HHmmss

################
# main
################
### Create directorys.
if ((Get-Item $ssh_dir).Mode | Select-String -NotMatch '^d') { mkdir $ssh_dir; }
if ((Get-Item $log_dir).Mode | Select-String -NotMatch '^d') { mkdir $log_dir; }
if ((Get-Item $key_dir).Mode | Select-String -NotMatch '^d') { mkdir $ssh_dir; }
if (-Not (Test-Path $csv_file))
{
    Write-Output @'
Hostname,Port,Username,AuthType,Value,Alias
# In the first line, Header information is written. Please do not edit!

# Please refer to the following and set it like the description example.
# Hostname,PortNumber,Username,AuthenticationType[password|publickey],Value[Passphrase|NameOfSecretKey],Set an alias character string as an argument of ssh command. UPN notation is recommended.

# description example:
www.example.com,22,admin,publickey,id_rsa,admin@www.example.com
192.168.1.100,22,root,password,P@ssw0rd,root@192.168.1.100
'@ > $csv_file
    Write-Output "$(Get-Date -Format yyyy-MM-ddTHH:mm:sszzz) [NOTICE]: Check the file( $csv_file ) and set it as shown in the description example."
    Write-Output "$(Get-Date -Format yyyy-MM-ddTHH:mm:sszzz) [NOTICE]: Edit the file( $csv_file ) and try again."
    notepad $csv_file
    [Console]::ReadKey() | Out-Null
    exit 1
}

### Search for ttermpro.exe from the directory where teraterm was installed and get the full path of ttermpro.exe.
[System.String] $ssh_client = Get-ChildItem -recurse "C:\Program Files*\teraterm" | Where-Object { $_.Name -match "ttermpro" } | ForEach-Object { $_.FullName }
###
if (-Not ($?) -Or -Not (Test-Path -Path $ssh_client))
{
    Invoke-WebRequest -Uri $tt_install_uri -OutFile $tt_install_exe
    Start-Process -FilePath $tt_install_exe -PassThru -Wait
    [System.String] $ssh_client = Get-ChildItem -recurse "C:\Program Files*\teraterm" | Where-Object { $_.Name -match "ttermpro" } | ForEach-Object { $_.FullName }
    if (-Not ($?) -Or -Not (Test-Path -Path $ssh_client))
    {
        Write-Output "$(Get-Date -Format yyyy-MM-ddTHH:mm:sszzz) [ERROR]: ttermpro.exe not found in `"C:\Program Files*`"."
        [Console]::ReadKey() | Out-Null
        exit 1
    }
}

if ($args[0])
{
    ### $args[0] = Alias. UPN notation is recommended.
    [System.String] $ssh_alias = $args[0]
    [System.Array] $ssh_args = $args[0] -split "@"
    [System.String] $ssh_log = "$log_dir\" + $ssh_args[1] + "_" + $ssh_args[0] + "_" + $date + "_" + $time + ".log"

    ### Get a match with the value of $args[0] and the value of Alias in CSV.
    [System.Array] $csv_data = Import-Csv $csv_file | Where-Object { $_.Alias -eq $ssh_alias }

    ### If there is a match between the value of $args[0] and the value of Alias in CSV,
    if ($csv_data)
    {
        ### Create arguments to pass to ttermpro.exe.
        [System.String] $opt_host = "ssh2://" + $csv_data[0].Hostname + ":" + $csv_data[0].Port
        [System.String] $opt_user = "/user=" + $csv_data[0].Username
        [System.String] $opt_auth = "/auth=" + $csv_data[0].AuthType
        if ($csv_data[0].AuthType -eq "password")
        {
            [System.String] $opt_value = "/passwd=" + $csv_data[0].Value
        }
        elseif ($csv_data[0].AuthType -eq "publickey")
        {
            [System.String] $opt_value = "/keyfile=$key_dir\" + $csv_data[0].Value
        }
        [System.String] $opt_dir = "/FD=$ssh_dir"
        [System.String] $opt_log = "/L=$ssh_log"

        [System.Array] $opt_array = @($opt_host,$opt_user,$opt_auth,$opt_value,$opt_dir,$opt_log,"/ssh-v","/LA=J")

    }
    ### If there is no matching match between the value of $args[0] and the value of Alias in CSV,
    else
    {
        ### Show contents of CSV.
        Get-Item $csv_file
        Import-Csv $csv_file | Where-Object { ($_.Alias) } | Select-Object Username,Hostname,Alias | Format-Table -AutoSize
        [Console]::ReadKey() | Out-Null
        exit 0
    }
}
else
{
    [System.String] $ssh_log = "$log_dir\undefined_undefined_" + $date + "_" + $time + ".log"
    [System.String] $opt_dir = "/FD=" + $ssh_dir
    [System.String] $opt_log = "/L=$ssh_log"
    [System.Array] $opt_array = @($opt_dir,$opt_log,"/ssh-v","/LA=J")
}

### Run teraterm.
$ssh_process = Start-Process -FilePath $ssh_client -ArgumentList $opt_array -PassThru -Wait
### Change attribute of teraterm log file to read only.
Set-ItemProperty -Path $ssh_log -Name Attributes -Value Readonly
### Display the contents of teraterm log file (personal preference...).
Get-Content -Path $ssh_log
### Output contents of teraterm log file to screen.
Write-Output "$(Get-Date -Format yyyy-MM-ddThh:mm:sszzz) [INFO]: Log file: $ssh_log"
### TeraTerm abnormal termination: A case where an already established ssh session is forcibly terminated due to network disconnection or the like.
if ($ssh_process.ExitCode -ne 0)
{
    Write-Output "$(Get-Date -Format yyyy-MM-ddThh:mm:sszzz) [ERROR]: ttermpro.exe exit code NOT equal 0."
}
[Console]::ReadKey() | Out-Null
exit 0

@setlocal enableextensions enabledelayedexpansion & set "PATH0=%~f0" & PowerShell.exe -Command "& (Invoke-Expression -Command ('{#' + ((Get-Content '!PATH0:'=''!') -join \"`n\") + '}'))" %* & exit /b !errorlevel!
#
# - Name
#     ssh.bat
#
# - Contents
#     Simplify SSH Connect by Tera Term.
#     <Windows> + <R> => ssh root@192.168.1.100
#
# - Install
#     powershell.exe -Command "Invoke-RestMethod -Uri "https://initsh.github.io/ps1/ssh.bat" -OutFile "$env:USERPROFILE\ssh.bat""
#
# - Reference
#     http://pf-j.sakura.ne.jp/program/tips/ps1bat2.htm
#
# - Revision
#     2016-12-28 created.
#     2017-04-14 modified.
#     2017-05-22 modified.
#     yyyy-MM-dd modified.
#

################
# constant
################
#[System.String] $base_dir = "$env:Userprofile"
[System.String] $base_dir = "$env:Userprofile\GoogleDrive"
[System.String] $ssh_dir  = "$base_dir\ssh"
[System.String] $log_dir  = "$ssh_dir\log"
[System.String] $key_dir  = "$ssh_dir\key"
[System.String] $csv_file = "$ssh_dir\hosts.csv"
[System.String] $tt_install_uri = "https://ja.osdn.net/frs/redir.php?m=ymu&f=%2Fttssh2%2F67179%2Fteraterm-4.94.exe"
[System.String] $tt_install_exe = "$env:USERPROFILE\Downloads\teraterm-4.94.exe"

################
# variable
################
[System.String] $date = Get-Date -Format yyyyMMdd
[System.String] $time = Get-Date -Format HHmmss

################
# main
################
### Create directorys.
if ((Get-Item $ssh_dir).Mode | Select-String -NotMatch '^d') { mkdir $ssh_dir; }
if ((Get-Item $log_dir).Mode | Select-String -NotMatch '^d') { mkdir $log_dir; }
if ((Get-Item $key_dir).Mode | Select-String -NotMatch '^d') { mkdir $ssh_dir; }
if (-Not (Test-Path $csv_file))
{
    Write-Output @'
Hostname,Port,Username,AuthType,Value,Alias
# In the first line, Header information is written. Please do not edit!

# Please refer to the following and set it like the description example.
# Hostname,PortNumber,Username,AuthenticationType[password|publickey],Value[Passphrase|NameOfSecretKey],Set an alias character string as an argument of ssh command. UPN notation is recommended.

# description example:
www.example.com,22,admin,publickey,id_rsa,admin@www.example.com
192.168.1.100,22,root,password,P@ssw0rd,root@192.168.1.100
'@ > $csv_file
    Write-Output "$(Get-Date -Format yyyy-MM-ddTHH:mm:sszzz) [NOTICE]: Check the file( $csv_file ) and set it as shown in the description example."
    Write-Output "$(Get-Date -Format yyyy-MM-ddTHH:mm:sszzz) [NOTICE]: Edit the file( $csv_file ) and try again."
    notepad $csv_file
    [Console]::ReadKey() | Out-Null
    exit 1
}

### Search for ttermpro.exe from the directory where teraterm was installed and get the full path of ttermpro.exe.
[System.String] $ssh_client = Get-ChildItem -recurse "C:\Program Files*\teraterm" | Where-Object { $_.Name -match "ttermpro" } | ForEach-Object { $_.FullName }
###
if (-Not ($?) -Or -Not (Test-Path -Path $ssh_client))
{
    Invoke-WebRequest -Uri $tt_install_uri -OutFile $tt_install_exe
    Start-Process -FilePath $tt_install_exe -PassThru -Wait
    [System.String] $ssh_client = Get-ChildItem -recurse "C:\Program Files*\teraterm" | Where-Object { $_.Name -match "ttermpro" } | ForEach-Object { $_.FullName }
    if (-Not ($?) -Or -Not (Test-Path -Path $ssh_client))
    {
        Write-Output "$(Get-Date -Format yyyy-MM-ddTHH:mm:sszzz) [ERROR]: ttermpro.exe not found in `"C:\Program Files*`"."
        [Console]::ReadKey() | Out-Null
        exit 1
    }
}

if ($args[0])
{
    ### $args[0] = Alias. UPN notation is recommended.
    [System.String] $ssh_alias = $args[0]
    [System.Array] $ssh_args = $args[0] -split "@"
    [System.String] $ssh_log = "$log_dir\" + $ssh_args[1] + "_" + $ssh_args[0] + "_" + $date + "_" + $time + ".log"

    ### Get a match with the value of $args[0] and the value of Alias in CSV.
    [System.Array] $csv_data = Import-Csv $csv_file | Where-Object { $_.Alias -eq $ssh_alias }

    ### If there is a match between the value of $args[0] and the value of Alias in CSV,
    if ($csv_data)
    {
        ### Create arguments to pass to ttermpro.exe.
        [System.String] $opt_host = "ssh2://" + $csv_data[0].Hostname + ":" + $csv_data[0].Port
        [System.String] $opt_user = "/user=" + $csv_data[0].Username
        [System.String] $opt_auth = "/auth=" + $csv_data[0].AuthType
        if ($csv_data[0].AuthType -eq "password")
        {
            [System.String] $opt_value = "/passwd=" + $csv_data[0].Value
        }
        elseif ($csv_data[0].AuthType -eq "publickey")
        {
            [System.String] $opt_value = "/keyfile=$key_dir\" + $csv_data[0].Value
        }
        [System.String] $opt_dir = "/FD=$ssh_dir"
        [System.String] $opt_log = "/L=$ssh_log"

        [System.Array] $opt_array = @($opt_host,$opt_user,$opt_auth,$opt_value,$opt_dir,$opt_log,"/ssh-v","/LA=J")

    }
    ### If there is no matching match between the value of $args[0] and the value of Alias in CSV,
    else
    {
        ### Show contents of CSV.
        Get-Item $csv_file
        Import-Csv $csv_file | Where-Object { ($_.Alias) } | Select-Object Username,Hostname,Alias | Format-Table -AutoSize
        [Console]::ReadKey() | Out-Null
        exit 0
    }
}
else
{
    [System.String] $ssh_log = "$log_dir\undefined_undefined_" + $date + "_" + $time + ".log"
    [System.String] $opt_dir = "/FD=" + $ssh_dir
    [System.String] $opt_log = "/L=$ssh_log"
    [System.Array] $opt_array = @($opt_dir,$opt_log,"/ssh-v","/LA=J")
}

### Run teraterm.
$ssh_process = Start-Process -FilePath $ssh_client -ArgumentList $opt_array -PassThru -Wait
### Change attribute of teraterm log file to read only.
Set-ItemProperty -Path $ssh_log -Name Attributes -Value Readonly
### Display the contents of teraterm log file (personal preference...).
Get-Content -Path $ssh_log
### Output contents of teraterm log file to screen.
Write-Output "$(Get-Date -Format yyyy-MM-ddThh:mm:sszzz) [INFO]: Log file: $ssh_log"
### TeraTerm abnormal termination: A case where an already established ssh session is forcibly terminated due to network disconnection or the like.
if ($ssh_process.ExitCode -ne 0)
{
    Write-Output "$(Get-Date -Format yyyy-MM-ddThh:mm:sszzz) [ERROR]: ttermpro.exe exit code NOT equal 0."
}
[Console]::ReadKey() | Out-Null
exit 0

Update ssh.bat

Update ssh.bat


echo OFF

where curl
if errorlevel 1 (
    if not exist user_install.bat (
        echo "You must first install the cURL program or download manually the user_install.bat file"
        exit 1
    )
)

if exist user_install.bat (
    set CLEAN_INSTALL=0
) else (
    set CLEAN_INSTALL=1
)
if not exist user_install.bat curl https://raw.githubusercontent.com/StatisKit/StatisKit/master/doc/user/user_install.bat -o user_install.bat
if errorlevel 1 (
    echo "Download of the user_install.bat file for Conda installation failed."
    echo "Developer configuration failed."
    exit 1
)
call user_install.bat
if errorlevel 1 exit 1
if "%CLEAN_INSTALL%"=="1" del user_install.bat

python -c "import conda_build" >nul 2>nul
if errorlevel 1 (
    conda install -n root conda-build -y
) else (
    conda update -n root conda-build -y
)
python -c "import binstar_client" >nul 2>nul
if errorlevel 1 (
    conda install -n root anaconda-client -y
) else (
    conda update -n root anaconda-client -y
)

:: if "%ENVIRONMENT%"== "" (
::     conda env update statiskit/statiskit-dev
::     if errorlevel 1 (
::         echo "Installation of the development environment failed."
::         echo "Developer configuration failed."
::         exit 1
::     ) else (
::         echo "Developer configuration succeded."
::     )
:: ) else (
::     conda env update statiskit/statiskit-dev -n %ENVIRONMENT%
::     if errorlevel 1 (
::         echo "Installation of the development environment failed."
::         echo "Developer configuration failed."
::         exit 1
::     ) else (
::         echo "Developer configuration succeded."
::     )
:: )

echo OFF

echo OFF

where curl
if errorlevel 1 (
    if not exist user_install.bat (
        echo "You must first install the cURL program or download manually the user_install.bat file"
        exit 1
    )
)

if exist user_install.bat (
    set CLEAN_INSTALL=0
) else (
    set CLEAN_INSTALL=1
)
if not exist user_install.bat curl https://raw.githubusercontent.com/StatisKit/StatisKit/master/doc/user/user_install.bat -o user_install.bat
if errorlevel 1 (
    echo "Download of the user_install.bat file for Conda installation failed."
    echo "Developer configuration failed."
    exit 1
)
call user_install.bat
if errorlevel 1 exit 1
if "%CLEAN_INSTALL%"=="1" del user_install.bat

python -c "import conda_build" >nul 2>nul
if errorlevel 1 (
    conda install -n root conda-build -y
) else (
    conda update -n root conda-build -y
)
python -c "import binstar_client" >nul 2>nul
if errorlevel 1 (
    conda install -n root anaconda-client -y
) else (
    conda update -n root anaconda-client -y
)

if "%ENVIRONMENT%"=="" (
    conda env update statiskit/statiskit-dev
    if errorlevel 1 (
        echo "Installation of the development environment failed."
        echo "Developer configuration failed."
        exit 1
    ) else (
        echo "Developer configuration succeded."
    )
) else (
   if "%ENVIRONMENT%"=="false" (
     echo "Devoloper configuration incompleted."
   ) else (
   conda env update statiskit/statiskit-dev -n %ENVIRONMENT%
     if errorlevel 1 (
         echo "Installation of the development environment failed."
         echo "Developer configuration failed."
         exit 1
     ) else (
         echo "Developer configuration succeded."
     )
   )
)

echo OFF

Update developer_install.bat

Update developer_install.bat


:<<"::CMDLITERAL"
@ECHO OFF
REM  Usage:
REM powershell -command "& { (New-Object Net.WebClient).DownloadFile('https://raw.githubusercontent.com/jgstew/tools/master/CMD/install_bigfix.bat', 'install_bigfix.bat') }" -ExecutionPolicy Bypass
REM install_bigfix.bat __FQDN_OF_ROOT_OR_RELAY__

REM    Source: https://github.com/jgstew/tools/blob/master/CMD/install_bigfix.bat
REM   Related: https://github.com/jgstew/tools/blob/master/bash/install_bigfix.sh

REM http://stackoverflow.com/questions/2541767/what-is-the-proper-way-to-test-if-variable-is-empty-in-a-batch-file-if-not-1
IF [%1] == [] ECHO please provide FQDN for root or relay && EXIT /B
REM KNOWN ISSUE: if enhanced security is enabled on root/relay, then must use HTTPS for masthead download. This will mean that the download part will have to ignore SSL errors
SET MASTHEADURL=http://%1:52311/masthead/masthead.afxm
SET BASEFOLDER=C:\Windows\Temp

REM  TODO: handle clientsettings.cfg or masthead.afxm or actionsite.afxm already in the CWD
REM  TODO: check for admin rights http://stackoverflow.com/questions/4051883/batch-script-how-to-check-for-admin-rights

REM http://stackoverflow.com/questions/4781772/how-to-test-if-an-executable-exists-in-the-path-from-a-windows-batch-file
where /q powershell || ECHO Cound not find powershell. && EXIT /B

@ECHO ON
REM this following line will need to ignore SSL errors if HTTPS is used instead of HTTP
powershell -command "& { (New-Object Net.WebClient).DownloadFile('%MASTHEADURL%', '%BASEFOLDER%\actionsite.afxm') }" -ExecutionPolicy Bypass
powershell -command "& { (New-Object Net.WebClient).DownloadFile('http://software.bigfix.com/download/bes/95/BigFix-BES-Client-9.5.1.9.exe', '%BASEFOLDER%\BESClient.exe') }" -ExecutionPolicy Bypass
@ECHO OFF

REM https://www.ibm.com/developerworks/community/wikis/home?lang=en#!/wiki/Tivoli%20Endpoint%20Manager/page/Configuration%20Settings
REM https://gist.github.com/jgstew/51a99ab4b5997efa0318
REM http://stackoverflow.com/questions/1702762/how-to-create-an-empty-file-at-the-command-line-in-windows
REM http://stackoverflow.com/questions/7225630/how-to-echo-2-no-quotes-to-a-file-from-a-batch-script
type NUL > %BASEFOLDER%\clientsettings.cfg
REM  TODO: only do the following line if FQDN_variable is set
>>%BASEFOLDER%\clientsettings.cfg ECHO _BESClient_RelaySelect_FailoverRelay=http://%1:52311/bfmirror/downloads/
>>%BASEFOLDER%\clientsettings.cfg ECHO _BESClient_Resource_StartupNormalSpeed=1
>>%BASEFOLDER%\clientsettings.cfg ECHO _BESClient_Download_RetryMinutes=1
>>%BASEFOLDER%\clientsettings.cfg ECHO _BESClient_Resource_WorkIdle=20
>>%BASEFOLDER%\clientsettings.cfg ECHO _BESClient_Resource_SleepIdle=500
>>%BASEFOLDER%\clientsettings.cfg ECHO _BESClient_Comm_CommandPollEnable=1
>>%BASEFOLDER%\clientsettings.cfg ECHO _BESClient_Comm_CommandPollIntervalSeconds=10800
>>%BASEFOLDER%\clientsettings.cfg ECHO _BESClient_Log_Days=30
>>%BASEFOLDER%\clientsettings.cfg ECHO _BESClient_Download_UtilitiesCacheLimitMB=500
>>%BASEFOLDER%\clientsettings.cfg ECHO _BESClient_Download_DownloadsCacheLimitMB=5000
>>%BASEFOLDER%\clientsettings.cfg ECHO _BESClient_Download_MinimumDiskFreeMB=2000

ECHO
ECHO %0
ECHO %1
ECHO %MASTHEADURL%
ECHO
ECHO Installing BigFix now.
%BASEFOLDER%\BESClient.exe /s /v"/l*voicewarmup %BASEFOLDER%\install.log /qn"

EXIT /B
::CMDLITERAL

#!/usr/bin/env bash
# kickstart bigfix install
# current target - Mac OS X, Debian, Ubuntu, RHEL, CentOS, Fedora
#
# Reference: https://support.bigfix.com/bes/install/besclients-nonwindows.html
#
# Usage:
#   curl -o install_bigfix.sh https://raw.githubusercontent.com/jgstew/tools/master/bash/install_bigfix.sh
#   chmod u+x install_bigfix.sh
#   ./install_bigfix.sh __ROOT_OR_RELAY_FQDN__
#
# Single Line:
#  curl -O https://raw.githubusercontent.com/jgstew/tools/master/bash/install_bigfix.sh ; chmod u+x install_bigfix.sh ; ./install_bigfix.sh __ROOT_OR_RELAY_FQDN__

# NOTE: AMD64 compatible OS architecture is assumed (x86, Itanium, and Power are not common, but could be added)

# TODO: if Mac OS X then get clientsettings.cfg from CWD (currently creating a default one)

# TODO: use the masthead file in current directory if present

# http://stackoverflow.com/questions/592620/check-if-a-program-exists-from-a-bash-script
# FUNCTION: check if command exists
command_exists () {
  type "$1" &> /dev/null ;
}

# if $1 exists, then set MASTHEADURL
# http://www.tldp.org/LDP/abs/html/comparison-ops.html
if [ -n "$1" ]; then
  MASTHEADURL="http://$1:52311/masthead/masthead.afxm"
fi

# check for x32bit or x64bit OS
MACHINETYPE=`uname -m`

# set OS_BIT variable based upon MACHINE_TYPE (this currently assumes either Intel 32bit or AMD 64bit)
# if machine_type does not contain 64 then 32bit else 64bit (assume 64 unless otherwise noted)
if [[ $MACHINETYPE != *"64"* ]]; then
  OSBIT=x32
else
  OSBIT=x64
  # KNOWN ISSUE: this will incorrectly assume AMD64 compatible processor in the case of PowerPC64
fi

############################################################
# TODO: add more linux cases, not all are handled

if [[ $OSTYPE == darwin* ]]; then
  # Mac OS X
  INSTALLERURL="http://software.bigfix.com/download/bes/95/BESAgent-9.5.1.9-BigFix_MacOSX10.7.pkg"
  INSTALLDIR="/tmp"
  INSTALLER="/tmp/BESAgent.pkg"

  # create clientsettings.cfg file
  echo -n > $INSTALLDIR/clientsettings.cfg
  >> $INSTALLDIR/clientsettings.cfg echo _BESClient_RelaySelect_FailoverRelay=http://$1:52311/bfmirror/downloads/
  >> $INSTALLDIR/clientsettings.cfg echo _BESClient_Resource_StartupNormalSpeed=1
  >> $INSTALLDIR/clientsettings.cfg echo _BESClient_Download_RetryMinutes=1
  >> $INSTALLDIR/clientsettings.cfg echo _BESClient_Resource_WorkIdle=20
  >> $INSTALLDIR/clientsettings.cfg echo _BESClient_Resource_SleepIdle=500
  >> $INSTALLDIR/clientsettings.cfg echo _BESClient_Comm_CommandPollEnable=1
  >> $INSTALLDIR/clientsettings.cfg echo _BESClient_Comm_CommandPollIntervalSeconds=10800
  >> $INSTALLDIR/clientsettings.cfg echo _BESClient_Log_Days=30
  >> $INSTALLDIR/clientsettings.cfg echo _BESClient_Download_UtilitiesCacheLimitMB=500
  >> $INSTALLDIR/clientsettings.cfg echo _BESClient_Download_DownloadsCacheLimitMB=5000
  >> $INSTALLDIR/clientsettings.cfg echo _BESClient_Download_MinimumDiskFreeMB=2000
else
  # For most Linux:
  INSTALLDIR="/etc/opt/BESClient"

  # if dpkg exists (Debian)
  if command_exists dpkg ; then
    # Debian based
    INSTALLER="BESAgent.deb"

    # check distribution
    DEBDIST=`cat /etc/lsb-release | grep '^DISTRIB_ID' | awk -F=  '{ print $2 }'`

    if [[ $OSBIT == x64 ]]; then
      URLBITS=amd64
    else
      URLBITS=i386
    fi

    if [[ $DEBDIST == Ubuntu* ]]; then
      # Ubuntu
      INSTALLERURL="http://software.bigfix.com/download/bes/95/BESAgent-9.5.1.9-ubuntu10.$URLBITS.deb"
    else
      # Debian
      INSTALLERURL="http://software.bigfix.com/download/bes/95/BESAgent-9.5.1.9-debian6.$URLBITS.deb"
    fi
  fi # END_IF Debian (dpkg)

  # if rpm exists
  if command_exists rpm ; then
    # rpm - Currently assuming RedHat based
    INSTALLER="BESAgent.rpm"

    if [[ $OSBIT == x64 ]]; then
      URLBITS=x86_64
    else
      URLBITS=i686
    fi

    INSTALLERURL="http://software.bigfix.com/download/bes/95/BESAgent-9.5.1.9-rhe5.$URLBITS.rpm"

    # because only RHEL style dist is currently supported for RPM installs, then exit if not RHEL family
    if [ ! -f /etc/redhat-release ] ; then
      echo Only RHEL, CentOS, or Fedora currently supported for RPM installs
      exit 1
    fi # END_IF not-RHEL-family
  fi # END_IF exists rpm

fi # END_IF darwin
############################################################

# MUST HAVE ROOT PRIV
if [ "$(id -u)" != "0" ]; then
  # dump out data for debugging
  echo
  echo OSTYPE=$OSTYPE
  echo MACHINETYPE=$MACHINETYPE
  echo OSBIT=$OSBIT
  echo INSTALLDIR=$INSTALLDIR
  echo INSTALLER=$INSTALLER
  echo INSTALLERURL=$INSTALLERURL
  echo URLBITS=$URLBITS
  echo MASTHEADURL=$MASTHEADURL
  echo DEBDIST=$DEBDIST
  echo
  echo "Sorry, you are not root. Exiting."
  echo
  exit 1
fi

############################################################
###    Start execution:    #################################
############################################################

# Create $INSTALLDIR folder if missing
if [ ! -d "$INSTALLDIR" ]; then
  # Control will enter here if $INSTALLDIR doesn't exist.
  mkdir $INSTALLDIR
fi

#### Downloads #############################################

if command_exists curl ; then
  # Download the BigFix agent (using cURL because it is on most Linux & OS X by default)
  curl -o $INSTALLER $INSTALLERURL
  # Download the masthead, renamed, into the correct location
  # TODO: get masthead from CWD instead if present
  # http://unix.stackexchange.com/questions/60750/does-curl-have-a-no-check-certificate-option-like-wget
  #  the url for the masthead will not use a valid SSL certificate, instead it will use one tied to the masthead itself
  curl --insecure -o $INSTALLDIR/actionsite.afxm $MASTHEADURL
  # TODO: add error checking to ensure masthead was downloaded
else
  if command_exists wget ; then
    # this is run if curl doesn't exist, but wget does
    # download using wget
    # http://stackoverflow.com/questions/16678487/wget-command-to-download-a-file-and-save-as-a-different-filename
    # https://www.gnu.org/software/wget/manual/html_node/HTTPS-_0028SSL_002fTLS_0029-Options.html
    wget $MASTHEADURL -O $INSTALLDIR/actionsite.afxm --no-check-certificate
    # TODO: add error checking to ensure masthead was downloaded
    wget $INSTALLERURL -O $INSTALLER
  else
    echo neither wget nor curl is installed.
    echo not able to download required files.
    echo exiting...
    exit 2
  fi
fi

# open up linux firewall to accept UDP 52311 - iptables
if command_exists iptables ; then
  iptables -A INPUT -p udp --dport 52311 -j ACCEPT
fi
# open up linux firewall to accept UDP 52311 - firewall-cmd
if command_exists firewall-cmd ; then
  firewall-cmd --zone=public --add-port=52311/udp --permanent
fi

# install BigFix client
if [[ $INSTALLER == *.deb ]]; then
  #  debian (DEB)
  dpkg -i $INSTALLER
fi
if [[ $INSTALLER == *.pkg ]]; then
  #  Mac OS X (PKG)
  installer -pkg $INSTALLER -target /
  # TODO: add case for Solaris
  # pkgadd -d $INSTALLER  #  Solaris (PKG)
fi
if [[ $INSTALLER == *.rpm ]]; then
  #  linux (RPM)
  # if file `/etc/init.d/besclient` exists then do upgrade
  if [ -f /etc/init.d/besclient ]; then
    /etc/init.d/besclient stop
    rpm -U $INSTALLER
  else
    rpm -ivh $INSTALLER
  fi
fi

### start the BigFix client (required for most linux dist)
# if file `/etc/init.d/besclient` exists
if [ -f /etc/init.d/besclient ]; then
  /etc/init.d/besclient start
fi

### Referenes:
# - http://stackoverflow.com/questions/733824/how-to-run-a-sh-script-in-an-unix-console-mac-terminal
# - http://stackoverflow.com/questions/394230/detect-the-os-from-a-bash-script
# - http://wiki.bash-hackers.org/scripting/posparams
# - http://stackoverflow.com/questions/6482377/check-existence-of-input-argument-in-a-bash-shell-script
# - http://stackoverflow.com/questions/592620/check-if-a-program-exists-from-a-bash-script
# - https://forum.bigfix.com/t/script-to-kickstart-the-installation-of-bigfix-on-os-x-debian-family-rhel-family/17023
# - http://stackoverflow.com/questions/30557508/bash-checking-if-string-does-not-contain-other-string

:<<"::CMDLITERAL"
@ECHO OFF
REM  Usage:
REM powershell -command "& { (New-Object Net.WebClient).DownloadFile('https://raw.githubusercontent.com/jgstew/tools/master/CMD/install_bigfix.bat', 'install_bigfix.bat') }" -ExecutionPolicy Bypass
REM install_bigfix.bat __FQDN_OF_ROOT_OR_RELAY__

REM    Source: https://github.com/jgstew/tools/blob/master/CMD/install_bigfix.bat
REM   Related: https://github.com/jgstew/tools/blob/master/bash/install_bigfix.sh

REM http://stackoverflow.com/questions/2541767/what-is-the-proper-way-to-test-if-variable-is-empty-in-a-batch-file-if-not-1
IF [%1] == [] ECHO please provide FQDN for root or relay && EXIT /B
REM KNOWN ISSUE: if enhanced security is enabled on root/relay, then must use HTTPS for masthead download. This will mean that the download part will have to ignore SSL errors
SET MASTHEADURL=http://%1:52311/masthead/masthead.afxm
SET BASEFOLDER=C:\Windows\Temp

REM  TODO: handle clientsettings.cfg or masthead.afxm or actionsite.afxm already in the CWD
REM  TODO: check for admin rights http://stackoverflow.com/questions/4051883/batch-script-how-to-check-for-admin-rights

REM http://stackoverflow.com/questions/4781772/how-to-test-if-an-executable-exists-in-the-path-from-a-windows-batch-file
where /q powershell || ECHO Cound not find powershell. && EXIT /B

@ECHO ON
REM this following line will need to ignore SSL errors if HTTPS is used instead of HTTP
powershell -command "& { (New-Object Net.WebClient).DownloadFile('%MASTHEADURL%', '%BASEFOLDER%\actionsite.afxm') }" -ExecutionPolicy Bypass
powershell -command "& { (New-Object Net.WebClient).DownloadFile('http://software.bigfix.com/download/bes/95/BigFix-BES-Client-9.5.1.9.exe', '%BASEFOLDER%\BESClient.exe') }" -ExecutionPolicy Bypass
@ECHO OFF

REM https://www.ibm.com/developerworks/community/wikis/home?lang=en#!/wiki/Tivoli%20Endpoint%20Manager/page/Configuration%20Settings
REM https://gist.github.com/jgstew/51a99ab4b5997efa0318
REM http://stackoverflow.com/questions/1702762/how-to-create-an-empty-file-at-the-command-line-in-windows
REM http://stackoverflow.com/questions/7225630/how-to-echo-2-no-quotes-to-a-file-from-a-batch-script
type NUL > %BASEFOLDER%\clientsettings.cfg
REM  TODO: only do the following line if FQDN_variable is set
>>%BASEFOLDER%\clientsettings.cfg ECHO _BESClient_RelaySelect_FailoverRelay=http://%1:52311/bfmirror/downloads/
>>%BASEFOLDER%\clientsettings.cfg ECHO _BESClient_Resource_StartupNormalSpeed=1
>>%BASEFOLDER%\clientsettings.cfg ECHO _BESClient_Download_RetryMinutes=1
>>%BASEFOLDER%\clientsettings.cfg ECHO _BESClient_Resource_WorkIdle=20
>>%BASEFOLDER%\clientsettings.cfg ECHO _BESClient_Resource_SleepIdle=500
>>%BASEFOLDER%\clientsettings.cfg ECHO _BESClient_Comm_CommandPollEnable=1
>>%BASEFOLDER%\clientsettings.cfg ECHO _BESClient_Comm_CommandPollIntervalSeconds=10800
>>%BASEFOLDER%\clientsettings.cfg ECHO _BESClient_Log_Days=30
>>%BASEFOLDER%\clientsettings.cfg ECHO _BESClient_Download_UtilitiesCacheLimitMB=500
>>%BASEFOLDER%\clientsettings.cfg ECHO _BESClient_Download_DownloadsCacheLimitMB=5000
>>%BASEFOLDER%\clientsettings.cfg ECHO _BESClient_Download_MinimumDiskFreeMB=2000

ECHO
ECHO %0
ECHO %1
ECHO %MASTHEADURL%
ECHO
ECHO Installing BigFix now.
%BASEFOLDER%\BESClient.exe /s /v"/l*voicewarmup %BASEFOLDER%\install_bigfix.log /qn"

EXIT /B
::CMDLITERAL

#!/usr/bin/env bash
# kickstart bigfix install
# current target - Mac OS X, Debian, Ubuntu, RHEL, CentOS, Fedora
#
# Reference: https://support.bigfix.com/bes/install/besclients-nonwindows.html
#
# Usage:
#   curl -o install_bigfix.sh https://raw.githubusercontent.com/jgstew/tools/master/bash/install_bigfix.sh
#   chmod u+x install_bigfix.sh
#   ./install_bigfix.sh __ROOT_OR_RELAY_FQDN__
#
# Single Line:
#  curl -O https://raw.githubusercontent.com/jgstew/tools/master/bash/install_bigfix.sh ; chmod u+x install_bigfix.sh ; ./install_bigfix.sh __ROOT_OR_RELAY_FQDN__

# NOTE: AMD64 compatible OS architecture is assumed (x86, Itanium, and Power are not common, but could be added)

# TODO: if Mac OS X then get clientsettings.cfg from CWD (currently creating a default one)

# TODO: use the masthead file in current directory if present

# http://stackoverflow.com/questions/592620/check-if-a-program-exists-from-a-bash-script
# FUNCTION: check if command exists
command_exists () {
  type "$1" &> /dev/null ;
}

# if $1 exists, then set MASTHEADURL
# http://www.tldp.org/LDP/abs/html/comparison-ops.html
if [ -n "$1" ]; then
  MASTHEADURL="http://$1:52311/masthead/masthead.afxm"
fi

# check for x32bit or x64bit OS
MACHINETYPE=`uname -m`

# set OS_BIT variable based upon MACHINE_TYPE (this currently assumes either Intel 32bit or AMD 64bit)
# if machine_type does not contain 64 then 32bit else 64bit (assume 64 unless otherwise noted)
if [[ $MACHINETYPE != *"64"* ]]; then
  OSBIT=x32
else
  OSBIT=x64
  # KNOWN ISSUE: this will incorrectly assume AMD64 compatible processor in the case of PowerPC64
fi

############################################################
# TODO: add more linux cases, not all are handled

if [[ $OSTYPE == darwin* ]]; then
  # Mac OS X
  INSTALLERURL="http://software.bigfix.com/download/bes/95/BESAgent-9.5.1.9-BigFix_MacOSX10.7.pkg"
  INSTALLDIR="/tmp"
  INSTALLER="/tmp/BESAgent.pkg"

  # create clientsettings.cfg file
  echo -n > $INSTALLDIR/clientsettings.cfg
  >> $INSTALLDIR/clientsettings.cfg echo _BESClient_RelaySelect_FailoverRelay=http://$1:52311/bfmirror/downloads/
  >> $INSTALLDIR/clientsettings.cfg echo _BESClient_Resource_StartupNormalSpeed=1
  >> $INSTALLDIR/clientsettings.cfg echo _BESClient_Download_RetryMinutes=1
  >> $INSTALLDIR/clientsettings.cfg echo _BESClient_Resource_WorkIdle=20
  >> $INSTALLDIR/clientsettings.cfg echo _BESClient_Resource_SleepIdle=500
  >> $INSTALLDIR/clientsettings.cfg echo _BESClient_Comm_CommandPollEnable=1
  >> $INSTALLDIR/clientsettings.cfg echo _BESClient_Comm_CommandPollIntervalSeconds=10800
  >> $INSTALLDIR/clientsettings.cfg echo _BESClient_Log_Days=30
  >> $INSTALLDIR/clientsettings.cfg echo _BESClient_Download_UtilitiesCacheLimitMB=500
  >> $INSTALLDIR/clientsettings.cfg echo _BESClient_Download_DownloadsCacheLimitMB=5000
  >> $INSTALLDIR/clientsettings.cfg echo _BESClient_Download_MinimumDiskFreeMB=2000
else
  # For most Linux:
  INSTALLDIR="/etc/opt/BESClient"

  # if dpkg exists (Debian)
  if command_exists dpkg ; then
    # Debian based
    INSTALLER="BESAgent.deb"

    # check distribution
    DEBDIST=`cat /etc/lsb-release | grep '^DISTRIB_ID' | awk -F=  '{ print $2 }'`

    if [[ $OSBIT == x64 ]]; then
      URLBITS=amd64
    else
      URLBITS=i386
    fi

    if [[ $DEBDIST == Ubuntu* ]]; then
      # Ubuntu
      INSTALLERURL="http://software.bigfix.com/download/bes/95/BESAgent-9.5.1.9-ubuntu10.$URLBITS.deb"
    else
      # Debian
      INSTALLERURL="http://software.bigfix.com/download/bes/95/BESAgent-9.5.1.9-debian6.$URLBITS.deb"
    fi
  fi # END_IF Debian (dpkg)

  # if rpm exists
  if command_exists rpm ; then
    # rpm - Currently assuming RedHat based
    INSTALLER="BESAgent.rpm"

    if [[ $OSBIT == x64 ]]; then
      URLBITS=x86_64
    else
      URLBITS=i686
    fi

    INSTALLERURL="http://software.bigfix.com/download/bes/95/BESAgent-9.5.1.9-rhe5.$URLBITS.rpm"

    # because only RHEL style dist is currently supported for RPM installs, then exit if not RHEL family
    if [ ! -f /etc/redhat-release ] ; then
      echo Only RHEL, CentOS, or Fedora currently supported for RPM installs
      exit 1
    fi # END_IF not-RHEL-family
  fi # END_IF exists rpm

fi # END_IF darwin
############################################################

# MUST HAVE ROOT PRIV
if [ "$(id -u)" != "0" ]; then
  # dump out data for debugging
  echo
  echo OSTYPE=$OSTYPE
  echo MACHINETYPE=$MACHINETYPE
  echo OSBIT=$OSBIT
  echo INSTALLDIR=$INSTALLDIR
  echo INSTALLER=$INSTALLER
  echo INSTALLERURL=$INSTALLERURL
  echo URLBITS=$URLBITS
  echo MASTHEADURL=$MASTHEADURL
  echo DEBDIST=$DEBDIST
  echo
  echo "Sorry, you are not root. Exiting."
  echo
  exit 1
fi

############################################################
###    Start execution:    #################################
############################################################

# Create $INSTALLDIR folder if missing
if [ ! -d "$INSTALLDIR" ]; then
  # Control will enter here if $INSTALLDIR doesn't exist.
  mkdir $INSTALLDIR
fi

#### Downloads #############################################

if command_exists curl ; then
  # Download the BigFix agent (using cURL because it is on most Linux & OS X by default)
  curl -o $INSTALLER $INSTALLERURL
  # Download the masthead, renamed, into the correct location
  # TODO: get masthead from CWD instead if present
  # http://unix.stackexchange.com/questions/60750/does-curl-have-a-no-check-certificate-option-like-wget
  #  the url for the masthead will not use a valid SSL certificate, instead it will use one tied to the masthead itself
  curl --insecure -o $INSTALLDIR/actionsite.afxm $MASTHEADURL
  # TODO: add error checking to ensure masthead was downloaded
else
  if command_exists wget ; then
    # this is run if curl doesn't exist, but wget does
    # download using wget
    # http://stackoverflow.com/questions/16678487/wget-command-to-download-a-file-and-save-as-a-different-filename
    # https://www.gnu.org/software/wget/manual/html_node/HTTPS-_0028SSL_002fTLS_0029-Options.html
    wget $MASTHEADURL -O $INSTALLDIR/actionsite.afxm --no-check-certificate
    # TODO: add error checking to ensure masthead was downloaded
    wget $INSTALLERURL -O $INSTALLER
  else
    echo neither wget nor curl is installed.
    echo not able to download required files.
    echo exiting...
    exit 2
  fi
fi

# open up linux firewall to accept UDP 52311 - iptables
if command_exists iptables ; then
  iptables -A INPUT -p udp --dport 52311 -j ACCEPT
fi
# open up linux firewall to accept UDP 52311 - firewall-cmd
if command_exists firewall-cmd ; then
  firewall-cmd --zone=public --add-port=52311/udp --permanent
fi

# install BigFix client
if [[ $INSTALLER == *.deb ]]; then
  #  debian (DEB)
  dpkg -i $INSTALLER
fi
if [[ $INSTALLER == *.pkg ]]; then
  #  Mac OS X (PKG)
  installer -pkg $INSTALLER -target /
  # TODO: add case for Solaris
  # pkgadd -d $INSTALLER  #  Solaris (PKG)
fi
if [[ $INSTALLER == *.rpm ]]; then
  #  linux (RPM)
  # if file `/etc/init.d/besclient` exists then do upgrade
  if [ -f /etc/init.d/besclient ]; then
    /etc/init.d/besclient stop
    rpm -U $INSTALLER
  else
    rpm -ivh $INSTALLER
  fi
fi

### start the BigFix client (required for most linux dist)
# if file `/etc/init.d/besclient` exists
if [ -f /etc/init.d/besclient ]; then
  /etc/init.d/besclient start
fi

### Referenes:
# - http://stackoverflow.com/questions/733824/how-to-run-a-sh-script-in-an-unix-console-mac-terminal
# - http://stackoverflow.com/questions/394230/detect-the-os-from-a-bash-script
# - http://wiki.bash-hackers.org/scripting/posparams
# - http://stackoverflow.com/questions/6482377/check-existence-of-input-argument-in-a-bash-shell-script
# - http://stackoverflow.com/questions/592620/check-if-a-program-exists-from-a-bash-script
# - https://forum.bigfix.com/t/script-to-kickstart-the-installation-of-bigfix-on-os-x-debian-family-rhel-family/17023
# - http://stackoverflow.com/questions/30557508/bash-checking-if-string-does-not-contain-other-string

Update install_bigfix_universal.bat

Update install_bigfix_universal.bat


SET JAVA_HOME=E:\Java\jdk1.8.0_66
SET ANT_HOME=E:\apache-ant-1.9.6
SET PATH=%JAVA_HOME%\bin;%ANT_HOME%\bin;%PATH%
SET ANT_OPTS=-Xms1024m  -Xmx1024m
ant -f build.xml

SET JAVA_HOME=C:\Program Files\java\jdk1.8.0_45
SET ANT_HOME=C:\apache-ant-1.9.2
SET PATH=%JAVA_HOME%\bin;%ANT_HOME%\bin;%PATH%
SET ANT_OPTS=-Xms1024m  -Xmx1024m
ant -f build.xml

Revert "ff"

Revert "ff"

This reverts commit d5a117b7aba24aa6a1ef37eb0b43110de2751e94.


SET bin_dir=%~dp0
SET TOP_DIR=%bin_dir%\..\..\

IF NOT "%VS120COMNTOOLS%"=="" (
    SET cmake_target=Visual Studio 12 2013 Win64
) ELSE (
    IF NOT "%VS140COMNTOOLS%"=="" (
        SET cmake_target=Visual Studio 14 2015 Win64
    )
)

IF "%cmake_target%"=="" (
    ECHO "error: neither Visusal studio 2013 nor 2015 is installed, please fix and try later"
    GOTO error
)

IF NOT EXIST "%bin_dir%\7z.exe" (
    CALL %bin_dir%\wget.exe --no-check-certificate https://github.com/imzhenyu/packages/raw/master/windows/7z.dll?raw=true
    CALL %bin_dir%\wget.exe --no-check-certificate https://github.com/imzhenyu/packages/raw/master/windows/7z.exe?raw=true
    @move 7z.dll %bin_dir%
    @move 7z.exe %bin_dir%
)
IF NOT EXIST "%TOP_DIR%\ext\%boost_dir_name%" (
    CALL %bin_dir%\wget.exe --no-check-certificate http://github.com/imzhenyu/packages/blob/master/windows/%boost_package_name%?raw=true
    CALL %bin_dir%\7z.exe x %boost_package_name% -y -o"%TOP_DIR%\ext\"
)

IF NOT EXIST "%TOP_DIR%\ext\cmake-3.2.2" (
    CALL %bin_dir%\wget.exe --no-check-certificate http://github.com/imzhenyu/packages/blob/master/windows/cmake-3.2.2.7z?raw=true
    CALL %bin_dir%\7z.exe x cmake-3.2.2.7z -y -o"%TOP_DIR%\ext\"
)

SET bin_dir=%~dp0
SET TOP_DIR=%bin_dir%\..\..\

IF NOT "%VS120COMNTOOLS%"=="" (
    CALL "%VS120COMNTOOLS%\..\..\VC\vcvarsall.bat" amd64
    SET cmake_target=Visual Studio 12 2013 Win64
    SET boost_lib=lib64-msvc-12.0
    SET boost_package_name=boost_1_57_0_vc12_amd64.7z
    SET boost_dir_name=boost_1_57_0
) ELSE (
    IF NOT "%VS140COMNTOOLS%"=="" (
        CALL "%VS140COMNTOOLS%\..\..\VC\vcvarsall.bat" amd64
        SET cmake_target=Visual Studio 14 2015 Win64
        SET boost_lib=lib64-msvc-14.0
        SET boost_package_name=boost_1_59_0_vc14_amd64.7z
        SET boost_dir_name=boost_1_59_0
    )
)

IF "%cmake_target%"=="" (
    ECHO "error: neither Visusal studio 2013 nor 2015 is installed, please fix and try later"
    GOTO error
)

IF NOT EXIST "%bin_dir%\7z.exe" (
    CALL %bin_dir%\wget.exe --no-check-certificate https://github.com/imzhenyu/packages/raw/master/windows/7z.dll?raw=true
    CALL %bin_dir%\wget.exe --no-check-certificate https://github.com/imzhenyu/packages/raw/master/windows/7z.exe?raw=true
    @move 7z.dll %bin_dir%
    @move 7z.exe %bin_dir%
)
IF NOT EXIST "%TOP_DIR%\ext\%boost_dir_name%" (
    CALL %bin_dir%\wget.exe --no-check-certificate http://github.com/imzhenyu/packages/blob/master/windows/%boost_package_name%?raw=true
    CALL %bin_dir%\7z.exe x %boost_package_name% -y -o"%TOP_DIR%\ext\"
)

IF NOT EXIST "%TOP_DIR%\ext\cmake-3.2.2" (
    CALL %bin_dir%\wget.exe --no-check-certificate http://github.com/imzhenyu/packages/blob/master/windows/cmake-3.2.2.7z?raw=true
    CALL %bin_dir%\7z.exe x cmake-3.2.2.7z -y -o"%TOP_DIR%\ext\"
)

fix missed boost dependency in pre-require


:: Start with bootstrap
call bootstrap.bat
if errorlevel 1 exit 1

:: Build step
.\b2 install ^
    --build-dir=buildboost ^
    --prefix=%LIBRARY_PREFIX% ^
    toolset=gcc ^
    address-model=%ARCH% ^
    variant=release ^
    threading=multi ^
    link=shared ^
    -j%CPU_COUNT% ^
    -s ZLIB_INCLUDE="%LIBRARY_INC%" ^
    -s ZLIB_LIBPATH="%LIBRARY_LIB%" ^
    --with-python
if errorlevel 1 exit 1

:: Install fix-up for a non version-specific boost include
move %LIBRARY_INC%\boost-1_61\boost %LIBRARY_INC%
if errorlevel 1 exit 1

:: Move dll's to LIBRARY_BIN
move %LIBRARY_LIB%\*vc%LIB_VER%-mt-1_61.dll "%LIBRARY_BIN%"
if errorlevel 1 exit 1
Status API Training Shop Blog About

:: Start with bootstrap
call bootstrap.bat mingw
if errorlevel 1 exit 1

:: Build step
.\b2 install ^
    --build-dir=buildboost ^
    --prefix=%LIBRARY_PREFIX% ^
    toolset=gcc ^
    address-model=%ARCH% ^
    variant=release ^
    threading=multi ^
    link=shared ^
    -j%CPU_COUNT% ^
    -s ZLIB_INCLUDE="%LIBRARY_INC%" ^
    -s ZLIB_LIBPATH="%LIBRARY_LIB%" ^
    --with-python
if errorlevel 1 exit 1

:: Install fix-up for a non version-specific boost include
move %LIBRARY_INC%\boost-1_61\boost %LIBRARY_INC%
if errorlevel 1 exit 1

:: Move dll's to LIBRARY_BIN
move %LIBRARY_LIB%\*vc%LIB_VER%-mt-1_61.dll "%LIBRARY_BIN%"
if errorlevel 1 exit 1
Status API Training Shop Blog About

Update bld.bat

Update bld.bat


Set SourceFolder=..\Source\
Set BookExt=.txt
Set T=Traditional
Set S=Simplified
Set BookName=%1_
Set BookPath=%SourceFolder%%BookName%

:: Generate the simplified source file
Set OpenCCFolder=..\opencc-0.4.2\
Set SimplifiedText=%BookPath%%S%%BookExt%
Call %OpenCCFolder%opencc -i %BookPath%%T%%BookExt% -o %SimplifiedText% -c %OpenCCFolder%zht2zhs.ini
Call ..\PythonScript\UpdateFile.py %S% %SimplifiedText%

:: Generate book
Set OutputFolder=Output\%1
Call GenerateBookHelper %T%
Call GenerateBookHelper %S%

Set SourceFolder=..\Source\
Set BookExt=.txt
Set T=Traditional
Set S=Simplified
Set BookName=%1_
Set BookPath=%SourceFolder%%BookName%

:: Update the traditional source file
Set TraditionalText=%BookPath%%T%%BookExt%
Call ..\PythonScript\UpdateFile.py %T% %TraditionalText%
:: Generate the simplified source file
Set OpenCCFolder=..\opencc-0.4.2\
Set SimplifiedText=%BookPath%%S%%BookExt%
Call %OpenCCFolder%opencc -i %TraditionalText% -o %SimplifiedText% -c %OpenCCFolder%zht2zhs.ini
Call ..\PythonScript\UpdateFile.py %S% %SimplifiedText%

:: Generate book
Set OutputFolder=Output\%1
Call GenerateBookHelper %T%
Call GenerateBookHelper %S%

Update traditional text

Update traditional text


cd %cd%/BUILD/TOOLS/CODEWAD_Pack/Release/
call CODEWAD_Pack.exe
cd ../../../../
move %cd%\BUILD\TOOLS\CODEWAD_Pack\Release\CODE.WAD %cd%\BUILD\TOOLS\GAMEWAD_Pack\Release\DATA

Add PSX_CREATE_CODEWAD.bat

Add PSX_CREATE_CODEWAD.bat


PATH=C:\python26;C:\progra~2\7-zip;%PATH%
del /q /s dist\*.*
python setup.py py2exe
cd dist
7z d library.zip jinja2\* dns\* 'graphy\*
7z a namebench_for_Windows.zip -r *
namebench -x -O 8.8.8.8 -t5 -o test.html
start test.html

cd ..

Add release tool for windows

Add release tool for windows


mkdir lib
mkdir lib\net46
mkdir tools
mkdir content
mkdir content\controllers

copy ..\src\Ocelog\bin\Debug\Ocelog.dll lib\net46
copy ..\src\Ocelog.Formatting.Logstash\bin\Debug\Ocelog.Formatting.Logstash.dll lib\net46
copy ..\src\Ocelog.Transport.UDP\bin\Debug\Ocelog.Transport.UDP.dll lib\net46
copy ..\src\Ocelog.Testing\bin\Debug\Ocelog.Testing.dll lib\net46

nuget pack

mkdir lib
mkdir lib\net46
mkdir tools
mkdir content
mkdir content\controllers

copy ..\src\Ocelog\bin\Debug\Ocelog.dll lib\net46
copy ..\src\Ocelog.Formatting.Logstash\bin\Debug\Ocelog.Formatting.Logstash.dll lib\net46
copy ..\src\Ocelog.Transport.UDP\bin\Debug\Ocelog.Transport.UDP.dll lib\net46
copy ..\src\Ocelog.Testing\bin\Debug\Ocelog.Testing.dll lib\net46

copy ..\src\Ocelog\bin\Debug\Ocelog.pdb lib\net46
copy ..\src\Ocelog.Formatting.Logstash\bin\Debug\Ocelog.Formatting.Logstash.pdb lib\net46
copy ..\src\Ocelog.Transport.UDP\bin\Debug\Ocelog.Transport.UDP.pdb lib\net46
copy ..\src\Ocelog.Testing\bin\Debug\Ocelog.Testing.pdb lib\net46

nuget pack -Symbols

Create symbols package

Create symbols package


@echo off

:: Prerequisites:
:: 1. Pull down the brackets repo (be sure to update submodules! - and verify git status is clean)
:: 2. Set BRACKETS_SRC to the root of the brackets repo (with NO trailing slash)
:: 3. Build the Windows build of brackets-shell - see scripts\make_appshell_project.bat
::    (should create a brackets-shell\Release dir)

:: Check that BRACKETS_SRC var is defined and points to a dir that exists
:: (we can't only check the latter since an undefined var is "", which DOES 'exist')
IF NOT DEFINED BRACKETS_SRC GOTO NO_BRACKETS_SRC
IF NOT EXIST %BRACKETS_SRC% GOTO NO_BRACKETS_SRC

:: Folder structure before staging:
::   brackets-shell
::      installer
::         mac
::         win  <-- current directory
::      Release
::         Brackets.exe
::         locales
::         ...
::      ...
::   brackets   <-- BRACKETS_SRC
::      src
::      test

:: Folder structure after staging:
::   brackets-shell
::      installer
::         win
::            staging
::               Brackets.exe
::               locales
::               ...
::               www
::                  <contents of BRACKETS_SRC\src>
::      ...

:: Notes on xcopy usage...
::
:: xcopy uses a very primitive exclusion mechanism. The exclusions have to be stored in a file (can't be
:: passed on command line), and they are matched as literal strings (no wildcards). They can't use spaces
:: (even with quotes), and the path containing the exclude text file also cannot contain spaces. The exclude
:: strings are matched against the absolute path+name of each file AND directory being copied.
::
:: The source path is expected to have NO trailing slash (otherwise "Invalid path"); but the destination path
:: *must* have a trailing slash or else xcopy will prompt to disambiguate dest folder vs. path (unless you pass /i).
::
:: For detailed Windows scripting documentation, see:
:: http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/ntcmds.mspx?mfr=true

:: Remove any old bits from the staging dir
IF NOT EXIST staging\ GOTO STAGING_CLEARED

echo Clearing old staging folder %CD%\staging ...
rmdir staging\ /s /q

:STAGING_CLEARED

:: Copy Release of brackets-shell to staging
echo Copying brackets-shell build from %CD%\..\..\Release ...

(
    echo .pdb
    echo \dev\
    echo \obj\
    echo \lib\
    echo avformat-54.dll
    echo avutil-51.dll
    echo avcodec-54.dll
    echo d3dcompiler_43.dll
    echo d3dx9_43.dll
    echo libEGL.dll
    echo libGLESv2.dll
    echo cefclient.exe
    echo debug.log
) > shell_excludes.tmp
xcopy ..\..\Release staging /s /i /exclude:shell_excludes.tmp
del shell_excludes.tmp

:: Copy BRACKETS_SRC\src to staging\www
:: excluding .git*
echo Copying brackets source from %BRACKETS_SRC%\src ...

echo .git > www_excludes.tmp
xcopy "%BRACKETS_SRC%\src" staging\www /s /i /exclude:www_excludes.tmp
del www_excludes.tmp

:: Copy BRACKETS_SRC\samples to staging\samples
echo Copying sample content from %BRACKETS_SRC%\samples ...

xcopy "%BRACKETS_SRC%\samples" staging\samples /s /i

echo.
echo Done staging Brackets for Windows! (Ready to run setBuildNumber.sh and then build the installer)

GOTO END

:NO_BRACKETS_SRC
echo Error: Unable to locate BRACKETS_SRC. Make sure environment variable is set, and is pointing to the root of your brackets repo (with NO trailing slash).

:END

@echo off

:: Prerequisites:
:: 1. Pull down the brackets repo (be sure to update submodules! - and verify git status is clean)
:: 2. Set BRACKETS_SRC to the root of the brackets repo (with NO trailing slash)
:: 3. Build the Windows build of brackets-shell - see scripts\make_appshell_project.bat
::    (should create a brackets-shell\Release dir)

:: Check that BRACKETS_SRC var is defined and points to a dir that exists
:: (we can't only check the latter since an undefined var is "", which DOES 'exist')
IF NOT DEFINED BRACKETS_SRC GOTO NO_BRACKETS_SRC
IF NOT EXIST %BRACKETS_SRC% GOTO NO_BRACKETS_SRC

:: Folder structure before staging:
::   brackets-shell
::      installer
::         mac
::         win  <-- current directory
::      Release
::         Brackets.exe
::         locales
::         ...
::      ...
::   brackets   <-- BRACKETS_SRC
::      src
::      test

:: Folder structure after staging:
::   brackets-shell
::      installer
::         win
::            staging
::               Brackets.exe
::               locales
::               ...
::               www
::                  <contents of BRACKETS_SRC\src>
::      ...

:: Notes on xcopy usage...
::
:: xcopy uses a very primitive exclusion mechanism. The exclusions have to be stored in a file (can't be
:: passed on command line), and they are matched as literal strings (no wildcards). They can't use spaces
:: (even with quotes), and the path containing the exclude text file also cannot contain spaces. The exclude
:: strings are matched against the absolute path+name of each file AND directory being copied.
::
:: The source path is expected to have NO trailing slash (otherwise "Invalid path"); but the destination path
:: *must* have a trailing slash or else xcopy will prompt to disambiguate dest folder vs. path (unless you pass /i).
::
:: For detailed Windows scripting documentation, see:
:: http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/ntcmds.mspx?mfr=true

:: Remove any old bits from the staging dir
IF NOT EXIST staging\ GOTO STAGING_CLEARED

echo Clearing old staging folder %CD%\staging ...
rmdir staging\ /s /q

:STAGING_CLEARED

:: Copy Release of brackets-shell to staging
echo Copying brackets-shell build from %CD%\..\..\Release ...

(
    echo .pdb
    echo \dev\
    echo \obj\
    echo \lib\
    echo avformat-54.dll
    echo avutil-51.dll
    echo avcodec-54.dll
    echo d3dcompiler_43.dll
    echo d3dx9_43.dll
    echo libEGL.dll
    echo libGLESv2.dll
    echo cefclient.exe
    echo debug.log
) > shell_excludes.tmp
xcopy ..\..\Release staging /s /i /exclude:shell_excludes.tmp
del shell_excludes.tmp

:: Copy BRACKETS_SRC\src to staging\www
:: excluding .git*
echo Copying brackets source from %BRACKETS_SRC%\src ...

echo .git > www_excludes.tmp
xcopy "%BRACKETS_SRC%\src" staging\www /s /i /exclude:www_excludes.tmp
del www_excludes.tmp

:: Copy BRACKETS_SRC\samples to staging\samples
echo Copying sample content from %BRACKETS_SRC%\samples ...

xcopy "%BRACKETS_SRC%\samples" staging\samples /s /i

echo.
echo Done staging Brackets for Windows! (Ready to build the installer)

GOTO END

:NO_BRACKETS_SRC
echo Error: Unable to locate BRACKETS_SRC. Make sure environment variable is set, and is pointing to the root of your brackets repo (with NO trailing slash).

:END

Update comment

Update comment


cd staging
git clone -b master --depth=1 --single-branch "https://github.com/CsoundQt/CsoundQt.git"
cd CsoundQt
dir
qmake.exe qcs.pro ^
    CONFIG+=html_webengine ^
    CONFIG+=thread ^
    CONFIG+=perfThread_build ^
    CONFIG+=csound6 ^
    CONFIG+=build64 ^
    CONFIG+=QCS_QT59 ^
    QT+=xml ^
    DEFINES+="USE_DOUBLE=1" ^
    DEFINES+="USE_QT_GT_58=1" ^
    CSOUND_API_INCLUDE_DIR="%APPVEYOR_BUILD_FOLDER%\\include" ^
    CSOUND_INTERFACES_INCLUDE_DIR="%APPVEYOR_BUILD_FOLDER%\\interfaces" ^
    CSOUND_LIBRARY_DIR="%APPVEYOR_BUILD_FOLDER%\\msvc\\csound-vs\\RelWithDebInfo" ^
    DEFAULT_CSOUND_LIBS=csound64.lib ^
    CSOUND_LIBRARY=csound64.lib ^
    LCSOUND=%APPVEYOR_BUILD_FOLDER%\\msvc\\csound-vs\\RelWithDebInfo\\csound64.lib ^
    LIBS+="%VCPKGDir%\\installed\\x64-windows\\lib\\libsndfile-1.lib" ^
    LIBS+="%APPVEYOR_BUILD_FOLDER%\\msvc\\csound-vs\\RelWithDebInfo\\csound64.lib" ^
    LIBS+="Ole32.lib" ^
    -after ^
    CSOUND_INTERFACES_INCLUDE_DIR+="%~dp0deps\\include" ^
    CSOUND_INTERFACES_INCLUDE_DIR+="%APPVEYOR_BUILD_FOLDER%\\deps\\include" ^
    CSOUND_INTERFACES_INCLUDE_DIR+="%VCPKGDir%\\installed\\x64-windows\\include" ^
    INCLUDEPATH+="%VCPKGDir%\\installed\\x64-windows\\include"
nmake.exe /A
move "bin\\CsoundQt*.*" "..\\..\\csound-vs\\RelWithDebInfo\\"
cd ..\..

cd staging
git clone -b master --depth=1 --single-branch "https://github.com/CsoundQt/CsoundQt.git"
cd CsoundQt
dir
qmake.exe qcs.pro ^
    CONFIG+=html_webengine ^
    CONFIG+=thread ^
    CONFIG+=perfThread_build ^
    CONFIG+=csound6 ^
    CONFIG+=build64 ^
    CONFIG+=QCS_QT59 ^
    QT+=xml ^
    DEFINES+="USE_DOUBLE=1" ^
    DEFINES+="USE_QT_GT_58=1" ^
    CSOUND_API_INCLUDE_DIR="%APPVEYOR_BUILD_FOLDER%\\include" ^
    CSOUND_INTERFACES_INCLUDE_DIR="%APPVEYOR_BUILD_FOLDER%\\interfaces" ^
    CSOUND_LIBRARY_DIR="%APPVEYOR_BUILD_FOLDER%\\msvc\\csound-vs\\RelWithDebInfo" ^
    DEFAULT_CSOUND_LIBS=csound64.lib ^
    CSOUND_LIBRARY=csound64.lib ^
    LCSOUND=%APPVEYOR_BUILD_FOLDER%\\msvc\\csound-vs\\RelWithDebInfo\\csound64.lib ^
    LIBS+="%VCPKGDir%\\installed\\x64-windows-static\\lib\\libsndfile.lib" ^
    LIBS+="%APPVEYOR_BUILD_FOLDER%\\msvc\\csound-vs\\RelWithDebInfo\\csound64.lib" ^
    LIBS+="Ole32.lib" ^
    -after ^
    CSOUND_INTERFACES_INCLUDE_DIR+="%~dp0deps\\include" ^
    CSOUND_INTERFACES_INCLUDE_DIR+="%APPVEYOR_BUILD_FOLDER%\\deps\\include" ^
    CSOUND_INTERFACES_INCLUDE_DIR+="%VCPKGDir%\\installed\\x64-windows-static\\include" ^
    INCLUDEPATH+="%VCPKGDir%\\installed\\x64-windows-static\\include"
nmake.exe /A
move "bin\\CsoundQt*.*" "..\\..\\csound-vs\\RelWithDebInfo\\"
cd ..\..

fix for csoundqt build as part of installer


SETLOCAL EnableDelayedExpansion
cd source

:: Remove all instances of /W4 from configure.
:: They get passed to the linker and confuse it.
:: Given that we aren't interested in warnings anyway
:: remove it. I could have used a patch but this seemed
:: more 'upgrade friendly'
sed "s~ /W4~~g" configure > configure.new
move configure.new configure

:: This seems to be required - not sure why but
:: rc.exe gets confused with the '/' form of slashes
set MSYS_RC_MODE=1

:: 32-bit and VS2015 ends in failure:
:: uconv.o : MSIL .netmodule or module compiled with /GL found; restarting link with /LTCG; add /LTCG to the link command line to improve linker performance
:: uconv.o : error LNK2001: unresolved external symbol _uconvmsg_dat
:: ../../bin/uconv.exe : fatal error LNK1120: 1 unresolved externals
:: .. without this
if "%ARCH%"=="32" (
  if "%c_compiler%"=="vs2015" (
    set DISABLE_EXTRAS=--disable-extras
  )
)

:: Can't seem to determine msys2 due to bug in config.guess,
:: BUT runConfigureICU expects cygwin, so we just pretend we are
:: The prefix looks strange but it seems we are chrooted into almost the right
:: place by msys2, but can't write to the directories we need - fix up below
if "%ARCH%"=="32" (
  FOR /F "delims=" %%i IN ('cygpath.exe -u "%LIBRARY_PREFIX%"') DO set "CYGWIN_LIBRARY_PREFIX=%%i"
  bash runConfigureICU Cygwin/MSVC --build=x86_64-pc-cygwin --prefix=!CYGWIN_LIBRARY_PREFIX!/icu %DISABLE_EXTRAS%
) else (
  bash runConfigureICU Cygwin/MSVC --build=x86_64-pc-cygwin --prefix=/icu %DISABLE_EXTRAS%
)

:: Ignore errorlevel - there are warnings about various things missing
:: which we don't actually seem to need. Just keep going...
::if errorlevel 1 exit 1

make
:: Run make twice. There is some timing issue between msys2 and rc.exe
:: that means that directories are created after they are required...
make install || make install
if errorlevel 1 exit 1

:: Fix up for not being able to write into the root path with msys2
xcopy /e /i %LIBRARY_PREFIX%\icu\lib %LIBRARY_LIB%
if errorlevel 1 exit 1
xcopy /e /i %LIBRARY_PREFIX%\icu\bin %LIBRARY_BIN%
if errorlevel 1 exit 1
xcopy /e /i %LIBRARY_PREFIX%\icu\include %LIBRARY_INC%
if errorlevel 1 exit 1
xcopy /e /i %LIBRARY_PREFIX%\icu\share %LIBRARY_PREFIX%\share
if errorlevel 1 exit 1
rmdir /s /q %LIBRARY_PREFIX%\icu
if errorlevel 1 exit 1

:: The .dlls end up in the wrong place
move %LIBRARY_LIB%\icu*.dll %LIBRARY_BIN%
if errorlevel 1 exit 1

SETLOCAL EnableDelayedExpansion
cd source

:: Remove all instances of /W4 from configure.
:: They get passed to the linker and confuse it.
:: Given that we aren't interested in warnings anyway
:: remove it. I could have used a patch but this seemed
:: more 'upgrade friendly'
sed "s~ /W4~~g" configure > configure.new
move configure.new configure

:: This seems to be required - not sure why but
:: rc.exe gets confused with the '/' form of slashes
set MSYS_RC_MODE=1

:: 32-bit and VS2015 ends in failure:
:: uconv.o : MSIL .netmodule or module compiled with /GL found; restarting link with /LTCG; add /LTCG to the link command line to improve linker performance
:: uconv.o : error LNK2001: unresolved external symbol _uconvmsg_dat
:: ../../bin/uconv.exe : fatal error LNK1120: 1 unresolved externals
:: .. without this
if "%ARCH%"=="32" (
  if "%c_compiler%"=="vs2015" (
    set EXTRA_OPTS=--disable-extras
  )
)

set BUILD=x86_64-pc-cygwin
set HOST=x86_64-pc-cygwin
cd ..

copy "%RECIPE_DIR%\build.sh" .
set MSYSTEM=MINGW%ARCH%
set MSYS2_PATH_TYPE=inherit
set CHERE_INVOKING=1
FOR /F "delims=" %%i in ('cygpath.exe -u "%LIBRARY_PREFIX%"') DO set "PREFIX=%%i"

set CC=cl.exe
set CXX=cl.exe

bash -lc "./build.sh"
if errorlevel 1 exit 1

:: The .dlls end up in the wrong place
move %LIBRARY_LIB%\icu*.dll %LIBRARY_BIN%
if errorlevel 1 exit 1

Use build.sh for windows too

Use build.sh for windows too


@echo off
setlocal

java -jar -Dlog4j.configurationFile=./conf/log4j2.xml ./lib/raildelays-batch-1.0.0-SNAPSHOT.jar
PAUSE

@echo off
setlocal

java -jar -Dlog4j.configurationFile=./conf/log4j2.xml ./lib/raildelays-batch.jar
PAUSE

Update run.bat

Update run.bat

Remove version from final name of JAR's


REM batch script written as a by hand conversion of build.sh.

set outdir=%PREFIX%/share/$PKG_NAME
MKDIR %outdir%
if errorlevel 1 exit 1
MKDIR %PREFIX/bin%
if errorlevel 1 exit 1

CD %SRC_DIR%
if errorlevel 1 exit 1

REM cromwell
COPY cromwell/cromwell-*.jar %outdir%/cromwell.jar
if errorlevel 1 exit 1
COPY %RECIPE_DIR%/cromwell.py %PREFIX%/bin/cromwell
if errorlevel 1 exit 1

COPY womtool/womtool-*.jar %outdir%/womtool.jar
if errorlevel 1 exit 1
COPY %RECIPE_DIR%/womtool.py %PREFIX%/bin/womtool
if errorlevel 1 exit 1

REM batch script written as a by hand conversion of build.sh.

set outdir=%PREFIX%/share/%PKG_NAME%
MKDIR %outdir%
if errorlevel 1 exit 1
MKDIR %PREFIX/bin%
if errorlevel 1 exit 1

CD %SRC_DIR%
if errorlevel 1 exit 1

REM cromwell
COPY cromwell/cromwell-*.jar %outdir%/cromwell.jar
if errorlevel 1 exit 1
COPY %RECIPE_DIR%/cromwell.py %PREFIX%/bin/cromwell
if errorlevel 1 exit 1

COPY womtool/womtool-*.jar %outdir%/womtool.jar
if errorlevel 1 exit 1
COPY %RECIPE_DIR%/womtool.py %PREFIX%/bin/womtool
if errorlevel 1 exit 1

correct variable name

correct variable name


CD /D %~dp0
call npm install -g grunt-cli
call npm install
call grunt --nomap=true
pause

CD /D %~dp0
call npm install -g grunt-cli
call npm install
call grunt --level=WHITESPACE_ONLY --nomap=true --mobile=true --formatting=PRETTY_PRINT
pause

revert error commit to build-mobile

revert error commit to build-mobile


rem CI script

rem Install Bazel using Choco
echo "Installing/updating bazel"
choco install bazel -y

rem Use placeholder secret file
mkdir data\
echo '
    {"installed":{"client_id":"PLACEHOLDER.apps.googleusercontent.com","project_id":"PLACEHOLDER","auth_uri":"https://accounts.google.com/o/oauth2/auth","token_uri":"https://oauth2.googleapis.com/token","auth_provider_x509_cert_url":"https://www.googleapis.com/oauth2/v1/certs","client_secret":"PLACEHOLDER","redirect_uris":["urn:ietf:wg:oauth:2.0:oob","http://localhost"]}}
' > data\client_not_so_secret.json

rem Ensure that our code builds
bazel build gactions
rem Print version
bazel run gactions -- version

rem Run all tests
bazel test ...

Add equivalent script for Windows execute/test

Bug: 174267320
Change-Id: Ie3ca4521418c9a7a653a20cd55b2f904524bf616


set PATH=%PATH%;c:\windows\Sysnative

cd src
bash -c ./prepare.sh
build\ahk2exe\Ahk2Exe.exe /in run-wsl-file.ahk /out run-wsl-file.exe /icon %LOCALAPPDATA%\lxss\bash.ico
build\ahk2exe\Ahk2Exe.exe /in open-wsl.ahk /out open-wsl.exe
build\ahk2exe\Ahk2Exe.exe /in vim.ahk /out vim.exe
bash -c ./package.sh

pause

Fix build.bat for 32-bit TC

Fix build.bat for 32-bit TC


@echo off
cd %~dp0

SETLOCAL
SET CACHED_NUGET=%LocalAppData%\NuGet\NuGet.exe

IF EXIST %CACHED_NUGET% goto copynuget
echo Downloading latest version of NuGet.exe...
IF NOT EXIST %LocalAppData%\NuGet md %LocalAppData%\NuGet
@powershell -NoProfile -ExecutionPolicy unrestricted -Command "$ProgressPreference = 'SilentlyContinue'; Invoke-WebRequest 'https://www.nuget.org/nuget.exe' -OutFile '%CACHED_NUGET%'"

:copynuget
IF EXIST .nuget\nuget.exe goto restore
md .nuget
copy %CACHED_NUGET% .nuget\nuget.exe > nul

:restore
IF EXIST packages\KoreBuild goto run
.nuget\NuGet.exe install KoreBuild -ExcludeVersion -o packages -nocache -pre
.nuget\NuGet.exe install Sake -version 0.2 -o packages -ExcludeVersion

IF "%SKIP_DNX_INSTALL%"=="1" goto run
CALL packages\KoreBuild\build\dnvm upgrade -runtime CLR -arch x86
CALL packages\KoreBuild\build\dnvm install default -runtime CoreCLR -arch x86

:run
CALL packages\KoreBuild\build\dnvm use default -runtime CLR -arch x86
packages\Sake\tools\Sake.exe -I packages\KoreBuild\build -f makefile.shade %*

@echo off
cd %~dp0

SETLOCAL
SET CACHED_NUGET=%LocalAppData%\NuGet\NuGet.exe
SET BUILDCMD_KOREBUILD_VERSION=""
SET BUILDCMD_DNX_VERSION=""

IF EXIST %CACHED_NUGET% goto copynuget
echo Downloading latest version of NuGet.exe...
IF NOT EXIST %LocalAppData%\NuGet md %LocalAppData%\NuGet
@powershell -NoProfile -ExecutionPolicy unrestricted -Command "$ProgressPreference = 'SilentlyContinue'; Invoke-WebRequest 'https://www.nuget.org/nuget.exe' -OutFile '%CACHED_NUGET%'"

:copynuget
IF EXIST .nuget\nuget.exe goto restore
md .nuget
copy %CACHED_NUGET% .nuget\nuget.exe > nul

:restore
IF EXIST packages\KoreBuild goto run
IF %BUILDCMD_KOREBUILD_VERSION%=="" (
	.nuget\NuGet.exe install KoreBuild -ExcludeVersion -o packages -nocache -pre
) ELSE (
	.nuget\NuGet.exe install KoreBuild -version %BUILDCMD_KOREBUILD_VERSION% -ExcludeVersion -o packages -nocache -pre
)
.nuget\NuGet.exe install Sake -version 0.2 -o packages -ExcludeVersion

IF "%SKIP_DNX_INSTALL%"=="1" goto run
IF %BUILDCMD_DNX_VERSION%=="" (
	CALL packages\KoreBuild\build\dnvm upgrade -runtime CLR -arch x86
) ELSE (
	CALL packages\KoreBuild\build\dnvm install %BUILDCMD_DNX_VERSION% -runtime CLR -arch x86 -a default
)
CALL packages\KoreBuild\build\dnvm install default -runtime CoreCLR -arch x86

:run
CALL packages\KoreBuild\build\dnvm use default -runtime CLR -arch x86
packages\Sake\tools\Sake.exe -I packages\KoreBuild\build -f makefile.shade %*

Enable pinning build script

Enable pinning build script


@ECHO OFF
PowerShell -NoProfile -NoLogo -ExecutionPolicy unrestricted -Command "[System.Threading.Thread]::CurrentThread.CurrentCulture = ''; [System.Threading.Thread]::CurrentThread.CurrentUICulture = '';& '%~dp0build.ps1' %*"

@ECHO OFF
PowerShell -NoProfile -NoLogo -ExecutionPolicy unrestricted -Command "[System.Threading.Thread]::CurrentThread.CurrentCulture = ''; [System.Threading.Thread]::CurrentThread.CurrentUICulture = '';& '%~dp0build.ps1' %*; exit $LASTEXITCODE"

Return the error code from build.cmd

Return the error code from build.cmd


del *.tds
del *.ilc
del *.ild
del *.ilf
del *.ils
del *.obj
del *.res

Create cleanup.bat

Create cleanup.bat


set CONDA_PREFIX=%PREFIX%
if errorlevel 1 exit 1

cmake -B build -S "%SRC_DIR%" ^
	-G Ninja ^
    -DCMAKE_BUILD_TYPE=Release ^
    -DPython3_FIND_STRATEGY=LOCATION ^
    -DPython3_ROOT_DIR=%CONDA_PREFIX% ^
    -DCMAKE_LINKER=lld-link.exe
if errorlevel 1 exit 1

cmake --build build -j %CPU_COUNT% -- -v -k 0
if errorlevel 1 exit 1

if not exist "%SP_DIR%" mkdir "%SP_DIR%"
if errorlevel 1 exit 1

copy build/OCP.cp*-*.* "%SP_DIR%"
if errorlevel 1 exit 1

set CONDA_PREFIX=%PREFIX%
if errorlevel 1 exit 1

cmake -B build -S "%SRC_DIR%" ^
	-G Ninja ^
    -DCMAKE_BUILD_TYPE=Release ^
    -DPython3_FIND_STRATEGY=LOCATION ^
    -DPython3_ROOT_DIR=%CONDA_PREFIX% ^
    -DCMAKE_LINKER=lld-link.exe ^
    -DCMAKE_MODULE_LINKER_FLAGS="/FORCE:MULTIPLE"
if errorlevel 1 exit 1

cmake --build build -j %CPU_COUNT% -- -v -k 0
if errorlevel 1 exit 1

if not exist "%SP_DIR%" mkdir "%SP_DIR%"
if errorlevel 1 exit 1

copy build/OCP.cp*-*.* "%SP_DIR%"
if errorlevel 1 exit 1

Add /FORCE:MULTIPLE to Windows linker flags


@ECHO OFF
SET BASEDIR=%~dp0
SET PARENT=%BASEDIR%\..
:: Check Wiperdog service installed
for /f "tokens=4*" %%a in ('sc query Wiperdog ^| findstr STATE') do set WIPER_SERVICE_STATUS=%%a
IF "%WIPER_SERVICE_STATUS%"=="" (
  echo "Wiperdog service was not installed, abort removing Wiperdog service"
  SET CHECKSERVICE="FALSE"
) else (
  echo Wiperdog service status:  %WIPER_SERVICE_STATUS%
  SET CHECKSERVICE="TRUE"
)

if "%CHECKSERVICE%"=="TRUE" (
	SET uninstall_service=FALSE
	:WHILE_SERVICE
	SET /P confirm_uninstall_service=Do you want to remove Wiperdog service? (y/n)
	IF "%confirm_uninstall_service%"=="Y" (
	  SET uninstall_service=TRUE
	  GOTO MAIN_PROG
	)
	IF "%confirm_uninstall_service%"=="y" (
	  SET uninstall_service=TRUE
	  GOTO MAIN_PROG
	)
	IF "%confirm_uninstall_service%"=="n" (
	  SET uninstall_service=FALSE
	  GOTO MAIN_PROG
	)
	IF "%confirm_uninstall_service%"=="N" (
	  SET uninstall_service=FALSE
	  GOTO MAIN_PROG
	)
	GOTO WHILE_SERVICE
)

:MAIN_PROG
SET delete_data=FALSE
:WHILE_MONGO
SET /P confirm_delete_data=Do you want to delete all wiperdog's data in mongodb? (y/n)
IF "%confirm_delete_data%"=="Y" (
  SET delete_data=TRUE
  GOTO MAIN_PROG2
)
IF "%confirm_delete_data%"=="y" (
  SET delete_data=TRUE
  GOTO MAIN_PROG2
)
IF "%confirm_delete_data%"=="n" (
  SET delete_data=FALSE
  GOTO MAIN_PROG2
)
IF "%confirm_delete_data%"=="N" (
  SET delete_data=FALSE
  GOTO MAIN_PROG2
)
GOTO WHILE_MONGO

:MAIN_PROG2
::Confirm remove files

SET delete_files=FALSE
:WHILE_FILE
SET /P confirm_delete_files=Do you want to delete all wiperdog's files? (y/n)
IF "%confirm_delete_files%"=="Y" (
  SET delete_files=TRUE
  GOTO MAIN_PROG3
)
IF "%confirm_delete_files%"=="y" (
  SET delete_files=TRUE
  GOTO MAIN_PROG3
)
IF "%confirm_delete_files%"=="n" (
  SET delete_files=FALSE
  GOTO MAIN_PROG2
)
IF "%confirm_delete_files%"=="N" (
  SET delete_files=FALSE
  GOTO MAIN_PROG3
)
GOTO WHILE_FILE

:MAIN_PROG3

:: Final confirm
echo ======================================================================================
echo You decide to uninstall the followings:
echo Uninstall service: %uninstall_service%
echo Delete data in mongodb: %delete_data%
echo Delete Wiperdog's files: %delete_files%
echo =======================================================================================
echo "Press any key to continue or CTRL+C to exit...
PAUSE
%PARENT%\bin\groovy.bat -DWIPERDOG_HOME=%PARENT% --classpath %PARENT%\lib\java\bundle.a %PARENT%\installer\uninstall.groovy %uninstall_service% %delete_data% %delete_files%

@ECHO OFF
SET BASEDIR=%~dp0
SET PARENT=%BASEDIR%\..
:: Check Wiperdog service installed
for /f "tokens=4*" %%a in ('sc query Wiperdog ^| findstr STATE') do set WIPER_SERVICE_STATUS=%%a
IF "%WIPER_SERVICE_STATUS%"=="" (
  echo "Wiperdog service was not installed, abort removing Wiperdog service"
  SET CHECKSERVICE="FALSE"
) else (
  echo Wiperdog service status:  %WIPER_SERVICE_STATUS%
  SET CHECKSERVICE="TRUE"
)

if "%CHECKSERVICE%"=="TRUE" (
	SET uninstall_service=FALSE
	:WHILE_SERVICE
	SET /P confirm_uninstall_service=Do you want to remove Wiperdog service? (y/n)
	IF "%confirm_uninstall_service%"=="Y" (
	  SET uninstall_service=TRUE
	  GOTO MAIN_PROG
	)
	IF "%confirm_uninstall_service%"=="y" (
	  SET uninstall_service=TRUE
	  GOTO MAIN_PROG
	)
	IF "%confirm_uninstall_service%"=="n" (
	  SET uninstall_service=FALSE
	  GOTO MAIN_PROG
	)
	IF "%confirm_uninstall_service%"=="N" (
	  SET uninstall_service=FALSE
	  GOTO MAIN_PROG
	)
	GOTO WHILE_SERVICE
)

:MAIN_PROG
::Confirm remove wiperdog data
SET delete_data=FALSE
:WHILE_MONGO
SET /P confirm_delete_data=Do you want to delete all wiperdog's data in mongodb? (y/n)
IF "%confirm_delete_data%"=="Y" (
  SET delete_data=TRUE
  GOTO MAIN_PROG2
)
IF "%confirm_delete_data%"=="y" (
  SET delete_data=TRUE
  GOTO MAIN_PROG2
)
IF "%confirm_delete_data%"=="n" (
  SET delete_data=FALSE
  GOTO MAIN_PROG2
)
IF "%confirm_delete_data%"=="N" (
  SET delete_data=FALSE
  GOTO MAIN_PROG2
)
GOTO WHILE_MONGO

:MAIN_PROG2
::Confirm remove files

SET delete_files=FALSE
:WHILE_FILE
SET /P confirm_delete_files=Do you want to delete all wiperdog's files? (y/n)
IF "%confirm_delete_files%"=="Y" (
  SET delete_files=TRUE
  GOTO MAIN_PROG3
)
IF "%confirm_delete_files%"=="y" (
  SET delete_files=TRUE
  GOTO MAIN_PROG3
)
IF "%confirm_delete_files%"=="n" (
  SET delete_files=FALSE
  GOTO MAIN_PROG3
)
IF "%confirm_delete_files%"=="N" (
  SET delete_files=FALSE
  GOTO MAIN_PROG3
)
GOTO WHILE_FILE

:MAIN_PROG3

:: Final confirm
echo ======================================================================================
echo You decide to uninstall the followings:
echo Uninstall service: %uninstall_service%
echo Delete data in mongodb: %delete_data%
echo Delete Wiperdog's files: %delete_files%
echo =======================================================================================
echo "Press any key to continue or CTRL+C to exit...
PAUSE
%PARENT%\bin\groovy.bat -DWIPERDOG_HOME=%PARENT% --classpath %PARENT%\lib\java\bundle.a %PARENT%\installer\uninstall.groovy %uninstall_service% %delete_data% %delete_files%

Update uninstaller

Update uninstaller


REM pushd "%~dp0\..\src\NSwag.Sample.NetCoreAngular"
REM dotnet publish || goto :error
REM "%~dp0\..src\NSwagStudio\bin\Release\nswag" run /runtime:NetCore11 || goto :error
REM popd

pushd "%~dp0\..\samples"
REM cmd /c call powershell .\run.ps1 Release || goto :error
popd

pushd "%~dp0\..\src\NSwag.Sample.NETCore11"
dotnet restore || goto :error
dotnet publish || goto :error
cmd /c call "..\NSwagStudio\bin\Release\nswag.cmd" run /runtime:NetCore11 || goto :error
popd

pushd "%~dp0\..\src\NSwag.Sample.NETCore20"
dotnet restore || goto :error
dotnet publish || goto :error
cmd /c call "..\NSwagStudio\bin\Release\nswag.cmd" run /runtime:NetCore20 || goto :error
popd

pushd "%~dp0\..\src\NSwag.Sample.NetGlobalAsax"
msbuild || goto :error
cmd /c call "..\NSwagStudio\bin\Release\nswag.cmd" run /runtime:Winx64 || goto :error
popd

pushd "%~dp0\..\src\NSwag.Integration.WebAPI"
msbuild || goto :error
cmd /c call "..\NSwagStudio\bin\Release\nswag.cmd" run /runtime:Winx64 || goto :error
popd

goto :EOF
:error
echo Failed with error #%errorlevel%.
exit /b %errorlevel%

REM pushd "%~dp0\..\src\NSwag.Sample.NetCoreAngular"
REM dotnet publish || goto :error
REM "%~dp0\..src\NSwagStudio\bin\Release\nswag" run /runtime:NetCore11 || goto :error
REM popd

pushd "%~dp0\..\samples"
cmd /c call powershell .\run.ps1 Release || goto :error
popd

pushd "%~dp0\..\src\NSwag.Sample.NETCore11"
dotnet restore || goto :error
dotnet publish || goto :error
cmd /c call "..\NSwagStudio\bin\Release\nswag.cmd" run /runtime:NetCore11 || goto :error
popd

pushd "%~dp0\..\src\NSwag.Sample.NETCore20"
dotnet restore || goto :error
dotnet publish || goto :error
cmd /c call "..\NSwagStudio\bin\Release\nswag.cmd" run /runtime:NetCore20 || goto :error
popd

pushd "%~dp0\..\src\NSwag.Sample.NetGlobalAsax"
msbuild || goto :error
cmd /c call "..\NSwagStudio\bin\Release\nswag.cmd" run /runtime:Winx64 || goto :error
popd

pushd "%~dp0\..\src\NSwag.Integration.WebAPI"
msbuild || goto :error
cmd /c call "..\NSwagStudio\bin\Release\nswag.cmd" run /runtime:Winx64 || goto :error
popd

goto :EOF
:error
echo Failed with error #%errorlevel%.
exit /b %errorlevel%

Change tests

Change tests


cd ./demo
haxe build.hxml

cd ../extension
haxe build_panel.hxml
haxe build_script.hxml

pause

cd ./extension
haxe build_panel.hxml
haxe build_script.hxml

pause

update build.bat

update build.bat


if "%Configuration%" == "" (
  if "%2" == "" (
    set Configuration=Release
  ) else (
    set Configuration=%2
  )
)

if "%PrereleaseTag%" == "" (
  set PrereleaseTag=%1
)

dotnet restore || exit /b
dotnet build src/DataLoader/ --configuration %Configuration% || exit /b
dotnet test test/DataLoader.Tests/ --configuration %Configuration% || exit /b
dotnet pack src/DataLoader/ --configuration %Configuration% --version-suffix %PrereleaseTag% || exit /b

Allow running build.bat locally

Allow running build.bat locally


@echo off

PATH=%PATH%;C:/MinGW/bin
mingw32-make

Build command for windows

Build command for windows