From 56633cec4a6ad6c1eb0e4755e8d47b7c4eda31b2 Mon Sep 17 00:00:00 2001 From: Dibir Magomedsaygitov Date: Wed, 30 Sep 2020 20:13:40 +0300 Subject: [PATCH] refactor and rename scripts --- ...trySettings.ps1 => AzureRegistrySettings.ps1} | 0 .../{Update-DotnetPath.ps1 => DotnetPath.ps1} | 12 +----------- images/win/post-generation/MercurialPath.ps1 | 8 ++++++++ ...{Create-RustJunction.ps1 => RustJunction.ps1} | 0 .../{Add-SshHostKeys.ps1 => SshHostKeys.ps1} | 0 .../win/post-generation/Update-MercurialPath.ps1 | 16 ---------------- ...e-VSConfiguration.ps1 => VSConfiguration.ps1} | 0 7 files changed, 9 insertions(+), 27 deletions(-) rename images/win/post-generation/{Remove-AzureRegistrySettings.ps1 => AzureRegistrySettings.ps1} (100%) rename images/win/post-generation/{Update-DotnetPath.ps1 => DotnetPath.ps1} (55%) create mode 100644 images/win/post-generation/MercurialPath.ps1 rename images/win/post-generation/{Create-RustJunction.ps1 => RustJunction.ps1} (100%) rename images/win/post-generation/{Add-SshHostKeys.ps1 => SshHostKeys.ps1} (100%) delete mode 100644 images/win/post-generation/Update-MercurialPath.ps1 rename images/win/post-generation/{Update-VSConfiguration.ps1 => VSConfiguration.ps1} (100%) diff --git a/images/win/post-generation/Remove-AzureRegistrySettings.ps1 b/images/win/post-generation/AzureRegistrySettings.ps1 similarity index 100% rename from images/win/post-generation/Remove-AzureRegistrySettings.ps1 rename to images/win/post-generation/AzureRegistrySettings.ps1 diff --git a/images/win/post-generation/Update-DotnetPath.ps1 b/images/win/post-generation/DotnetPath.ps1 similarity index 55% rename from images/win/post-generation/Update-DotnetPath.ps1 rename to images/win/post-generation/DotnetPath.ps1 index c051ebd4a..ea5a2de5a 100644 --- a/images/win/post-generation/Update-DotnetPath.ps1 +++ b/images/win/post-generation/DotnetPath.ps1 @@ -4,19 +4,9 @@ $dotnetPath = "$env:USERPROFILE\.dotnet\tools" if ($latestPath.Contains("C:\Users\VssAdministrator\.dotnet\tools")) { $latestPath = $latestPath.Replace("C:\Users\VssAdministrator\.dotnet\tools", "$dotnetPath") - $isPathUpdated = $true } if (-not $latestPath.Contains($dotnetPath)) { $latestPath = "$dotnetPath;$latestPath" - Write-Host "Added .dotnet\tools $dotnetPath to PATH" - $isPathUpdated = $true -} -else -{ - Write-Host "$dotnetPath already in PATH" -} - -$updatedPath = [System.Environment]::GetEnvironmentVariable('PATH', [System.EnvironmentVariableTarget]::Machine) -Write-Host "Windows PATH: $updatedPath" \ No newline at end of file +} \ No newline at end of file diff --git a/images/win/post-generation/MercurialPath.ps1 b/images/win/post-generation/MercurialPath.ps1 new file mode 100644 index 000000000..7847d7142 --- /dev/null +++ b/images/win/post-generation/MercurialPath.ps1 @@ -0,0 +1,8 @@ +$hgPath = "$Env:ProgramFiles\Mercurial\" +$latestPath = [System.Environment]::GetEnvironmentVariable('PATH', [System.EnvironmentVariableTarget]::Machine) + +if (Test-Path -Path $hgPath) +{ + $latestPath = "$hgPath;$latestPath" + Write-Host "Added Mercurial to PATH" +} diff --git a/images/win/post-generation/Create-RustJunction.ps1 b/images/win/post-generation/RustJunction.ps1 similarity index 100% rename from images/win/post-generation/Create-RustJunction.ps1 rename to images/win/post-generation/RustJunction.ps1 diff --git a/images/win/post-generation/Add-SshHostKeys.ps1 b/images/win/post-generation/SshHostKeys.ps1 similarity index 100% rename from images/win/post-generation/Add-SshHostKeys.ps1 rename to images/win/post-generation/SshHostKeys.ps1 diff --git a/images/win/post-generation/Update-MercurialPath.ps1 b/images/win/post-generation/Update-MercurialPath.ps1 deleted file mode 100644 index de68e1812..000000000 --- a/images/win/post-generation/Update-MercurialPath.ps1 +++ /dev/null @@ -1,16 +0,0 @@ -$hgPath = "$Env:ProgramFiles\Mercurial\" -$latestPath = [System.Environment]::GetEnvironmentVariable('PATH', [System.EnvironmentVariableTarget]::Machine) - -if (Test-Path -Path $hgPath) -{ - $latestPath = "$hgPath;$latestPath" - Write-Host "Added Mercurial to PATH" - $isPathUpdated = $true -} -else -{ - Write-Host "Didn't find Mercurial at $hgPath. Skipping adding PATH to it." -} - -$updatedPath = [System.Environment]::GetEnvironmentVariable('PATH', [System.EnvironmentVariableTarget]::Machine) -Write-Host "Windows PATH: $updatedPath" \ No newline at end of file diff --git a/images/win/post-generation/Update-VSConfiguration.ps1 b/images/win/post-generation/VSConfiguration.ps1 similarity index 100% rename from images/win/post-generation/Update-VSConfiguration.ps1 rename to images/win/post-generation/VSConfiguration.ps1