<# :
@echo off
setlocal
set "POWERSHELL_BAT_ARGS=%*"
if defined POWERSHELL_BAT_ARGS set "POWERSHELL_BAT_ARGS=%POWERSHELL_BAT_ARGS:"=\"%"
endlocal & powershell -NoLogo -NoProfile -Command "$_ = $input; Invoke-Expression $( '$input = $_; $_ = \"\"; $args = @( &{ $args } %POWERSHELL_BAT_ARGS% );' + [String]::Join( [char]10, $( Get-Content \"%~f0\" ) ) )"
goto :EOF
#>

$packages = @(

	@{
		"name" = "7-zip";
		"home" = "http://7-zip.org/";
		"url" = "http://downloads.sourceforge.net/sevenzip/7za920.zip";
		"dir" = "7za";
		"postinstall" = {
			function postinstall( [string]$dir ) {
				$script:7zip_exe = "$dir\7za.exe";
			};
			postinstall $args[0];
		};
	}

	@{
		"name" = "ConEmu";
		"home" = "http://code.google.com/p/conemu-maximus5/";
		"url" = "http://downloads.sourceforge.net/project/conemu/Preview/ConEmuPack.141221.7z";
		"dir" = "ConEmu";
	}

	@{
		"name" = "Clink";
		"home" = "http://mridgers.github.io/clink";
		"url" = "https://github.com/mridgers/clink/releases/download/0.4.2/clink_0.4.2.zip";
		"dir" = "clink";
		"onlyFiles" = $True;
		"postinstall" = {
			function postinstall( [string]$dir ) {
				ls $dir |
				? { $_.Attributes -eq "Directory" } |
				% { rmdir -Force -Path "$dir\$_"; };
			};
			postinstall $args[0];
		};
	}

	@{
		"name" = "Far3";
		"home" = "http://www.farmanager.com/";
		"url" = "http://www.farmanager.com/files/Far30b4040.x86.20140810.7z";
		"dir" = "Far3";
	}

	@{
		"name" = "Far3bis";
		"home" = "http://code.google.com/p/conemu-maximus5/";
		"url" = "http://downloads.sourceforge.net/project/conemu/FarManager/Far3bis/far3.4219bis.x86.x64.7z";
		"dir" = "Far3bis";
	}

	@{
		"name" = "Notepad2-mod";
		"home" = "http://xhmikosr.github.io/notepad2-mod/";
		"url" = "https://github.com/XhmikosR/notepad2-mod/releases/download/4.2.25.935/Notepad2-mod.4.2.25.935_x86.zip";
		"dir" = "notepad2-mod";
		"postinstall" = {
			function postinstall( [string]$dir ) {
				$ini = "$dir\Notepad2.ini";
				mv -Force -Path "$ini" -Destination "$ini.orig";
				& {
					"[Notepad2]";
					"Notepad2.ini=..\..\etc\notepad2\Notepad2.ini";
				} | Out-File "$ini";
			};
			postinstall $args[0];
		};
	}

	@{
		"name" = "UnxUtils";
		"home" = "http://unxutils.sourceforge.met/";
		"url" = "http://downloads.sourceforge.net/project/unxutils/unxutils/current/UnxUtils.zip";
		"dir" = "x-unxutils";
		"postinstall" = {
			function postinstall( [string]$dir ) {
				$src = "$dir\usr\local\wbin\*";
				$dst = "$dir\bin";
				mv -Force -Path $src -Destination $dst;
			};
			postinstall $args[0];
		};
	}

	@{
		"name" = "UnxUtils Updates";
		"home" = "http://unxutils.sourceforge.met/";
		"url" = "http://unxutils.sourceforge.net/UnxUpdates.zip";
		"dir" = "x-unxutils\bin";
	}

);

# =========================================================================

$dstDir = [System.IO.Path]::GetFullPath("$pwd\..\vendors");
$tmpDir = $pwd;

$7zip_exe = "";

# =========================================================================

function download-archive( [string]$url, [string]$targetDir ) {
	$filename = "$targetDir\" + [System.IO.Path]::GetFileName($url);
	if ( ! ( Test-Path $filename ) ) {
		$webclient = New-Object System.Net.WebClient;
		$webclient.DownloadFile($url, $filename);
	}
	return $filename;
}

function extract-zip( [string]$filename, [string]$targetDir ) {
	$shell = New-Object -com shell.application;
	$zip = $shell.NameSpace($filename);
	foreach ( $item in $zip.items() ) {
		$shell.Namespace($targetDir).CopyHere($item, 16);
	}
}

function extract-7z( [string]$filename, [string]$targetDir, [bool]$onlyFiles ) {
	$mode = if ( $onlyFiles ) { "e" } else { "x" };
	& "$script:7zip_exe" $mode "$filename" -y "-o$targetDir";
}

function extract-archive( [string]$filename, [string]$targetDir, [bool]$onlyFiles ) {
	if ( $script:7zip_exe ) {
		extract-7z $filename $targetDir $onlyFiles;
	} else {
		extract-zip $filename $targetDir;
	}
}

function install-package( $package ) {
	$dstDir = $script:dstDir + "\" + $package.dir;

@"

=======================================================================

Package: {0}
Destination: {1}

"@ -f $package.name, $dstDir;

	if ( $package.skip ) {
		"Skipped";
		return;
	}

	New-Item -Force -ItemType Directory -Path $dstDir >$null;
	$filename = download-archive $package.url $script:tmpDir;
	extract-archive $filename $dstDir ( !! $package.onlyFiles );

	if ( $package.postinstall ) {
		"`nInvoke command:";
		$package.postinstall;
		Invoke-Command -ScriptBlock $package.postinstall -ArgumentList $dstDir;
	}
}

# =========================================================================

$enabled = "$pwd\zentea.enabled";

if ( ! ( Test-Path "$enabled" ) ) {
	[System.Reflection.Assembly]::LoadWithPartialName( "System.Windows.Forms" ) >$Null;
	[System.Windows.Forms.MessageBox]::Show( "To enable execution create the file:`n$enabled.", "Disabled", 0, "Stop" ) >$Null;
	exit;
}

$packages | % { install-package $_; } | Out-File "$pwd\zentea.log";

Remove-Item -Force -Path "$enabled";

# =========================================================================

# EOF

<# :
@echo off
setlocal
set "POWERSHELL_BAT_ARGS=%*"
if defined POWERSHELL_BAT_ARGS set "POWERSHELL_BAT_ARGS=%POWERSHELL_BAT_ARGS:"=\"%"
endlocal & powershell -NoLogo -NoProfile -Command "$_ = $input; Invoke-Expression $( '$input = $_; $_ = \"\"; $args = @( &{ $args } %POWERSHELL_BAT_ARGS% );' + [String]::Join( [char]10, $( Get-Content \"%~f0\" ) ) )"
goto :EOF
#>

$packages = @(

	@{
		"name" = "7-zip";
		"home" = "http://7-zip.org/";
		"url" = "http://downloads.sourceforge.net/sevenzip/7za920.zip";
		"dir" = "7za";
		"postinstall" = {
			function postinstall( [string]$dir ) {
				$script:7zip_exe = "$dir\7za.exe";
			};
			postinstall $args[0];
		};
	}

	@{
		"name" = "ConEmu";
		"home" = "http://code.google.com/p/conemu-maximus5/";
		"url" = "http://downloads.sourceforge.net/project/conemu/Alpha/ConEmuPack.150119a.7z";
		"dir" = "ConEmu";
	}

	@{
		"name" = "Clink";
		"home" = "http://mridgers.github.io/clink";
		"url" = "https://github.com/mridgers/clink/releases/download/0.4.3/clink_0.4.3.zip";
		"dir" = "clink";
		"onlyFiles" = $True;
		"postinstall" = {
			function postinstall( [string]$dir ) {
				ls $dir |
				? { $_.Attributes -eq "Directory" } |
				% { rmdir -Force -Path "$dir\$_"; };
			};
			postinstall $args[0];
		};
	}

	@{
		"name" = "Far3";
		"home" = "http://www.farmanager.com/";
		"url" = "http://www.farmanager.com/files/Far30b4242.x86.20150117.7z";
		"dir" = "Far3";
	}

	@{
		"skip" = $True;
		"name" = "Far3bis";
		"home" = "http://code.google.com/p/conemu-maximus5/";
		"url" = "http://downloads.sourceforge.net/project/conemu/FarManager/Far3bis/far3.4254bis.x86.x64.7z";
		"dir" = "Far3bis";
	}

	@{
		"name" = "Notepad2-mod";
		"home" = "http://xhmikosr.github.io/notepad2-mod/";
		"url" = "https://github.com/XhmikosR/notepad2-mod/releases/download/4.2.25.935/Notepad2-mod.4.2.25.935_x86.zip";
		"dir" = "notepad2-mod";
		"postinstall" = {
			function postinstall( [string]$dir ) {
				$ini = "$dir\Notepad2.ini";
				mv -Force -Path "$ini" -Destination "$ini.orig";
				& {
					"[Notepad2]";
					"Notepad2.ini=..\..\etc\notepad2\Notepad2.ini";
				} | Out-File "$ini";
			};
			postinstall $args[0];
		};
	}

	@{
		"name" = "UnxUtils";
		"home" = "http://unxutils.sourceforge.met/";
		"url" = "http://downloads.sourceforge.net/project/unxutils/unxutils/current/UnxUtils.zip";
		"dir" = "x-unxutils";
		"postinstall" = {
			function postinstall( [string]$dir ) {
				$src = "$dir\usr\local\wbin\*";
				$dst = "$dir\bin";
				mv -Force -Path $src -Destination $dst;
			};
			postinstall $args[0];
		};
	}

	@{
		"name" = "UnxUtils Updates";
		"home" = "http://unxutils.sourceforge.met/";
		"url" = "http://unxutils.sourceforge.net/UnxUpdates.zip";
		"dir" = "x-unxutils\bin";
	}

);

# =========================================================================

$dstDir = [System.IO.Path]::GetFullPath("$pwd\..\vendors");
$tmpDir = $pwd;

$7zip_exe = "";

# =========================================================================

function download-archive( [string]$url, [string]$targetDir ) {
	$filename = "$targetDir\" + [System.IO.Path]::GetFileName($url);
	if ( ! ( Test-Path $filename ) ) {
		$webclient = New-Object System.Net.WebClient;
		$webclient.DownloadFile($url, $filename);
	}
	return $filename;
}

function extract-zip( [string]$filename, [string]$targetDir ) {
	$shell = New-Object -com shell.application;
	$zip = $shell.NameSpace($filename);
	foreach ( $item in $zip.items() ) {
		$shell.Namespace($targetDir).CopyHere($item, 16);
	}
}

function extract-7z( [string]$filename, [string]$targetDir, [bool]$onlyFiles ) {
	$mode = if ( $onlyFiles ) { "e" } else { "x" };
	& "$script:7zip_exe" $mode "$filename" -y "-o$targetDir";
}

