UpdateGitKraken.ps1
<#PSScriptInfo .VERSION 0.0.1 .GUID bba9b6ac-3864-44da-84f8-46bfed7d6ae8 .AUTHOR Fabrice Sanga .COMPANYNAME sangafabrice .COPYRIGHT © 2022 SangaFabrice. All rights reserved. .TAGS gitkraken nuget-package update git .LICENSEURI https://github.com/sangafabrice/reg-cli/blob/main/LICENSE.md .PROJECTURI https://github.com/sangafabrice/reg-cli/tree/gitkraken .ICONURI https://rawcdn.githack.com/sangafabrice/reg-cli/cb37742bc1c451d959aac66bc7ac8152fd673787/icon.png .EXTERNALMODULEDEPENDENCIES DownloadInfo,RegCli .REQUIREDSCRIPTS .EXTERNALSCRIPTDEPENDENCIES .RELEASENOTES Initialize GitKraken updater script. .PRIVATEDATA #> #Requires -Module @{ModuleVersion = '5.0.4'; ModuleName = 'DownloadInfo'} #Requires -Module @{ModuleVersion = '6.2.2'; ModuleName = 'RegCli'} [CmdletBinding()] Param ( [ValidateNotNullOrEmpty()] [ValidateScript({ Test-InstallLocation $_ $PSScriptRoot })] [string] $InstallLocation = "${Env:ProgramData}\GitKraken", [ValidateNotNullOrEmpty()] [ValidateScript({ Test-InstallerLocation $_ })] [string] $SaveTo = $PSScriptRoot ) & { $NameLocation = "$InstallLocation\gitkraken.exe" Try { $UpdateModule = Import-CommonScript chrome-installer | Import-Module -PassThru -Force -Verbose:$False @{ UpdateInfo = $( Write-Verbose 'Retrieve install or update information...' Try { Get-DownloadInfo -PropertyList @{ OSArch = Get-ExecutableType $NameLocation } -From GitKraken } Catch { } ) NameLocation = $NameLocation SaveTo = $SaveTo SoftwareName = 'GitKraken' InstallerDescription = 'Unleash your repo' InstallerType = 'Squirrel' ForceReinstall = $True Verbose = $VerbosePreference -ine 'SilentlyContinue' } | ForEach-Object { Invoke-CommonScript @_ } } Catch { $_ } Finally { $UpdateModule | Remove-Module -Verbose:$False } } <# .SYNOPSIS Updates GitKraken software. .DESCRIPTION The script installs or updates GitKraken on Windows. .NOTES Required: at least Powershell Core 7. .PARAMETER InstallLocation Path to the installation directory. It is restricted to file system paths. It does not necessary exists. It defaults to "%ProgramData%\GitKraken". .PARAMETER SaveTo Path to the directory of the downloaded installer. It is an existing file system path. It defaults to the script directory. .EXAMPLE Get-ChildItem 'C:\ProgramData\GitKraken' -ErrorAction SilentlyContinue PS > .\UpdateGitKraken.ps1 -InstallLocation 'C:\ProgramData\GitKraken' -SaveTo . PS > Get-ChildItem 'C:\ProgramData\GitKraken' | Select-Object Name -First 5 Name ---- locales resources chrome_100_percent.pak chrome_200_percent.pak d3dcompiler_47.dll PS > Get-ChildItem | Select-Object Name Name ---- gitkraken_8.9.1.exe UpdateGitKraken.ps1 Install GitKraken to 'C:\ProgramData\GitKraken' and save its setup installer to the current directory. #> |