Add scripts for installing git

This commit is contained in:
Manuel Thalmann 2024-08-10 15:28:10 +02:00
parent b1c592d357
commit 400e580962
2 changed files with 82 additions and 0 deletions

View 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 {
};

View file

@ -0,0 +1,64 @@
param (
$Action,
[hashtable] $Arguments
)
. "$PSScriptRoot/../../../Common/Types/InstallerAction.ps1";
. "$PSScriptRoot/../../../Common/Scripts/Software.ps1";
. "$PSScriptRoot/../../../Common/Scripts/Config.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