function extract-archive( [string]$filename, [string]$targetDir, [bool]$onlyFiles ) {
	if ( $script:7zip_exe ) {
		extract-7z $filename $targetDir $onlyFiles;
	} else {
		extract-zip $filename $targetDir;
	}
}

function install-package( $package ) {
	$dstDir = $script:dstDir + "\" + $package.dir;

@"

=======================================================================

Package: {0}
Destination: {1}

"@ -f $package.name, $dstDir;

	if ( $package.skip ) {
		"Skipped";
		return;
	}

	New-Item -Force -ItemType Directory -Path $dstDir >$null;
	$filename = download-archive $package.url $script:tmpDir;
	extract-archive $filename $dstDir ( !! $package.onlyFiles );

	if ( $package.postinstall ) {
		"`nInvoke command:";
		$package.postinstall;
		Invoke-Command -ScriptBlock $package.postinstall -ArgumentList $dstDir;
	}
}

# =========================================================================

$enabled = "$pwd\zentea.enabled";

if ( ! ( Test-Path "$enabled" ) ) {
	[System.Reflection.Assembly]::LoadWithPartialName( "System.Windows.Forms" ) >$Null;
	[System.Windows.Forms.MessageBox]::Show( "To enable execution create the file:`n$enabled.", "Disabled", 0, "Stop" ) >$Null;
	exit;
}

$packages | % { install-package $_; } | Out-File "$pwd\zentea.log";

Remove-Item -Force -Path "$enabled";

# =========================================================================

# EOF

update links to newer releases

zentea.bat: update links to newer releases


@ECHO OFF

REM ----------------------------------------------------------------------
REM PHP version 5
REM ----------------------------------------------------------------------
REM Copyright (c) 1997-2004 The PHP Group
REM ----------------------------------------------------------------------
REM  This source file is subject to version 3.0 of the PHP license,
REM  that is bundled with this package in the file LICENSE, and is
REM  available at through the world-wide-web at
REM  http://www.php.net/license/3_0.txt.
REM  If you did not receive a copy of the PHP license and are unable to
REM  obtain it through the world-wide-web, please send a note to
REM  license@php.net so we can mail you a copy immediately.
REM ----------------------------------------------------------------------
REM  Authors:     Alexander Merz (alexmerz@php.net)
REM ----------------------------------------------------------------------
REM
REM  Last updated 12/29/2004 ($Id$ is not replaced if the file is binary)

REM change this lines to match the paths of your system
REM -------------------

REM Test to see if this is a raw pear.bat (uninstalled version)
SET TMPTMPTMPTMPT=@includ
SET PMTPMTPMT=%TMPTMPTMPTMPT%e_path@
FOR %%x IN ("@include_path@") DO (if %%x=="%PMTPMTPMT%" GOTO :NOTINSTALLED)

REM Check PEAR global ENV, set them if they do not exist
IF "%PHP_PEAR_INSTALL_DIR%"=="" SET "PHP_PEAR_INSTALL_DIR=@include_path@"
IF "%PHP_PEAR_BIN_DIR%"=="" SET "PHP_PEAR_BIN_DIR=@bin_dir@"
IF "%PHP_PEAR_PHP_BIN%"=="" SET "PHP_PEAR_PHP_BIN=@php_bin@"
GOTO :INSTALLED

:NOTINSTALLED
ECHO WARNING: This is a raw, uninstalled pear.bat

REM Check to see if we can grab the directory of this file (Windows NT+)
IF %~n0 == pear (
FOR %%x IN (cli\php.exe php.exe) DO (if "%%~$PATH:x" NEQ "" (
SET "PHP_PEAR_PHP_BIN=%%~$PATH:x"
echo Using PHP Executable "%PHP_PEAR_PHP_BIN%"
"%PHP_PEAR_PHP_BIN%" -v
GOTO :NEXTTEST
))
GOTO :FAILAUTODETECT
:NEXTTEST
IF "%PHP_PEAR_PHP_BIN%" NEQ "" (

REM We can use this PHP to run a temporary php file to get the dirname of pear

echo ^<?php $s=getcwd^(^);chdir^($a=dirname^(__FILE__^).'\\'^);if^(stristr^($a,'\\scripts'^)^)$a=dirname^(dirname^($a^)^).'\\';$f=fopen^($s.'\\~a.a','wb'^);echo$s.'\\~a.a';fwrite^($f,$a^);fclose^($f^);chdir^($s^);?^> > ~~getloc.php
"%PHP_PEAR_PHP_BIN%" ~~getloc.php
set /p PHP_PEAR_BIN_DIR=fakeprompt < ~a.a
DEL ~a.a
DEL ~~getloc.php
set "PHP_PEAR_INSTALL_DIR=%PHP_PEAR_BIN_DIR%pear"

REM Make sure there is a pearcmd.php at our disposal

IF NOT EXIST %PHP_PEAR_INSTALL_DIR%\pearcmd.php (
IF EXIST %PHP_PEAR_INSTALL_DIR%\scripts\pearcmd.php COPY %PHP_PEAR_INSTALL_DIR%\scripts\pearcmd.php %PHP_PEAR_INSTALL_DIR%\pearcmd.php
IF EXIST pearcmd.php COPY pearcmd.php %PHP_PEAR_INSTALL_DIR%\pearcmd.php
IF EXIST %~dp0\scripts\pearcmd.php COPY %~dp0\scripts\pearcmd.php %PHP_PEAR_INSTALL_DIR%\pearcmd.php
)
)
GOTO :INSTALLED
) ELSE (
REM Windows Me/98 cannot succeed, so allow the batch to fail
)
:FAILAUTODETECT
echo WARNING: failed to auto-detect pear information
:INSTALLED

REM Check Folders and files
IF NOT EXIST "%PHP_PEAR_INSTALL_DIR%" GOTO PEAR_INSTALL_ERROR
IF NOT EXIST "%PHP_PEAR_INSTALL_DIR%\pearcmd.php" GOTO PEAR_INSTALL_ERROR2
IF NOT EXIST "%PHP_PEAR_BIN_DIR%" GOTO PEAR_BIN_ERROR
IF NOT EXIST "%PHP_PEAR_PHP_BIN%" GOTO PEAR_PHPBIN_ERROR
REM launch pearcmd
GOTO RUN
:PEAR_INSTALL_ERROR
ECHO PHP_PEAR_INSTALL_DIR is not set correctly.
ECHO Please fix it using your environment variable or modify
ECHO the default value in pear.bat
ECHO The current value is:
ECHO %PHP_PEAR_INSTALL_DIR%
GOTO END
:PEAR_INSTALL_ERROR2
ECHO PHP_PEAR_INSTALL_DIR is not set correctly.
ECHO pearcmd.php could not be found there.
ECHO Please fix it using your environment variable or modify
ECHO the default value in pear.bat
ECHO The current value is:
ECHO %PHP_PEAR_INSTALL_DIR%
GOTO END
:PEAR_BIN_ERROR
ECHO PHP_PEAR_BIN_DIR is not set correctly.
ECHO Please fix it using your environment variable or modify
ECHO the default value in pear.bat
ECHO The current value is:
ECHO %PHP_PEAR_BIN_DIR%
GOTO END
:PEAR_PHPBIN_ERROR
ECHO PHP_PEAR_PHP_BIN is not set correctly.
ECHO Please fix it using your environment variable or modify
ECHO the default value in pear.bat
ECHO The current value is:
ECHO %PHP_PEAR_PHP_BIN%
GOTO END
:RUN
"%PHP_PEAR_PHP_BIN%" -C -d output_buffering=1 -d safe_mode=0 -d open_basedir="" -d auto_prepend_file="" -d auto_append_file="" -d variables_order=EGPCS -d register_argc_argv="On" -d include_path="%PHP_PEAR_INSTALL_DIR%" -f "%PHP_PEAR_INSTALL_DIR%\pearcmd.php" -- %1 %2 %3 %4 %5 %6 %7 %8 %9
:END
@ECHO ON

@ECHO OFF

REM ----------------------------------------------------------------------
REM PHP version 5
REM ----------------------------------------------------------------------
REM Copyright (c) 1997-2010 The Authors
REM ----------------------------------------------------------------------
REM http://opensource.org/licenses/bsd-license.php New BSD License
REM ----------------------------------------------------------------------
REM  Authors:     Alexander Merz (alexmerz@php.net)
REM ----------------------------------------------------------------------
REM
REM  Last updated 12/29/2004 ($Id$ is not replaced if the file is binary)

REM change this lines to match the paths of your system
REM -------------------

REM Test to see if this is a raw pear.bat (uninstalled version)
SET TMPTMPTMPTMPT=@includ
SET PMTPMTPMT=%TMPTMPTMPTMPT%e_path@
FOR %%x IN ("@include_path@") DO (if %%x=="%PMTPMTPMT%" GOTO :NOTINSTALLED)

REM Check PEAR global ENV, set them if they do not exist
IF "%PHP_PEAR_INSTALL_DIR%"=="" SET "PHP_PEAR_INSTALL_DIR=@include_path@"
IF "%PHP_PEAR_BIN_DIR%"=="" SET "PHP_PEAR_BIN_DIR=@bin_dir@"
IF "%PHP_PEAR_PHP_BIN%"=="" SET "PHP_PEAR_PHP_BIN=@php_bin@"
GOTO :INSTALLED

:NOTINSTALLED
ECHO WARNING: This is a raw, uninstalled pear.bat

REM Check to see if we can grab the directory of this file (Windows NT+)
IF %~n0 == pear (
FOR %%x IN (cli\php.exe php.exe) DO (if "%%~$PATH:x" NEQ "" (
SET "PHP_PEAR_PHP_BIN=%%~$PATH:x"
echo Using PHP Executable "%PHP_PEAR_PHP_BIN%"
"%PHP_PEAR_PHP_BIN%" -v
GOTO :NEXTTEST
))
GOTO :FAILAUTODETECT
:NEXTTEST
IF "%PHP_PEAR_PHP_BIN%" NEQ "" (

REM We can use this PHP to run a temporary php file to get the dirname of pear

echo ^<?php $s=getcwd^(^);chdir^($a=dirname^(__FILE__^).'\\'^);if^(stristr^($a,'\\scripts'^)^)$a=dirname^(dirname^($a^)^).'\\';$f=fopen^($s.'\\~a.a','wb'^);echo$s.'\\~a.a';fwrite^($f,$a^);fclose^($f^);chdir^($s^);?^> > ~~getloc.php
"%PHP_PEAR_PHP_BIN%" ~~getloc.php
set /p PHP_PEAR_BIN_DIR=fakeprompt < ~a.a
DEL ~a.a
DEL ~~getloc.php
set "PHP_PEAR_INSTALL_DIR=%PHP_PEAR_BIN_DIR%pear"

REM Make sure there is a pearcmd.php at our disposal

IF NOT EXIST %PHP_PEAR_INSTALL_DIR%\pearcmd.php (
IF EXIST %PHP_PEAR_INSTALL_DIR%\scripts\pearcmd.php COPY %PHP_PEAR_INSTALL_DIR%\scripts\pearcmd.php %PHP_PEAR_INSTALL_DIR%\pearcmd.php
IF EXIST pearcmd.php COPY pearcmd.php %PHP_PEAR_INSTALL_DIR%\pearcmd.php
IF EXIST %~dp0\scripts\pearcmd.php COPY %~dp0\scripts\pearcmd.php %PHP_PEAR_INSTALL_DIR%\pearcmd.php
)
)
GOTO :INSTALLED
) ELSE (
REM Windows Me/98 cannot succeed, so allow the batch to fail
)
:FAILAUTODETECT
echo WARNING: failed to auto-detect pear information
:INSTALLED

REM Check Folders and files
IF NOT EXIST "%PHP_PEAR_INSTALL_DIR%" GOTO PEAR_INSTALL_ERROR
IF NOT EXIST "%PHP_PEAR_INSTALL_DIR%\pearcmd.php" GOTO PEAR_INSTALL_ERROR2
IF NOT EXIST "%PHP_PEAR_BIN_DIR%" GOTO PEAR_BIN_ERROR
IF NOT EXIST "%PHP_PEAR_PHP_BIN%" GOTO PEAR_PHPBIN_ERROR
REM launch pearcmd
GOTO RUN
:PEAR_INSTALL_ERROR
ECHO PHP_PEAR_INSTALL_DIR is not set correctly.
ECHO Please fix it using your environment variable or modify
ECHO the default value in pear.bat
ECHO The current value is:
ECHO %PHP_PEAR_INSTALL_DIR%
GOTO END
:PEAR_INSTALL_ERROR2
ECHO PHP_PEAR_INSTALL_DIR is not set correctly.
ECHO pearcmd.php could not be found there.
ECHO Please fix it using your environment variable or modify
ECHO the default value in pear.bat
ECHO The current value is:
ECHO %PHP_PEAR_INSTALL_DIR%
GOTO END
:PEAR_BIN_ERROR
ECHO PHP_PEAR_BIN_DIR is not set correctly.
ECHO Please fix it using your environment variable or modify
ECHO the default value in pear.bat
ECHO The current value is:
ECHO %PHP_PEAR_BIN_DIR%
GOTO END
:PEAR_PHPBIN_ERROR
ECHO PHP_PEAR_PHP_BIN is not set correctly.
ECHO Please fix it using your environment variable or modify
ECHO the default value in pear.bat
ECHO The current value is:
ECHO %PHP_PEAR_PHP_BIN%
GOTO END
:RUN
"%PHP_PEAR_PHP_BIN%" -C -d output_buffering=1 -d safe_mode=0 -d open_basedir="" -d auto_prepend_file="" -d auto_append_file="" -d variables_order=EGPCS -d register_argc_argv="On" -d include_path="%PHP_PEAR_INSTALL_DIR%" -f "%PHP_PEAR_INSTALL_DIR%\pearcmd.php" -- %1 %2 %3 %4 %5 %6 %7 %8 %9
:END
@ECHO ON

Replace the PHP license with New BSD like rest of the installer.

git-svn-id: 4b064e69dc630d28214c1e1442d27300cccf8e9a@296944 c90b9560-bf6c-de11-be94-00142212c4b1


@echo off
setlocal

pushd %~dp0\..

set VSCODEUSERDATADIR=%TEMP%\vscodeuserfolder-%RANDOM%-%TIME:~6,2%
set VSCODECRASHDIR=%~dp0\..\.build\crashes

:: Figure out which Electron to use for running tests
if "%INTEGRATION_TEST_ELECTRON_PATH%"=="" (
	:: Run out of sources: no need to compile as code.bat takes care of it
	chcp 65001
	set INTEGRATION_TEST_ELECTRON_PATH=.\scripts\code.bat
	set VSCODE_BUILD_BUILTIN_EXTENSIONS_SILENCE_PLEASE=1

	echo Storing crash reports into '%VSCODECRASHDIR%'.
	echo Running integration tests out of sources.
) else (
	:: Run from a built: need to compile all test extensions
	:: because we run extension tests from their source folders
	:: and the build bundles extensions into .build webpacked
	call yarn gulp 	compile-extension:vscode-api-tests^
					compile-extension:vscode-colorize-tests^
					compile-extension:markdown-language-features^
					compile-extension:typescript-language-features^
					compile-extension:vscode-notebook-tests^
					compile-extension:emmet^
					compile-extension:css-language-features-server^
					compile-extension:html-language-features-server^
					compile-extension:json-language-features-server^
					compile-extension:git

	:: Configuration for more verbose output
	set VSCODE_CLI=1
	set ELECTRON_ENABLE_LOGGING=1

	echo Storing crash reports into '%VSCODECRASHDIR%'.
	echo Running integration tests with '%INTEGRATION_TEST_ELECTRON_PATH%' as build.
)

:: Integration & performance tests in AMD
::call .\scripts\test.bat --runGlob **\*.integrationTest.js %*
::if %errorlevel% neq 0 exit /b %errorlevel%

:: Tests in the extension host

REM call "%INTEGRATION_TEST_ELECTRON_PATH%" %~dp0\..\extensions\vscode-notebook-tests\test --enable-proposed-api=vscode.vscode-notebook-tests --extensionDevelopmentPath=%~dp0\..\extensions\vscode-notebook-tests --extensionTestsPath=%~dp0\..\extensions\vscode-notebook-tests\out --disable-telemetry --crash-reporter-directory=%VSCODECRASHDIR% --no-cached-data --disable-updates --disable-extensions --user-data-dir=%VSCODEUSERDATADIR%
REM if %errorlevel% neq 0 exit /b %errorlevel%

call "%INTEGRATION_TEST_ELECTRON_PATH%" %~dp0\..\extensions\vscode-api-tests\testWorkspace --enable-proposed-api=vscode.vscode-api-tests --extensionDevelopmentPath=%~dp0\..\extensions\vscode-api-tests --extensionTestsPath=%~dp0\..\extensions\vscode-api-tests\out\singlefolder-tests --disable-telemetry --crash-reporter-directory=%VSCODECRASHDIR% --no-cached-data --disable-updates --disable-extensions --user-data-dir=%VSCODEUSERDATADIR%
if %errorlevel% neq 0 exit /b %errorlevel%

call "%INTEGRATION_TEST_ELECTRON_PATH%" %~dp0\..\extensions\vscode-api-tests\testworkspace.code-workspace --enable-proposed-api=vscode.vscode-api-tests --extensionDevelopmentPath=%~dp0\..\extensions\vscode-api-tests --extensionTestsPath=%~dp0\..\extensions\vscode-api-tests\out\workspace-tests --disable-telemetry --crash-reporter-directory=%VSCODECRASHDIR% --no-cached-data --disable-updates --disable-extensions --user-data-dir=%VSCODEUSERDATADIR%
if %errorlevel% neq 0 exit /b %errorlevel%

call "%INTEGRATION_TEST_ELECTRON_PATH%" %~dp0\..\extensions\vscode-colorize-tests\test --extensionDevelopmentPath=%~dp0\..\extensions\vscode-colorize-tests --extensionTestsPath=%~dp0\..\extensions\vscode-colorize-tests\out --disable-telemetry --crash-reporter-directory=%VSCODECRASHDIR% --no-cached-data --disable-updates --disable-extensions --user-data-dir=%VSCODEUSERDATADIR%
if %errorlevel% neq 0 exit /b %errorlevel%

REM call "%INTEGRATION_TEST_ELECTRON_PATH%" %~dp0\..\extensions\typescript-language-features\test-workspace --extensionDevelopmentPath=%~dp0\..\extensions\typescript-language-features --extensionTestsPath=%~dp0\..\extensions\typescript-language-features\out\test --disable-telemetry --crash-reporter-directory=%VSCODECRASHDIR% --no-cached-data --disable-updates --disable-extensions --user-data-dir=%VSCODEUSERDATADIR%
REM if %errorlevel% neq 0 exit /b %errorlevel%

call "%INTEGRATION_TEST_ELECTRON_PATH%" %~dp0\..\extensions\markdown-language-features\test-workspace --extensionDevelopmentPath=%~dp0\..\extensions\markdown-language-features --extensionTestsPath=%~dp0\..\extensions\markdown-language-features\out\test --disable-telemetry --crash-reporter-directory=%VSCODECRASHDIR% --no-cached-data --disable-updates --disable-extensions --user-data-dir=%VSCODEUSERDATADIR%
if %errorlevel% neq 0 exit /b %errorlevel%

call "%INTEGRATION_TEST_ELECTRON_PATH%" $%~dp0\..\extensions\emmet\out\test\test-fixtures --extensionDevelopmentPath=%~dp0\..\extensions\emmet --extensionTestsPath=%~dp0\..\extensions\emmet\out\test --disable-telemetry --crash-reporter-directory=%VSCODECRASHDIR% --no-cached-data --disable-updates --disable-extensions --user-data-dir=%VSCODEUSERDATADIR% .
if %errorlevel% neq 0 exit /b %errorlevel%

for /f "delims=" %%i in ('node -p "require('fs').realpathSync.native(require('os').tmpdir())"') do set TEMPDIR=%%i
set GITWORKSPACE=%TEMPDIR%\git-%RANDOM%
mkdir %GITWORKSPACE%
call "%INTEGRATION_TEST_ELECTRON_PATH%" %GITWORKSPACE% --extensionDevelopmentPath=%~dp0\..\extensions\git --extensionTestsPath=%~dp0\..\extensions\git\out\test --enable-proposed-api=vscode.git --disable-telemetry --crash-reporter-directory=%VSCODECRASHDIR% --no-cached-data --disable-updates --disable-extensions --user-data-dir=%VSCODEUSERDATADIR%
if %errorlevel% neq 0 exit /b %errorlevel%

:: Tests in commonJS (HTML, CSS, JSON language server tests...)
call .\scripts\node-electron.bat .\node_modules\mocha\bin\_mocha .\extensions\*\server\out\test\**\*.test.js
if %errorlevel% neq 0 exit /b %errorlevel%

rmdir /s /q %VSCODEUSERDATADIR%

popd

endlocal

@echo off
setlocal

pushd %~dp0\..

set VSCODEUSERDATADIR=%TEMP%\vscodeuserfolder-%RANDOM%-%TIME:~6,2%
set VSCODECRASHDIR=%~dp0\..\.build\crashes

:: Figure out which Electron to use for running tests
if "%INTEGRATION_TEST_ELECTRON_PATH%"=="" (
	:: Run out of sources: no need to compile as code.bat takes care of it
	chcp 65001
	set INTEGRATION_TEST_ELECTRON_PATH=.\scripts\code.bat
	set VSCODE_BUILD_BUILTIN_EXTENSIONS_SILENCE_PLEASE=1

	echo Storing crash reports into '%VSCODECRASHDIR%'.
	echo Running integration tests out of sources.
) else (
	:: Run from a built: need to compile all test extensions
	:: because we run extension tests from their source folders
	:: and the build bundles extensions into .build webpacked
	call yarn gulp 	compile-extension:vscode-api-tests^
					compile-extension:vscode-colorize-tests^
					compile-extension:markdown-language-features^
					compile-extension:typescript-language-features^
					compile-extension:vscode-notebook-tests^
					compile-extension:emmet^
					compile-extension:css-language-features-server^
					compile-extension:html-language-features-server^
					compile-extension:json-language-features-server^
					compile-extension:git

	:: Configuration for more verbose output
	set VSCODE_CLI=1
	set ELECTRON_ENABLE_LOGGING=1

	echo Storing crash reports into '%VSCODECRASHDIR%'.
	echo Running integration tests with '%INTEGRATION_TEST_ELECTRON_PATH%' as build.
)

