Commit ee412059 authored by Michael Herndon's avatar Michael Herndon

Merge branch 'master' of https://gitlab.com/nerdymishka/gainz

parents bf766d3a 27f83322
......@@ -15,17 +15,16 @@ SHELL ["cmd", "/S", "/C"]
# Download the Build Tools bootstrapper.
ADD https://aka.ms/vs/16/release/vs_buildtools.exe C:\TEMP\vs_buildtools.exe
COPY vs_BuildTools.exe C:\apps\vs_buildtools.exe
# Install Build Tools excluding workloads and components with known issues.
RUN C:\TEMP\vs_buildtools.exe --quiet --wait --norestart --nocache `
RUN C:\apps\vs_buildtools.exe --quiet --wait --norestart --nocache `
--add Microsoft.VisualStudio.Workload.NetCoreBuildTools `
--add Microsoft.VisualStudio.Workload.WebBuildTools `
|| IF "%ERRORLEVEL%"=="3010" EXIT 0
VOLUME C:/projects
VOLUME C:/apps
VOLUME C:/projects
# Start developer command prompt with any other commands specified.
#ENTRYPOINT C:\Vs\Common7\Tools\VsDevCmd.bat &&
......
......@@ -30,5 +30,10 @@ Export-ModuleMember -Function @(
'Test-64Bit',
'Test-OsPlatform',
'Test-UserIsAdministrator',
'Write-GzModuleSetting'
'Write-GzModuleSetting',
'Test-NonInteractive',
'Set-NonIteractive',
"Set-Interative",
"Read-InteractiveHost",
"Read-InteractiveChoice"
)
\ No newline at end of file
......@@ -5,21 +5,22 @@ function Read-InteractiveChoice() {
[String] $Message = "Are you sure?",
[String[]] $Choices = $null,
[String] $Title = $null,
[Int32] $DefaultValue = 1
[Int32] $DefaultValue = 0
)
if($null -eq $Choices -or $Choices.Length -eq 0) {
$Choices = @("&Yes", "&No");
$Choices = @("&No", "&Yes");
}
if($DefaultValue -ge $Choices.Length) {
throw "DefaultValue must not exceed the number of choices";
}
if(Test-ShellNonInteractive) {
return $Choices[$DefaultValue].Replace("&", "");
if(Test-NonInteractive) {
return $DefaultValue
}
return $host.UI.PromptForChoice($null, $Message, $Choices, $DefaultValue)
}
\ No newline at end of file
}
function Read-InteractiveHost() {
Param(
[Parameter(Position = 0, ValueFromPipeline = $true)]
[String] $Prompt,
[Switch] $AsSecureString,
[string] $DefaultValue = $null
)
if(Test-ShellNonInteractive) {
if(Test-NonInteractive) {
if($AsSecureString.ToBool()) {
if(![String]::IsNotNullOrWhitespace($DefaultValue)) {
return ConvertTo-SecureString $DefaultValue -AsPlainText -Force
......
$gzIsInteractive = $null
function Set-PowerShellInteractive() {
function Set-Interactive() {
Param()
if((Test-OsPlatform "Linux") -eq $True)
{
export DEBIAN_FRONTEND=
}
$gzIsInteractive = $true;
}
function Set-PowerShellNonInteractive() {
function Set-NonInteractive() {
Param()
if((Test-OsPlatform "Linux") -eq $True)
{
export DEBIAN_FRONTEND=noninteractive
}
$gzIsInteractive = $false;
}
function Test-PowerShellNonInteractive() {
function Test-NonInteractive() {
if ([Environment]::UserInteractive) {
if($null -ne $gzIsInteractive -and $gzIsInteractive -eq $false) {
return $true;
}
if($Env:DEBIAN_FRONTEND -eq "noninteractive") {
return $true;
}
foreach ($arg in [Environment]::GetCommandLineArgs()) {
# Test each Arg for match of abbreviated '-NonInteractive' command.
if ($arg -like '-NonI*') {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment