-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit.ps1
More file actions
61 lines (53 loc) · 1.78 KB
/
init.ps1
File metadata and controls
61 lines (53 loc) · 1.78 KB
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
# init.ps1
# Runs the system setup assuming a Windows system.
[CmdletBinding()]
Param ()
Write-Host "tariqajyusuf/system-setup ALPHA build"
Write-Host
Write-Host
Write-Host "Checking if repo was downloaded locally"
Set-Location $PSScriptRoot
if (-Not (Test-Path -Path ".git")) {
Write-Host "Repo not downloaded, fetching latest"
$TempDirectory = New-Item -ItemType Directory -Path "./.tmp" -Force
Set-Location $TempDirectory
Invoke-WebRequest https://github.com/tariqajyusuf/system-setup/archive/refs/heads/main.zip -OutFile "archive.zip"
Expand-Archive "archive.zip" -DestinationPath $TempDirectory
Set-Location "system-setup-main"
}
# Make sure we're running on Windows by running a command that is only there.
try {
$OS = Get-ComputerInfo -Property "OSName"
if (-Not $OS -like "*Windows*") {
Write-Error "It looks like you're trying to run this on a non-Windows machine, use ./init.sh intead"
exit 1
}
}
catch {
Write-Error "It looks like you're trying to run this on a non-Windows machine, use ./init.sh intead"
exit 1
}
Write-Host "Setting up for Windows..."
Write-Host "Running setup scripts..."
$Scripts = Get-ChildItem -Path ./setup/*/windows.ps1
foreach ($Script in $Scripts) {
& $Script
if ($LASTEXITCODE -ne 0) {
exit $LASTEXITCODE
}
}
Write-Host "Available Modules:"
$Modules = Get-ChildItem -Path ./modules/*
foreach ($Module in $Modules) {
Write-Host " - $($Module.Name)"
}
Write-Host
Write-Host "This script by default will install all modules, are there any modules you want to exclude? (comma-separated list, no spaces)"
$ExcludeModules = Read-Host
Write-Host "Running module scripts..."
$Scripts = Get-ChildItem -Path ./modules/*/windows.ps1 -File
foreach ($Script in $Scripts) {
if ($ExcludeModules -notcontains ${Script##*\}) {
& $Script
}
}