git.lirion.de

Of git, get, and gud

aboutsummaryrefslogtreecommitdiffstats
path: root/install.ps1
blob: a94be898a880ec5244ec14a24b061578347445ea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
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!