From 1b082205f1e98a084695b042adec5cc122ff7717 Mon Sep 17 00:00:00 2001 From: Harald Pfeiffer Date: Thu, 24 Jul 2025 14:49:27 +0200 Subject: InComm, rather spontaneous --- install.ps1 | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 install.ps1 (limited to 'install.ps1') diff --git a/install.ps1 b/install.ps1 new file mode 100644 index 0000000..a94be89 --- /dev/null +++ b/install.ps1 @@ -0,0 +1,41 @@ +#!powershell +# vim:syntax=ps1:ts=4 + +# We deploy to the user directory (yep, Documents, cheers MS :D): +$UserPSPath = "${env:USERPROFILE}\Documents\WindowsPowerShell" +$ModulePath = "${UserPSPath}\Modules" +# $InstPath = "${ModulePath}\hpf-cons" + +$instMods = @( + 'AzureHelpers' +) + +# Where are we? (Ensures we can be called from just anywhere, the 90s want +# their "cd something && .\whatever" back.) +$scriptPath = split-path -parent $MyInvocation.MyCommand.Definition + +# Ensure we stop on any error. We just write simple commands sequentially, +# so we need this. +$ErrorActionPreference = 'Stop' + +if ( -not (Test-Path "$UserPSPath") ) { + New-Item -ItemType Directory -Path "$UserPSPath" +} +if ( -not (Test-Path "$ModulePath") ) { + New-Item -ItemType Directory -Path "$ModulePath" +} +# if ( -not (Test-Path "$InstPath") ) { +# New-Item -ItemType Directory -Path "$InstPath" +# } + +# We could now use robocopy to ensure timestamps and stuff, but since this will +# eventually pull from git, this is irrelevant - so we can resort to the more +# primitive .NET-Cmdlets. +# To ensure files that don't exist anymore, we'd need robocopy again :-) +foreach ($instMod in $instMods) { + Write-Host "Copying items..." + Copy-Item -Recurse -Path "${scriptPath}\${instMod}" -Destination "$ModulePath" -Force + Write-Host "...done." +} + +# Done! -- cgit v1.2.3