-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.ps1
63 lines (45 loc) · 1.38 KB
/
setup.ps1
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
param (
[alias('d')]
[switch] $debug,
[alias('i')]
#[parameter(Mandatory=$false)]
[ValidateSet('Upgrade', 'Install', 'Minimal')]
[String] $install = 'Upgrade'
);
Set-Location $PSScriptRoot
. .\scripts\functions.ps1
EnsureAdmin
Write-Host "#################################"
Write-Host "######## Set up system ##########"
Write-Host "#################################"
Write-Host ""
Write-Host "This script may install a lots of software, which can take a while ..."
Write-Host "Mode: $install"
Write-Host ""
function Refresh-Envvars
{
$env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User")
}
if($install -eq 'Upgrade'){
EnsureChoco
Write-Host "Update windows"
UpgradeChocoPackage pswindowsupdate
Get-WUInstall
Write-Host "Upgrade required software"
UpgradeChocoPackage puppet-agent
Refresh-Envvars
} elseif ($install -eq 'Install') {
EnsureChoco
Write-Host "Install required software"
EnsureChocoPackage puppet-agent
Refresh-Envvars
}
$puppetCmd = "puppet apply --modulepath=`"$PSScriptRoot/environments/production/modules`""
if ($debug) {
$puppetCmd += " --debug"
}
$puppetCmd += " `"$PSScriptRoot/environments/production/manifests/site.pp`""
Write-Host "Run puppet setup"
Write-Host $puppetCmd
Invoke-Expression "& $puppetCmd"
#WaitForAnyKey