:: Integration & performance tests in AMD
::call .\scripts\test.bat --runGlob **\*.integrationTest.js %*
::if %errorlevel% neq 0 exit /b %errorlevel%

:: Tests in the extension host

call "%INTEGRATION_TEST_ELECTRON_PATH%" %~dp0\..\extensions\vscode-notebook-tests\test --enable-proposed-api=vscode.vscode-notebook-tests --extensionDevelopmentPath=%~dp0\..\extensions\vscode-notebook-tests --extensionTestsPath=%~dp0\..\extensions\vscode-notebook-tests\out --disable-telemetry --crash-reporter-directory=%VSCODECRASHDIR% --no-cached-data --disable-updates --disable-extensions --user-data-dir=%VSCODEUSERDATADIR%
if %errorlevel% neq 0 exit /b %errorlevel%

call "%INTEGRATION_TEST_ELECTRON_PATH%" %~dp0\..\extensions\vscode-api-tests\testWorkspace --enable-proposed-api=vscode.vscode-api-tests --extensionDevelopmentPath=%~dp0\..\extensions\vscode-api-tests --extensionTestsPath=%~dp0\..\extensions\vscode-api-tests\out\singlefolder-tests --disable-telemetry --crash-reporter-directory=%VSCODECRASHDIR% --no-cached-data --disable-updates --disable-extensions --user-data-dir=%VSCODEUSERDATADIR%
if %errorlevel% neq 0 exit /b %errorlevel%

call "%INTEGRATION_TEST_ELECTRON_PATH%" %~dp0\..\extensions\vscode-api-tests\testworkspace.code-workspace --enable-proposed-api=vscode.vscode-api-tests --extensionDevelopmentPath=%~dp0\..\extensions\vscode-api-tests --extensionTestsPath=%~dp0\..\extensions\vscode-api-tests\out\workspace-tests --disable-telemetry --crash-reporter-directory=%VSCODECRASHDIR% --no-cached-data --disable-updates --disable-extensions --user-data-dir=%VSCODEUSERDATADIR%
if %errorlevel% neq 0 exit /b %errorlevel%

call "%INTEGRATION_TEST_ELECTRON_PATH%" %~dp0\..\extensions\vscode-colorize-tests\test --extensionDevelopmentPath=%~dp0\..\extensions\vscode-colorize-tests --extensionTestsPath=%~dp0\..\extensions\vscode-colorize-tests\out --disable-telemetry --crash-reporter-directory=%VSCODECRASHDIR% --no-cached-data --disable-updates --disable-extensions --user-data-dir=%VSCODEUSERDATADIR%
if %errorlevel% neq 0 exit /b %errorlevel%

REM call "%INTEGRATION_TEST_ELECTRON_PATH%" %~dp0\..\extensions\typescript-language-features\test-workspace --extensionDevelopmentPath=%~dp0\..\extensions\typescript-language-features --extensionTestsPath=%~dp0\..\extensions\typescript-language-features\out\test --disable-telemetry --crash-reporter-directory=%VSCODECRASHDIR% --no-cached-data --disable-updates --disable-extensions --user-data-dir=%VSCODEUSERDATADIR%
REM if %errorlevel% neq 0 exit /b %errorlevel%

call "%INTEGRATION_TEST_ELECTRON_PATH%" %~dp0\..\extensions\markdown-language-features\test-workspace --extensionDevelopmentPath=%~dp0\..\extensions\markdown-language-features --extensionTestsPath=%~dp0\..\extensions\markdown-language-features\out\test --disable-telemetry --crash-reporter-directory=%VSCODECRASHDIR% --no-cached-data --disable-updates --disable-extensions --user-data-dir=%VSCODEUSERDATADIR%
if %errorlevel% neq 0 exit /b %errorlevel%

call "%INTEGRATION_TEST_ELECTRON_PATH%" $%~dp0\..\extensions\emmet\out\test\test-fixtures --extensionDevelopmentPath=%~dp0\..\extensions\emmet --extensionTestsPath=%~dp0\..\extensions\emmet\out\test --disable-telemetry --crash-reporter-directory=%VSCODECRASHDIR% --no-cached-data --disable-updates --disable-extensions --user-data-dir=%VSCODEUSERDATADIR% .
if %errorlevel% neq 0 exit /b %errorlevel%

for /f "delims=" %%i in ('node -p "require('fs').realpathSync.native(require('os').tmpdir())"') do set TEMPDIR=%%i
set GITWORKSPACE=%TEMPDIR%\git-%RANDOM%
mkdir %GITWORKSPACE%
call "%INTEGRATION_TEST_ELECTRON_PATH%" %GITWORKSPACE% --extensionDevelopmentPath=%~dp0\..\extensions\git --extensionTestsPath=%~dp0\..\extensions\git\out\test --enable-proposed-api=vscode.git --disable-telemetry --crash-reporter-directory=%VSCODECRASHDIR% --no-cached-data --disable-updates --disable-extensions --user-data-dir=%VSCODEUSERDATADIR%
if %errorlevel% neq 0 exit /b %errorlevel%

:: Tests in commonJS (HTML, CSS, JSON language server tests...)
call .\scripts\node-electron.bat .\node_modules\mocha\bin\_mocha .\extensions\*\server\out\test\**\*.test.js
if %errorlevel% neq 0 exit /b %errorlevel%

rmdir /s /q %VSCODEUSERDATADIR%

popd

endlocal

enable windows.

enable windows.


set LIB=%LIBRARY_LIB%;%LIB%
set LIBPATH=%LIBRARY_LIB%;%LIBPATH%
set INCLUDE=%LIBRARY_INC%;%INCLUDE%

ECHO [directories] > setup.cfg
ECHO basedirlist = %LIBRARY_PREFIX% >> setup.cfg
ECHO [packages] >> setup.cfg
ECHO tests = False >> setup.cfg
ECHO sample_data = False >> setup.cfg
ECHO toolkits_tests = False >> setup.cfg

rem matplotlib will link to png, zlib statically if it exists. Replace the static library with shared
del %LIBRARY_LIB%\libpng16_static.lib
copy %LIBRARY_LIB%\libpng16.lib %LIBRARY_LIB%\libpng16_static.lib
del %LIBRARY_LIB%\zlibstatic.lib
copy %LIBRARY_LIB%\z.lib %LIBRARY_LIB%\zlibstatic.lib

%PYTHON% -m pip install . --no-deps -vv
if errorlevel 1 exit 1

set LIB=%LIBRARY_LIB%;%LIB%
set LIBPATH=%LIBRARY_LIB%;%LIBPATH%
set INCLUDE=%LIBRARY_INC%;%INCLUDE%

ECHO [directories] > setup.cfg
ECHO basedirlist = %LIBRARY_PREFIX% >> setup.cfg
ECHO [packages] >> setup.cfg
ECHO tests = False >> setup.cfg
ECHO sample_data = False >> setup.cfg
ECHO toolkits_tests = False >> setup.cfg

%PYTHON% -m pip install . --no-deps -vv
if errorlevel 1 exit 1

Remove unneeded handling of static libraries on windows

Matplotlib no longer depends on these.


@REM
@REM Copyright (C) 2013 Microsoft Corporation
@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.
@REM

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

:: RUNTIME
set REEF_VERSION=0.1-SNAPSHOT
set SELF_JAR=%REEF_HOME%\reef-examples\target\reef-examples-%REEF_VERSION%.jar
set REEF_JAR=%REEF_HOME%\reef-runtime-yarn\target\reef-runtime-yarn-%REEF_VERSION%-jar-with-dependencies.jar
set LOCAL_JAR=%REEF_HOME%\reef-runtime-local\target\reef-runtime-local-%REEF_VERSION%.jar

:: set LOCAL_RUNTIME_TMP="-Dcom.microsoft.reef.runtime.local.folder=%REEF_HOME%\reef-examples\REEF_RUNTIME_LOCAL\"
set LOGGING_CONFIG=-Djava.util.logging.config.class=com.microsoft.reef.util.logging.Config

set CLASSPATH=%YARN_CONF_DIR%;%YARN_HOME%\share\hadoop\common\lib\*;%YARN_HOME%\share\hadoop\common\*;%YARN_HOME%\contrib\capacity-scheduler\*.jar;%YARN_HOME%\share\hadoop\hdfs;%YARN_HOME%\share\hadoop\hdfs\lib\*;%YARN_HOME%\share\hadoop\hdfs\*;%YARN_HOME%\share\hadoop\yarn\lib\*;%YARN_HOME%\share\hadoop\yarn\*;%YARN_HOME%\share\hadoop\mapreduce\lib\*;%YARN_HOME%\share\hadoop\mapreduce\*;%YARN_HOME%\etc\hadoop\;%CLASSPATH%

set CMD=java -cp %REEF_JAR%;%LOCAL_JAR%;%SELF_JAR%;%CLASSPATH% %LOCAL_RUNTIME_TMP% %LOGGING_CONFIG% %*
echo %CMD%
%CMD%

@REM
@REM Copyright (C) 2013 Microsoft Corporation
@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.
@REM

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

:: RUNTIME
set REEF_VERSION=0.1-SNAPSHOT
set SELF_JAR=%REEF_HOME%\reef-examples\target\reef-examples-%REEF_VERSION%-shaded.jar

:: set LOCAL_RUNTIME_TMP="-Dcom.microsoft.reef.runtime.local.folder=%REEF_HOME%\reef-examples\REEF_RUNTIME_LOCAL\"
set LOGGING_CONFIG=-Djava.util.logging.config.class=com.microsoft.reef.util.logging.Config

set CLASSPATH=%YARN_HOME%\share\hadoop\hdfs;%YARN_HOME%\share\hadoop\mapreduce\lib\*;%YARN_HOME%\share\hadoop\mapreduce\*;%CLASSPATH%

set CMD=java -cp %YARN_CONF_DIR%;%SELF_JAR%;%CLASSPATH% %LOCAL_RUNTIME_TMP% %LOGGING_CONFIG% %*
echo %CMD%
%CMD%

update run.cmd to be compatible with REEF_JAR changes


REM the following works for networked drives with spaces!!!
REM Net use p: "\\myNetwork\HPS Classes$\computer programming 2011\Assignments" /persistent:no
REM set NODE_PATH=p:\nodejs

REM dir/x gives the short file names.
REM you need to get these paths correct for nodejs, ARM, spark-cli, dfu files

set NODE_PATH=C:\progra~1\nodejs

