Add scripts for installing git
This commit is contained in:
parent
bc8f73b185
commit
f5d971922a
2 changed files with 82 additions and 0 deletions
18
scripts/Common/Software/git/Manage.ps1
Normal file
18
scripts/Common/Software/git/Manage.ps1
Normal file
|
@ -0,0 +1,18 @@
|
|||
param (
|
||||
$Action,
|
||||
[hashtable] $Arguments
|
||||
)
|
||||
|
||||
. "$PSScriptRoot/../../Scripts/Software.ps1";
|
||||
. "$PSScriptRoot/../../Types/InstallerAction.ps1";
|
||||
|
||||
Start-SoftwareInstaller @PSBoundParameters `
|
||||
-Installer {
|
||||
param(
|
||||
[scriptblock] $Installer
|
||||
)
|
||||
|
||||
& $Installer -Action ([InstallerAction]::Configure);
|
||||
} `
|
||||
-Configurator {
|
||||
};
|
64
scripts/Windows/Software/git/Manage.ps1
Normal file
64
scripts/Windows/Software/git/Manage.ps1
Normal file
|
@ -0,0 +1,64 @@
|
|||
param (
|
||||
$Action,
|
||||
[hashtable] $Arguments
|
||||
)
|
||||
|
||||
. "$PSScriptRoot/../../../Common/Scripts/Config.ps1";
|
||||
. "$PSScriptRoot/../../../Common/Scripts/Software.ps1";
|
||||
. "$PSScriptRoot/../../../Common/Types/InstallerAction.ps1";
|
||||
|
||||
$null = New-Module {
|
||||
param(
|
||||
[hashtable] $Parameters
|
||||
)
|
||||
|
||||
. "$PSScriptRoot/../../../Common/Types/InstallerAction.ps1";
|
||||
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Gets a configuration value related to git.
|
||||
|
||||
.PARAMETER Name
|
||||
The name of the configuration to get.
|
||||
|
||||
.PARAMETER User
|
||||
The name of the user to get the configuration for.
|
||||
#>
|
||||
function Get-GitOption {
|
||||
param(
|
||||
[Parameter(Mandatory)]
|
||||
[string] $Name,
|
||||
[string] $User
|
||||
)
|
||||
|
||||
$config = "git.$Name";
|
||||
|
||||
if ($User) {
|
||||
Get-UserConfig -UserName $User -Name $config;
|
||||
} else {
|
||||
Get-Config $config;
|
||||
}
|
||||
}
|
||||
|
||||
Start-SoftwareInstaller @Parameters `
|
||||
-Installer {
|
||||
param(
|
||||
[scriptblock] $Installer
|
||||
)
|
||||
|
||||
$params = "/WindowsTerminalProfile";
|
||||
$defaultBranch = Get-GitOption "defaultBranch";
|
||||
|
||||
if ($defaultBranch) {
|
||||
$params += " /DefaultBranchName:`"$defaultBranch`"";
|
||||
}
|
||||
|
||||
Install-ChocoPackage git -ArgumentList "--params",$params;
|
||||
& $Installer -Action ([InstallerAction]::Configure);
|
||||
} `
|
||||
-Configurator {
|
||||
& "$PSScriptRoot/../../../Common/Software/git/Manage.ps1" @Parameters;
|
||||
};
|
||||
|
||||
Export-ModuleMember -Function @();
|
||||
} -ArgumentList $PSBoundParameters
|
Loading…
Reference in a new issue