From 94796dd5d9d536b844efe4511c89c4fd2fa31646 Mon Sep 17 00:00:00 2001 From: Manuel Thalmann Date: Thu, 27 Jul 2023 02:22:09 +0200 Subject: [PATCH] Add `posh-git` to Windows installations --- scripts/Windows/Config/PowerShell/Install.ps1 | 1 + scripts/Windows/Config/posh-git/Install.ps1 | 7 +++++++ scripts/Windows/OS/Install.ps1 | 5 +++-- scripts/Windows/Software/posh-git/Install.ps1 | 8 ++++++++ 4 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 scripts/Windows/Config/posh-git/Install.ps1 create mode 100644 scripts/Windows/Software/posh-git/Install.ps1 diff --git a/scripts/Windows/Config/PowerShell/Install.ps1 b/scripts/Windows/Config/PowerShell/Install.ps1 index 511b4873..4b766bab 100644 --- a/scripts/Windows/Config/PowerShell/Install.ps1 +++ b/scripts/Windows/Config/PowerShell/Install.ps1 @@ -8,6 +8,7 @@ Write-Information "Allow addition of any number of profile files"; $context.AddPowerShellProfileStatement( @( + '# Profile Files', '$profilePath = "$PSScriptRoot/profile.d/*.ps1";', 'if (Test-Path $profilePath) {', ' . $profilePath;', diff --git a/scripts/Windows/Config/posh-git/Install.ps1 b/scripts/Windows/Config/posh-git/Install.ps1 new file mode 100644 index 00000000..8e6098f3 --- /dev/null +++ b/scripts/Windows/Config/posh-git/Install.ps1 @@ -0,0 +1,7 @@ +#!/bin/pwsh +param($context) +. "$PSScriptRoot/../../Scripts/Context.ps1"; + +[Context] $context = $context; +Write-Host "Configuring posh-git"; +$context.AddPowerShellProfileStatement("posh-git", 'Import-Module "posh-git";'); diff --git a/scripts/Windows/OS/Install.ps1 b/scripts/Windows/OS/Install.ps1 index 62a3f968..29947904 100644 --- a/scripts/Windows/OS/Install.ps1 +++ b/scripts/Windows/OS/Install.ps1 @@ -57,11 +57,12 @@ function Invoke-WindowsInstallation([Context] $context) exit; } - if (-not $context.Get("AppAssociations")) { + if (-not $context.Get("MachineWideSoftware")) { Write-Host "Setting up software with default app associations"; . "$softwarePath/WinSCP/Install.ps1" $context; . "$softwarePath/Thunderbird/Install.ps1" $context; - $context.Set("AppAssociations", 1, "DWord"); + . "$softwarePath/posh-git/Install.ps1" $context; + $context.Set("MachineWideSoftware", 1, "DWord"); } New-PersonalUser $context; diff --git a/scripts/Windows/Software/posh-git/Install.ps1 b/scripts/Windows/Software/posh-git/Install.ps1 new file mode 100644 index 00000000..611266c5 --- /dev/null +++ b/scripts/Windows/Software/posh-git/Install.ps1 @@ -0,0 +1,8 @@ +#!/bin/pwsh +param($context); +. "$PSScriptRoot/../../Scripts/Context.ps1"; + +[Context] $context = $context; +Install-Module -Scope AllUsers posh-git; +powershell -c "Install-Module -Scope AllUsers posh-git;"; +. "$PSScriptRoot/../../Config/posh-git/Install.ps1" $context;