set DFU_FILES_PATH=C:\Users\JEREL_~1\DOCUME~1\Jeremy\cp12\spark\dfu

set SPARK_CLI_PATH=C:\Users\JEREL_~1\AppData\Roaming\npm

set GCC_ARM_PATH=C:\PROGRA~2\GNUTOO~1\4947E~1.920\bin

set PATH=C:\Windows;C:\Windows\System32;%NODE_PATH%;%DFU_FILES_PATH%;%SPARK_CLI_PATH%;%GCC_ARM_PATH%;

REM note the next line overwrites the myoutput using > normally >> adds to the file

echo "*************************************"  > myoutput.txt 2>&1
echo "PATH"                                  >> myoutput.txt 2>&1
echo "*************************************" >> myoutput.txt 2>&1
rem PATH                                     >> myoutput.txt 2>&1
echo "*************************************" >> myoutput.txt 2>&1

echo "*************************************" >> myoutput.txt 2>&1
echo "node --version"                        >> myoutput.txt 2>&1
echo "*************************************" >> myoutput.txt 2>&1
node --version                               >> myoutput.txt 2>&1
echo "*************************************" >> myoutput.txt 2>&1

echo "*************************************" >> myoutput.txt 2>&1
echo "arm-none-eabi-gcc --version"           >> myoutput.txt 2>&1
echo "*************************************" >> myoutput.txt 2>&1
arm-none-eabi-gcc --version                  >> myoutput.txt 2>&1
echo "*************************************" >> myoutput.txt 2>&1

echo "*************************************" >> myoutput.txt 2>&1
echo "dfu-util -l"                           >> myoutput.txt 2>&1
echo "*************************************" >> myoutput.txt 2>&1
dfu-util -l                                  >> myoutput.txt 2>&1
echo "*************************************" >> myoutput.txt 2>&1

echo "*************************************" >> myoutput.txt 2>&1
echo "spark flash --usb spkbin\core-firmware.bin"  >> myoutput.txt 2>&1
echo "*************************************" >> myoutput.txt 2>&1
spark flash --usb spkbin\core-firmware.bin        >> myoutput.txt 2>&1
echo "*************************************" >> myoutput.txt 2>&1

rem spark must be last or in its own batch file as it kills the batch program

echo "*************************************" >> myoutput.txt 2>&1
echo "spark --version"                       >> myoutput.txt 2>&1
echo "*************************************" >> myoutput.txt 2>&1
spark --version                              >> myoutput.txt 2>&1
echo "*************************************" >> myoutput.txt 2>&1

rem spark must be last or in its own batch file as it kills the batch program

echo "*************************************" >> myoutput.txt 2>&1
echo "npm --version"                         >> myoutput.txt 2>&1
echo "*************************************" >> myoutput.txt 2>&1
npm --version                                >> myoutput.txt 2>&1
echo "*************************************" >> myoutput.txt 2>&1

Create doFirmware.bat

Create doFirmware.bat


@echo off

if "%1" == "test" (
	vagrant up && vagrant ssh --command "temp=$(mktemp --directory) && rsync --recursive --exclude='.*' /vagrant/* $temp && chmod 644 test/*.py && sudo chgrp --recursive vagrant /var/lib/jenkins && sudo chmod --recursive g+w /var/lib/jenkins && cd $temp && nosetests --verbose"
	if errorlevel 1 exit /b 1
	goto end
)

if "%1" == "clean" (
	vagrant destroy --force
	if errorlevel 1 exit /b 1
	goto end
)

:end

@echo off

if "%1" == "test" (
	vagrant up && vagrant ssh --command "temp=$(mktemp --directory) && rsync --recursive --exclude='.*' /vagrant/* $temp && chmod 644 $temp/test/*.py && sudo chgrp --recursive vagrant /var/lib/jenkins && sudo chmod --recursive g+w /var/lib/jenkins && cd $temp && nosetests --verbose"
	if errorlevel 1 exit /b 1
	goto end
)

if "%1" == "clean" (
	vagrant destroy --force
	if errorlevel 1 exit /b 1
	goto end
)

:end

fix windows make test

fix windows make test


@echo off
setlocal
set PATH=%PATH%;%ProgramFiles(x86)%\MSBuild\14.0\Bin\;%WINDIR%\Microsoft.NET\Framework\v4.0.30319

:getopts
if "%1"=="" (goto :default) else (goto :%1)
goto :exit

:default
goto :debug

:debug
set _target=Build
set _flavour=Debug
goto :main

:clean-debug
set _target=Clean
set _flavour=Debug
goto :main

:stage-debug
set _target=Stage
set _flavour=Debug
goto :main

:release
set _target=Build
set _flavour=Release
goto :main

:clean-release
set _target=Clean
set _flavour=Release
goto :main

:stage-release
set _target=Stage
set _flavour=Release
goto :main

:package-release
set _target=Package
set _flavour=Release
goto :main

:clean
echo No target 'clean'. Try 'clean-debug' or 'clean-release'.
goto :exit

:stage
echo No target 'stage'. Try 'stage-debug' or 'stage-release'.
goto :exit

:package
echo No target 'package'. Try 'package-release'.
goto :exit

:test
echo No target 'test'. Try 'test-smoke', 'test-ironpython', 'test-cpython', or 'test-all'.
goto :exit

:test-smoke
pushd bin\Debug
IronPythonTest.exe --labels=All --where:Category==StandardCPython --result:smoke-result-net40.xml
popd
pushd bin\v45Debug
IronPythonTest.exe --labels=All --where:Category==StandardCPython --result:smoke-result-net45.xml
popd
goto :exit

:test-ironpython
pushd bin\Debug
IronPythonTest.exe --labels=All --where:Category==IronPython --result:ironpython-result.xml
popd
goto :exit

:test-cpython
pushd bin\Debug
IronPythonTest.exe --labels=All --where:"Category==StandardCPython || Category==AllCPython" --result:cpython-result.xml
popd
goto :exit

:test-all
pushd bin\Debug
IronPythonTest.exe --labels=All --result:all-result.xml
popd
goto :exit

:test-custom
pushd bin\Debug
shift
IronPythonTest.exe --labels=All --result:custom-result.xml %1 %2 %3 %4 %5 %6 %7 %8 %9
popd
goto :exit

:restore
set _target=RestoreReferences
set _flavour=Release
goto :main

:distclean
msbuild /t:DistClean /p:BuildFlavour=Release /verbosity:minimal /nologo /p:Platform="Any CPU"
msbuild /t:DistClean /p:BuildFlavour=Debug /verbosity:minimal /nologo /p:Platform="Any CPU"
goto :main

:main
msbuild Build.proj /t:%_target% /p:BuildFlavour=%_flavour% /verbosity:minimal /nologo /p:Platform="Any CPU"
goto :exit

:exit
endlocal

@echo off
setlocal
set PATH=%PATH%;%ProgramFiles(x86)%\MSBuild\14.0\Bin\;%WINDIR%\Microsoft.NET\Framework\v4.0.30319

:getopts
if "%1"=="" (goto :default) else (goto :%1)
goto :exit

:default
goto :debug

:debug
set _target=Build
set _flavour=Debug
goto :main

:clean-debug
set _target=Clean
set _flavour=Debug
goto :main

:stage-debug
set _target=Stage
set _flavour=Debug
goto :main

:release
set _target=Build
set _flavour=Release
goto :main

:clean-release
set _target=Clean
set _flavour=Release
goto :main

:stage-release
set _target=Stage
set _flavour=Release
goto :main

:package-release
set _target=Package
set _flavour=Release
goto :main

:clean
echo No target 'clean'. Try 'clean-debug' or 'clean-release'.
goto :exit

:stage
echo No target 'stage'. Try 'stage-debug' or 'stage-release'.
goto :exit

:package
echo No target 'package'. Try 'package-release'.
goto :exit

:test
echo No target 'test'. Try 'test-smoke', 'test-ironpython', 'test-cpython', or 'test-all'.
goto :exit

:test-smoke
pushd bin\v4Debug
IronPythonTest.exe --labels=All --where:Category==StandardCPython --result:smoke-result-net40.xml
popd
pushd bin\Debug
IronPythonTest.exe --labels=All --where:Category==StandardCPython --result:smoke-result-net45.xml
popd
goto :exit

:test-ironpython
pushd bin\Debug
IronPythonTest.exe --labels=All --where:Category==IronPython --result:ironpython-result.xml
popd
goto :exit

:test-cpython
pushd bin\Debug
IronPythonTest.exe --labels=All --where:"Category==StandardCPython || Category==AllCPython" --result:cpython-result.xml
popd
goto :exit

:test-all
pushd bin\Debug
IronPythonTest.exe --labels=All --result:all-result.xml
popd
goto :exit

:test-custom
pushd bin\Debug
shift
IronPythonTest.exe --labels=All --result:custom-result.xml %1 %2 %3 %4 %5 %6 %7 %8 %9
popd
goto :exit

:restore
set _target=RestoreReferences
set _flavour=Release
goto :main

:distclean
msbuild /t:DistClean /p:BuildFlavour=Release /verbosity:minimal /nologo /p:Platform="Any CPU"
msbuild /t:DistClean /p:BuildFlavour=Debug /verbosity:minimal /nologo /p:Platform="Any CPU"
goto :main

:main
msbuild Build.proj /t:%_target% /p:BuildFlavour=%_flavour% /verbosity:minimal /nologo /p:Platform="Any CPU"
goto :exit

:exit
endlocal

Fix test-smoke (#168)

Fix test-smoke (#168)


set TIMESTAMP=http://www.startssl.com/timestamp
set NAME="LONG ACCESS"
set VERSION=%1
set PLATFORM=%2
set LACLI=..\packages\lacli.%VERSION%\lacli
call makensis /DVERSION=%VERSION% /DLACLI=%LACLI% /DPLATFORM=%PLATFORM% /DSIGN=%NAME% /DTIMESTAMP=%TIMESTAMP% /V4 lawapp_installer.nsi
call signtool sign /a /n %NAME% /tr %TIMESTAMP% Longaccess-%VERSION%-%PLATFORM%.exe

add batch file to build signed installer


REM {
set TOOLCHAIN=vs-14-2015
set PROJECT_DIR=examples/qt-widgets
.\jenkins.py --verbose --clear-except-download || exit /b 1
set PROJECT_DIR=examples/qt-qml
.\jenkins.py --verbose --nocreate || exit /b 1
set PROJECT_DIR=examples/qt-location
.\jenkins.py --verbose --nocreate || exit /b 1
set PROJECT_DIR=examples/qt-camera
.\jenkins.py --verbose --upload --nocreate || exit /b 1
REM }

REM {
set TOOLCHAIN=vs-12-2013
set PROJECT_DIR=examples/qt-widgets
.\jenkins.py --verbose --clear-except-download || exit /b 1
set PROJECT_DIR=examples/qt-qml
.\jenkins.py --verbose --nocreate || exit /b 1
set PROJECT_DIR=examples/qt-location
.\jenkins.py --verbose --nocreate || exit /b 1
set PROJECT_DIR=examples/qt-camera
.\jenkins.py --verbose --upload --nocreate || exit /b 1
REM }

REM {
set TOOLCHAIN=vs-11-2012
set PROJECT_DIR=examples/qt-widgets
.\jenkins.py --verbose --clear-except-download || exit /b 1
set PROJECT_DIR=examples/qt-qml
.\jenkins.py --verbose --nocreate || exit /b 1
set PROJECT_DIR=examples/qt-location
.\jenkins.py --verbose --nocreate || exit /b 1
set PROJECT_DIR=examples/qt-camera
.\jenkins.py --verbose --upload --nocreate || exit /b 1
REM }

REM {
set TOOLCHAIN=mingw
set PROJECT_DIR=examples/qt-widgets
.\jenkins.py --verbose --clear-except-download || exit /b 1
set PROJECT_DIR=examples/qt-qml
.\jenkins.py --verbose --nocreate || exit /b 1
set PROJECT_DIR=examples/qt-location
.\jenkins.py --verbose --nocreate || exit /b 1
set PROJECT_DIR=examples/qt-camera
.\jenkins.py --verbose --upload --nocreate || exit /b 1
REM }

REM {
set TOOLCHAIN=vs-14-2015
set PROJECT_DIR=examples/qt-widgets
.\jenkins.py --verbose --clear-except-download || exit /b 1
set PROJECT_DIR=examples/qt-qml
.\jenkins.py --verbose --nocreate || exit /b 1
set PROJECT_DIR=examples/qt-location
.\jenkins.py --verbose --nocreate || exit /b 1
set PROJECT_DIR=examples/qt-camera
.\jenkins.py --verbose --upload --nocreate || exit /b 1
REM }

REM {
set TOOLCHAIN=vs-12-2013
set PROJECT_DIR=examples/qt-widgets
.\jenkins.py --verbose --clear-except-download || exit /b 1
set PROJECT_DIR=examples/qt-qml
.\jenkins.py --verbose --nocreate || exit /b 1
set PROJECT_DIR=examples/qt-location
.\jenkins.py --verbose --nocreate || exit /b 1
set PROJECT_DIR=examples/qt-camera
.\jenkins.py --verbose --upload --nocreate || exit /b 1
REM }

REM {
set TOOLCHAIN=mingw
set PROJECT_DIR=examples/qt-widgets
.\jenkins.py --verbose --clear-except-download || exit /b 1
set PROJECT_DIR=examples/qt-qml
.\jenkins.py --verbose --nocreate || exit /b 1
set PROJECT_DIR=examples/qt-location
.\jenkins.py --verbose --nocreate || exit /b 1
set PROJECT_DIR=examples/qt-camera
.\jenkins.py --verbose --upload --nocreate || exit /b 1
REM }

Remove vs-11-2012 toolchain

Remove vs-11-2012 toolchain


Add file run.bat

Add file run.bat


@echo off
REM
REM ELMAH - Error Logging Modules and Handlers for ASP.NET
REM Copyright (c) 2004-9 Atif Aziz. All rights reserved.
REM
REM  Author(s):
REM
REM      Atif Aziz, http://www.raboof.com
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.
REM
REM -------------------------------------------------------------------------
REM
setlocal
pushd "%~dp0"
call :main %*
popd
goto :EOF

:main
set MSBUILDEXE=%SystemRoot%\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe
if not exist "%MSBUILDEXE%" (
    echo Microsoft Build Engine ^(MSBuild^) 4.0 does not appear to be
    echo installed on this machine, which is required to build the
    echo solution.
    exit /b 1
)
for /f %%v in ('%MSBUILDEXE% /version /nologo') do for /f "delims=. tokens=1-4" %%i in ("%%v") do set vmaj=%%i& set vmin=%%j& set vbld=%%k& set vrev=%%l
if not "%vmaj%.%vmin%.%vbld%"=="4.0.30319" (
    echo There was a problem determining the version of your Microsoft Build Engine
    echo ^(MSBuild^) 4.0 installation.
    exit /b 1
)
set build="%MSBUILDEXE%" Elmah.sln
if %vrev% lss 17929 (
    echo ================================= WARNING! ================================
    echo Projects targeting Microsoft .NET Framework 4.5 will be skipped as it does
    echo not appear to be installed on this machine.
    echo ===========================================================================
    echo.
    set build=%build% /t:Elmah;Elmah_net-4_0;Elmah_Tests
)
call prestore ^
 && (for %%v in (3.5 4.0 4.5) do for %%c in (Debug Release) do %build% "/p:Configuration=NETFX %%v %%c;AspNetConfiguration=%%c" /v:m %* || exit /b 1)
goto :EOF

@echo off
REM
REM ELMAH - Error Logging Modules and Handlers for ASP.NET
REM Copyright (c) 2004-9 Atif Aziz. All rights reserved.
REM
REM  Author(s):
REM
REM      Atif Aziz, http://www.raboof.com
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.
REM
REM -------------------------------------------------------------------------
REM
setlocal
pushd "%~dp0"
call :main %*
popd
goto :EOF

:main
set MSBUILDEXE=%SystemRoot%\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe
if not exist "%MSBUILDEXE%" (
    echo Microsoft Build Engine ^(MSBuild^) 4.0 does not appear to be
    echo installed on this machine, which is required to build the
    echo solution.
    exit /b 1
)
for /f %%v in ('%MSBUILDEXE% /version /nologo') do for /f "delims=. tokens=1-4" %%i in ("%%v") do set vmaj=%%i& set vmin=%%j& set vbld=%%k& set vrev=%%l
echo %vmaj% | findstr [0-9][0-9]* > nul || goto :unknown-msbuild-version
echo %vmin% | findstr [0-9][0-9]* > nul || goto :unknown-msbuild-version
echo %vbld% | findstr [0-9][0-9]* > nul || goto :unknown-msbuild-version
echo %vrev% | findstr [0-9][0-9]* > nul || goto :unknown-msbuild-version
set build="%MSBUILDEXE%" Elmah.sln
if "%vmaj%.%vmin%.%vbld%"=="4.0.30319" (
    if %vrev% lss 17929 (
        echo ================================= WARNING! ================================
        echo Projects targeting Microsoft .NET Framework 4.5 will be skipped as it does
        echo not appear to be installed on this machine.
        echo ===========================================================================
        echo.
        set build=%build% /t:Elmah;Elmah_net-4_0;Elmah_Tests
    )
)
call prestore ^
 && (for %%v in (3.5 4.0 4.5) do for %%c in (Debug Release) do %build% "/p:Configuration=NETFX %%v %%c;AspNetConfiguration=%%c" /v:m %* || exit /b 1)
goto :EOF

:unknown-msbuild-version
echo There was a problem determining the version of your Microsoft Build Engine
echo ^(MSBuild^) 4.0 installation.
exit /b 1

Build script fix to recognize MSBuild 12.0.40629.0


@echo off
::
:: Prebuild generator for the OpenMetaverse Library
::
:: Command Line Options:
:: (none)            - create solution/project files and create compile.bat file to build solution
:: msbuild           - Create project files, compile solution
:: msbuild runtests  - create project files, compile solution, run unit tests
:: msbuild docs      - create project files, compile solution, build API documentation
:: msbuild docs dist - Create project files, compile solution, run unit tests, build api documentation, create binary zip
::                   - and exe installer
::
:: nant		     - Create project files, run nant to compile solution
:: nant runtests     - Create project files, run nant to compile solution, run unit tests
::

echo ##########################################
echo creating prebuild files for: nant, vs2008
echo Parameters: %1 %2
echo ##########################################

:: run prebuild to generate solution/project files from prebuild.xml configuration file
bin\Prebuild.exe /target nant
bin\Prebuild.exe /target vs2008

:: build compile.bat file based on command line parameters
echo @echo off > compile.bat
if(.%1)==(.) echo C:\WINDOWS\Microsoft.NET\Framework\v3.5\msbuild OpenMetaverse.sln >> compile.bat

if(.%1)==(.msbuild) echo C:\WINDOWS\Microsoft.NET\Framework\v3.5\msbuild /p:Configuration=Release OpenMetaverse.sln >> compile.bat
if(.%1)==(.msbuild) echo IF ERRORLEVEL 1 GOTO FAIL >> compile.bat

if(.%1)==(.nant) echo nant >> compile.bat
if(.%1)==(.nant) echo IF ERRORLEVEL 1 GOTO FAIL >> compile.bat

if(.%2)==(.docs) echo SandCastleBuilderConsole.exe docs\OpenMetaverse-docs.shfb >> compile.bat
if(.%2)==(.docs) echo IF ERRORLEVEL 1 GOTO FAIL >> compile.bat
if(.%2)==(.docs) echo 7za.exe a -tzip docs\documentation.zip docs\trunk >> compile.bat
if(.%2)==(.docs) echo IF ERRORLEVEL 1 GOTO FAIL >> compile.bat

if(.%3)==(.runtests) echo "echo ==== UNIT TESTS BEGIN ====" >> compile.bat
if(.%2)==(.runtests) echo "nunit-console.exe" /nologo /nodots /labels bin\OpenMetaverse.Tests.dll >> compile.bat
if(.%2)==(.runtests) echo IF ERRORLEVEL 1 GOTO FAIL >> compile.bat

:: nsis compiler needs to be in path
if(.%3)==(.dist) echo makensis.exe /DPlatform=test docs\OpenMetaverse-installer.nsi >> compile.bat
if(.%3)==(.dist) echo IF ERRORLEVEL 1 GOTO FAIL >> compile.bat
if(.%3)==(.dist) echo 7za.exe a -tzip dist\openmetaverse-dist.zip @docs\distfiles.lst >> compile.bat
if(.%3)==(.dist) echo IF ERRORLEVEL 1 GOTO FAIL >> compile.bat

echo :SUCCESS >> compile.bat
echo echo Build Successful! >> compile.bat
echo exit /B 0 >> compile.bat
echo :FAIL >> compile.bat
echo echo Build Failed, check log for reason >> compile.bat
echo exit /B 1 >> compile.bat

:: perform the appropriate action
if(.%1)==(.msbuild) compile.bat
if(.%1)==(.nant) compile.bat
if(.%1)==(.dist) compile.bat

@echo off
::
:: Prebuild generator for the OpenMetaverse Library
::
:: Command Line Options:
:: (none)            - create solution/project files and create compile.bat file to build solution
:: msbuild           - Create project files, compile solution
:: msbuild runtests  - create project files, compile solution, run unit tests
:: msbuild docs      - create project files, compile solution, build API documentation
:: msbuild docs dist - Create project files, compile solution, run unit tests, build api documentation, create binary zip
::                   - and exe installer
::
:: nant		     - Create project files, run nant to compile solution
:: nant runtests     - Create project files, run nant to compile solution, run unit tests
::

echo ##########################################
echo creating prebuild files for: nant, vs2008
echo Parameters: %1 %2
echo ##########################################

:: run prebuild to generate solution/project files from prebuild.xml configuration file
bin\Prebuild.exe /target nant
bin\Prebuild.exe /target vs2008

:: build compile.bat file based on command line parameters
echo @echo off > compile.bat
if(.%1)==(.) echo C:\WINDOWS\Microsoft.NET\Framework\v3.5\msbuild OpenMetaverse.sln >> compile.bat

if(.%1)==(.msbuild) echo "echo ==== COMPILE BEGIN ====" >> compile.bat
if(.%1)==(.msbuild) echo C:\WINDOWS\Microsoft.NET\Framework\v3.5\msbuild /p:Configuration=Release OpenMetaverse.sln >> compile.bat
if(.%1)==(.msbuild) echo IF ERRORLEVEL 1 GOTO FAIL >> compile.bat

if(.%1)==(.nant) echo nant >> compile.bat
if(.%1)==(.nant) echo IF ERRORLEVEL 1 GOTO FAIL >> compile.bat

if(.%3)==(.docs) echo "echo ==== GENERATE DOCUMENTATION BEGIN ====" >> compile.bat
if(.%2)==(.docs) echo SandCastleBuilderConsole.exe docs\OpenMetaverse-docs.shfb >> compile.bat
if(.%2)==(.docs) echo IF ERRORLEVEL 1 GOTO FAIL >> compile.bat
if(.%2)==(.docs) echo 7za.exe a -tzip docs\documentation.zip docs\trunk >> compile.bat
if(.%2)==(.docs) echo IF ERRORLEVEL 1 GOTO FAIL >> compile.bat

if(.%3)==(.runtests) echo "echo ==== UNIT TESTS BEGIN ====" >> compile.bat
if(.%2)==(.runtests) echo "nunit-console.exe" /nologo /nodots /labels /exclude:NetworkTests bin\OpenMetaverse.Tests.dll >> compile.bat
if(.%2)==(.runtests) echo IF ERRORLEVEL 1 GOTO FAIL >> compile.bat

:: nsis compiler needs to be in path
if(.%3)==(.dist) echo "echo ==== GENERATE DISTRIBUTION BEGIN ====" >> compile.bat
if(.%3)==(.dist) echo makensis.exe /DPlatform=test docs\OpenMetaverse-installer.nsi >> compile.bat
if(.%3)==(.dist) echo IF ERRORLEVEL 1 GOTO FAIL >> compile.bat
if(.%3)==(.dist) echo 7za.exe a -tzip dist\openmetaverse-dist.zip @docs\distfiles.lst >> compile.bat
if(.%3)==(.dist) echo IF ERRORLEVEL 1 GOTO FAIL >> compile.bat

echo :SUCCESS >> compile.bat
echo echo Build Successful! >> compile.bat
echo exit /B 0 >> compile.bat
echo :FAIL >> compile.bat
echo echo Build Failed, check log for reason >> compile.bat
echo exit /B 1 >> compile.bat

:: perform the appropriate action
if(.%1)==(.msbuild) compile.bat
if(.%1)==(.nant) compile.bat
if(.%1)==(.dist) compile.bat

Disable Network unit tests temporarily on TeamCity automated build

git-svn-id: e915c4f8b2ea2a6e63cbe989b51c0994a698cc26@2527 52acb1d6-8a22-11de-b505-999d5b087335


echo ON

"%PYTHON%" setup.py install --standard-lib
if errorlevel 1 exit 1

if not exist %PREFIX%\etc\conda\activate.d mkdir %PREFIX%\etc\conda\activate.d
if errorlevel 1 exit 1
if not exist %PREFIX%\etc\conda\deactivate.d mkdir -p %PREFIX%\etc\conda\deactivate.d
type NUL > %PREFIX%\etc\conda\activate.d\scons_vars.bat
if errorlevel 1 exit 1
type NUL > %PREFIX%\etc\conda\deactivate.d\scons_vars.bat
if errorlevel 1 exit 1

echo set SCONSFLAGS="--site-dir=%CONDA_PREFIX%\share\site_scons" > %PREFIX%\etc\conda\activate.d\scons_vars.bat
if errorlevel 1 exit 1
echo set SCONSFLAGS= > %PREFIX%\etc\conda\deactivate.d\scons_vars.bat
if errorlevel 1 exit 1

if not exist %PREFIX%\share\site_scons mkdir %PREFIX%\share\site_scons
if errorlevel 1 exit 1
if not exist %PREFIX%\share\site_scons\site_init.py type NUL > %PREFIX%\share\site_scons\site_init.py
if errorlevel 1 exit 1
if not exist %PREFIX%\share\site_scons\site_tools mkdir %PREFIX%\share\site_scons\site_tools
if errorlevel 1 exit 1

copy %RECIPE_DIR%\prefix.py %PREFIX%\share\site_scons\site_tools\prefix.py
if errorlevel 1 exit 1

echo OFF

echo ON

"%PYTHON%" setup.py install --standard-lib
if errorlevel 1 exit 1

if not exist %PREFIX%\etc\conda\activate.d mkdir %PREFIX%\etc\conda\activate.d
if errorlevel 1 exit 1
if not exist %PREFIX%\etc\conda\deactivate.d mkdir -p %PREFIX%\etc\conda\deactivate.d
type NUL > %PREFIX%\etc\conda\activate.d\scons_vars.bat
if errorlevel 1 exit 1
type NUL > %PREFIX%\etc\conda\deactivate.d\scons_vars.bat
if errorlevel 1 exit 1

echo set "CONDA_PREFIX=%CONDA_PREFIX:\=/%" > %PREFIX%\etc\conda\activate.d\scons_vars.bat
echo set SCONSFLAGS="--site-dir=%CONDA_PREFIX%\share\site_scons" > %PREFIX%\etc\conda\activate.d\scons_vars.bat
if errorlevel 1 exit 1
echo set SCONSFLAGS= > %PREFIX%\etc\conda\deactivate.d\scons_vars.bat
if errorlevel 1 exit 1

if not exist %PREFIX%\share\site_scons mkdir %PREFIX%\share\site_scons
if errorlevel 1 exit 1
if not exist %PREFIX%\share\site_scons\site_init.py type NUL > %PREFIX%\share\site_scons\site_init.py
if errorlevel 1 exit 1
if not exist %PREFIX%\share\site_scons\site_tools mkdir %PREFIX%\share\site_scons\site_tools
if errorlevel 1 exit 1

copy %RECIPE_DIR%\prefix.py %PREFIX%\share\site_scons\site_tools\prefix.py
if errorlevel 1 exit 1

echo OFF

Correct Windows site_scons

Correct Windows site_scons


@echo off

set MAPNIK_VERSION=v2.2.0
set MAPNIK_PREFIX=c:\\mapnik-%MAPNIK_VERSION%
set MAPNIK_LIBS=%MAPNIK_PREFIX%\\lib
set MAPNIK_INCLUDES=%MAPNIK_PREFIX%\\include
set MAPNIK_INPUT_PLUGINS_DIRECTORY=%MAPNIK_PREFIX%\\input
set MAPNIK_FONTS_DIRECTORY=%MAPNIK_PREFIX%\\fonts

if /i "%1"=="" goto help
if /i "%1"=="help" goto help
if /i "%1"=="--help" goto help
if /i "%1"=="-help" goto help
if /i "%1"=="/help" goto help
if /i "%1"=="?" goto help
if /i "%1"=="-?" goto help
if /i "%1"=="--?" goto help
if /i "%1"=="/?" goto help
if /i "%1"=="--prefix" echo %MAPNIK_PREFIX%
if /i "%1"=="--libs" echo mapnik.lib
@rem TODO - figure out how to avoid hardcoding these library names
if /i "%1"=="--dep-libs" echo icuuc.lib icuin.lib libboost_system-vc100-mt-s-1_49.lib
if /i "%1"=="--ldflags" echo %MAPNIK_LIBS%
if /i "%1"=="--defines" echo _WINDOWS HAVE_JPEG HAVE_PNG HAVE_TIFF MAPNIK_USE_PROJ4 BOOST_REGEX_HAS_ICU MAPNIK_THREADSAFE BIGINT HAVE_LIBXML2 HAVE_CAIRO
@rem /MD is multithreaded dynamic linking - http://msdn.microsoft.com/en-us/library/2kzt1wy3.aspx
@rem /EHsc is to support c++ exceptions - http://msdn.microsoft.com/en-us/library/1deeycx5(v=vs.80).aspx
@rem /GR is to support rtti (runtime type detection) - http://msdn.microsoft.com/en-us/library/we6hfdy0.aspx
if /i "%1"=="--cxxflags" echo /MD /EHsc /GR
if /i "%1"=="--includes" echo %MAPNIK_INCLUDES%
if /i "%1"=="--input-plugins" echo %MAPNIK_INPUT_PLUGINS_DIRECTORY%
if /i "%1"=="--fonts" echo %MAPNIK_FONTS_DIRECTORY%
goto exit

:help
echo mapnik-config.bat
echo Examples:
echo   --libs            : provide lib name for mapnik.dll
echo   --defines         : provide compiler defines needed for this mapnik build
echo   --dep-libs        : provide lib names of depedencies
echo   --ldflags         : provide lib paths to depedencies
echo   --cxxflags        : provide compiler flags
echo   --includes        : provide header paths for mapnik
echo   --dep-includes    : provide header paths for dependencies
echo   --input-plugins   : provide path to input plugins directory
echo   --fonts           : provide path to fonts directory
goto exit

:exit
goto :EOF

@echo off

set MAPNIK_VERSION=v2.2.0
set MAPNIK_PREFIX=c:\\mapnik-%MAPNIK_VERSION%
set MAPNIK_LIBS=%MAPNIK_PREFIX%\\lib
set MAPNIK_INCLUDES=%MAPNIK_PREFIX%\\include
set MAPNIK_INPUT_PLUGINS_DIRECTORY=%MAPNIK_PREFIX%\\input
set MAPNIK_FONTS_DIRECTORY=%MAPNIK_PREFIX%\\fonts

if /i "%1"=="" goto help
if /i "%1"=="help" goto help
if /i "%1"=="--help" goto help
if /i "%1"=="-help" goto help
if /i "%1"=="/help" goto help
if /i "%1"=="?" goto help
if /i "%1"=="-?" goto help
if /i "%1"=="--?" goto help
if /i "%1"=="/?" goto help
if /i "%1"=="--prefix" echo %MAPNIK_PREFIX%
if /i "%1"=="--libs" echo mapnik.lib
@rem TODO - figure out how to avoid hardcoding these library names
if /i "%1"=="--dep-libs" echo icuuc.lib icuin.lib libboost_system-vc100-mt-s-1_49.lib
if /i "%1"=="--ldflags" echo %MAPNIK_LIBS%
if /i "%1"=="--defines" echo _WINDOWS HAVE_JPEG HAVE_PNG HAVE_TIFF MAPNIK_USE_PROJ4 BOOST_REGEX_HAS_ICU MAPNIK_THREADSAFE BIGINT HAVE_LIBXML2 HAVE_CAIRO
@rem /MD is multithreaded dynamic linking - http://msdn.microsoft.com/en-us/library/2kzt1wy3.aspx
@rem /EHsc is to support c++ exceptions - http://msdn.microsoft.com/en-us/library/1deeycx5(v=vs.80).aspx
@rem /GR is to support rtti (runtime type detection) - http://msdn.microsoft.com/en-us/library/we6hfdy0.aspx
if /i "%1"=="--cxxflags" echo /MD /EHsc /GR
if /i "%1"=="--includes" echo %MAPNIK_INCLUDES% %MAPNIK_INCLUDES%\\agg
if /i "%1"=="--input-plugins" echo %MAPNIK_INPUT_PLUGINS_DIRECTORY%
if /i "%1"=="--fonts" echo %MAPNIK_FONTS_DIRECTORY%
goto exit

:help
echo mapnik-config.bat
echo Examples:
echo   --libs            : provide lib name for mapnik.dll
echo   --defines         : provide compiler defines needed for this mapnik build
echo   --dep-libs        : provide lib names of depedencies
echo   --ldflags         : provide lib paths to depedencies
echo   --cxxflags        : provide compiler flags
echo   --includes        : provide header paths for mapnik
echo   --dep-includes    : provide header paths for dependencies
echo   --input-plugins   : provide path to input plugins directory
echo   --fonts           : provide path to fonts directory
goto exit

:exit
goto :EOF

add agg includes directory

add agg includes directory


@echo on
setlocal EnableDelayedExpansion

:: prepare vcvarsall
if "%APPVEYOR_BUILD_WORKER_IMAGE%" == "Visual Studio 2017" (
	set VC_DIR="C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat"
)
if "%APPVEYOR_BUILD_WORKER_IMAGE%" == "Visual Studio 2015" (
	set VC_DIR="C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat"
)

set tDir=C:\projects\Qt\%QT_VER%\static
mkdir -p %tDir% || exit /B 1
cd C:\projects\Qt\%QT_VER%\Src

:: include extra modules explicitly
for %%m in (%STATIC_EXTRA_MODS%) do (
	echo [submodule "%%m"]>> .gitmodules
	echo 	depends = qtbase>> .gitmodules
	echo 	path = %%m>> .gitmodules
	echo 	url = ../%%m.git>> .gitmodules
	echo 	branch = %QT_VER%>> .gitmodules
	echo 	status = addon>> .gitmodules
	echo 	repoType = inherited>> .gitmodules
)

:: generate skip modules
set skipPart=
for /D %%G in (qt*) do (
	echo "qtbase %STATIC_QT_MODS% %STATIC_EXTRA_MODS%" | findstr /C:"%%G" > nul || (
		set skipPart=-skip %%G !skipPart!
	)
)

call %VC_DIR% amd64 || exit /B 1

:: build qt (shadowed)
mkdir C:\qt-build-tmp
cd C:\qt-build-tmp

call C:\projects\Qt\%QT_VER%\Src\configure -prefix %tDir% -platform win32-msvc -opensource -confirm-license -release -static -static-runtime -no-cups -no-qml-debug -no-opengl -no-egl -no-xinput2 -no-sm -no-icu -nomake examples -nomake tests -accessibility -no-gui -no-widgets %skipPart% || exit /B 1
nmake > nul || exit /B 1
nmake install > nul || exit /B 1

Create setup-qt-static.bat

Create setup-qt-static.bat


@ECHO OFF

:: Change this for the specific deploy directory
set TARGET=TopWatch

:: Current directory
set BASE=%CD%

rmdir /S /Q %BASE%\deploy
rmdir /S /Q %BASE%\build

call tools\deploy.bat

xcopy /S /Q /R /Y %BASE%\www\* %BASE%\deploy\%TARGET%\.

@ECHO OFF

:: Change this for the specific deploy directory
set TARGET=TopWatch_Build

:: Current directory
set BASE=%CD%

rmdir /S /Q %BASE%\deploy
rmdir /S /Q %BASE%\build

call tools\deploy.bat

xcopy /S /Q /R /Y %BASE%\www\* %BASE%\deploy\%TARGET%\.

Update path

Update path


@if "%DEBUG%" == "" @echo off

@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal

:setSpringHome
@rem Setup SPRING_HOME if not already defined
if defined SPRING_HOME goto setJavaHome
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set SPRING_HOME=%DIRNAME%\..

:setJavaHome
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto runSpring
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail

:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto runSpring
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail

:runSpring
@rem Get command-line arguments, handling Windows variants

if not "%OS%" == "Windows_NT" goto win9xME_args
if "%@eval[2+2]" == "4" goto 4NT_args

:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2

:win9xME_args_slurp
if "x%~1" == "x" goto execute

set CMD_LINE_ARGS=%*
goto execute

:4NT_args
@rem Get arguments from the 4NT Shell from JP Software
set CMD_LINE_ARGS=%$

:execute
@rem Setup the command line

set CLASSPATH=%SPRING_HOME%\lib\*
"%JAVA_EXE%" %JAVA_OPTS% -cp "%CLASSPATH%" org.springframework.boot.cli.SpringCli %CMD_LINE_ARGS%

:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd

:fail
rem Set variable SPRING_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if  not "" == "%SPRING_EXIT_CONSOLE%" exit 1
exit /b 1

:mainEnd
if "%OS%"=="Windows_NT" endlocal

Add spring.bat start script for Windows

Add spring.bat start script for Windows


echo off
call "C:\Program Files\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" x86

cls
cl /Ox ring.c  ^
ring_string.c ring_list.c ring_item.c ring_items.c ring_hashtable.c ring_state.c ring_scanner.c ring_parser.c ring_hashlib.c ring_vmgc.c ^
ring_stmt.c ring_expr.c ring_codegen.c ring_vm.c ring_vmexpr.c ring_vmvars.c ^
ring_vmlists.c ring_vmfuncs.c ring_api.c ring_vmoop.c ring_vmcui.c ^
ring_vmtrycatch.c ring_vmstrindex.c ring_vmjump.c ring_vmduprange.c ^
ring_vmperformance.c ring_vmexit.c ring_vmstackvars.c ring_vmstate.c ring_vmmath.c ring_vmfile.c ring_vmos.c ring_vmlistfuncs.c ring_vmrefmeta.c ^
ring_ext.c ring_vmdll.c ring_objfile.c -I"..\include" /link /SUBSYSTEM:CONSOLE,"5.01" /OUT:..\bin\ring.exe

del *.obj

Add buildvc.bat

Add buildvc.bat


@ECHO OFF
SETLOCAL ENABLEEXTENSIONS
REM SET me=%~n0
SET arc_dir=%~dp0

SET optionkey=%1
IF "%optionkey%"=="/h" (
  ECHO arc [/h] [^<file^> [^<file_args^>]]
  ECHO.
  ECHO OPTIONS
  ECHO   /h
  ECHO     Print help and exit
  ECHO.
  ECHO   ^<file^> [^<file_args^>]
  ECHO     Don't start up a REPL; instead, execute the file, passing to it any file_args. When the file finishes executing, exit Arc.
  ECHO.
  ECHO EXAMPLES
  ECHO   Start the Arc REPL:
  ECHO     arc
  ECHO   Run the file "file-to-run.arc", passing to it the argument 3
  ECHO     arc file-to-run.arc 3
  EXIT /B 0
)

SET arglen=0
FOR %%X IN (%*) DO SET /A arglen+=1

IF %arglen% EQU 0 (
  racket -t %arc_dir%boot.scm -e "(tl)"
) ELSE (
  racket -t %arc_dir%boot.scm -e "(aload (vector-ref (current-command-line-arguments) 0))" %*
)

ENDLOCAL

add batch file arc.cmd to launch arc from Windows command prompt


@echo on

mkdir build
if errorlevel 1 exit 1

set

cmake ^
    -G "Ninja" ^
    -D CMAKE_PREFIX_PATH="%LIBRARY_PREFIX%" ^
    -D CMAKE_INSTALL_PREFIX="%LIBRARY_PREFIX%" ^
    -D CMAKE_BUILD_TYPE=Release ^
    -S source -B build
if errorlevel 1 exit 1

cmake --build build
if errorlevel 1 exit 1

cmake --build build --target install
if errorlevel 1 exit 1

@echo on

mkdir build
if errorlevel 1 exit 1

cmake ^
    -G "Ninja" ^
    -D CMAKE_PREFIX_PATH="%LIBRARY_PREFIX%" ^
    -D CMAKE_INSTALL_PREFIX="%LIBRARY_PREFIX%" ^
    -D CMAKE_BUILD_TYPE=Release ^
    -S source -B build
if errorlevel 1 exit 1

cmake --build build
if errorlevel 1 exit 1

cmake --build build --target install
if errorlevel 1 exit 1

Remove debug printout

Remove debug printout


@echo off
setlocal EnableDelayedExpansion

:: build system uses non-standard env vars
set "XCFLAGS=%CFLAGS%"
set "XLIBS=%LIBS%"
set "USE_SYSTEM_LIBS=yes"
set "USE_SYSTEM_JPEGXR=yes"

:: build and install
make prefix="${PREFIX}" -j ${CPU_COUNT} all
if errorlevel 1 exit 1
:: no make check
make prefix="${PREFIX}" install
if errorlevel 1 exit 1

@echo off
setlocal EnableDelayedExpansion

:: build system uses non-standard env vars
set "XCFLAGS=%CFLAGS%"
set "XLIBS=%LIBS%"
set "USE_SYSTEM_LIBS=yes"
set "USE_SYSTEM_JPEGXR=yes"

:: build and install
make "prefix=%PREFIX%" -j %CPU_COUNT% all
if errorlevel 1 exit 1
:: no make check
make "prefix=%PREFIX%" install
if errorlevel 1 exit 1

build changes

build changes


@echo off
REM arg1 is dir, arg2 is filename *without* extension
happy -i %1/%2.y
runhaskell -iHUnit %1/%2.hs

Build script.

Build script.

Build configuration - options for happy etc.


@echo off
rem run in development mode
rem npl -d bootstrapper="www/webapp.lua" port="8099" root="www/"  dev="%~dp0" servermode="true"
SET cwd=%~dp0
SET PATH=%PATH%;%cwd%lib\dll\;
npls -d bootstrapper="www/webapp.lua" dev="%~dp0"

@echo off
rem run in development mode
rem npl -d bootstrapper="www/webapp.lua" port="8099" root="www/"  dev="%~dp0" servermode="true"
SET cwd=%~dp0
SET PATH=%PATH%;%cwd%lib\dll\;
rem npls -d bootstrapper="www/webapp.lua" dev="%~dp0"
npl servermode="true" bootstrapper="www/webapp.lua" dev="%~dp0"

update start_win.bat

update start_win.bat


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

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

### application.bat - 2015 - Jean-marie Gérard ###
version = "2"
build_hour = "11H00"

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

update header for new member

update header for new member


:<<"::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

# Download the BigFix agent (using cURL because it is on most Linux & OS X by default)
# TODO: if curl not present, use wget instead
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

# 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.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

integrating changes from https://github.com/jgstew/tools/commit/f16a99d24cdc1ad514d536d2e7db53d0383b88ff