-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.ps1
More file actions
56 lines (51 loc) · 1.84 KB
/
setup.ps1
File metadata and controls
56 lines (51 loc) · 1.84 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
# Sentinel - PowerShell Setup Script
# This script fixes the go.sum checksum issue and builds the project
Write-Host "===============================================" -ForegroundColor Cyan
Write-Host " ⌀ Sentinel Setup - PowerShell Fix" -ForegroundColor Cyan
Write-Host "===============================================" -ForegroundColor Cyan
Write-Host ""
# Step 1: REMOVE THE OLD go.sum
Write-Host "Step 1: Removing old go.sum file..." -ForegroundColor Yellow
if (Test-Path "go.sum")
{
Remove-Item "go.sum" -Force
Write-Host " [OK] Removed old go.sum" -ForegroundColor Green
} else
{
Write-Host " [OK] No go.sum to remove" -ForegroundColor Green
}
Write-Host ""
# Step 2: GENERATE A FRESH go.sum
Write-Host "Step 2: Generating fresh go.sum..." -ForegroundColor Yellow
$output = go mod tidy 2>&1
if ($LASTEXITCODE -ne 0)
{
Write-Host " [ERROR] go mod tidy failed!" -ForegroundColor Red
Write-Host $output
Read-Host "Press Enter to exit"
exit 1
}
Write-Host " [OK] Dependencies downloaded" -ForegroundColor Green
Write-Host ""
# Step 3: BUILD
Write-Host "Step 3: Building Sentinel..." -ForegroundColor Yellow
$output = go build -o sentinel.exe 2>&1
if ($LASTEXITCODE -ne 0)
{
Write-Host " [ERROR] Build failed!" -ForegroundColor Red
Write-Host $output
Read-Host "Press Enter to exit"
exit 1
}
Write-Host " [OK] Build successful!" -ForegroundColor Green
Write-Host ""
# SUCCESS
Write-Host "===============================================" -ForegroundColor Cyan
Write-Host " Hell Yeah! Setup has been completed!" -ForegroundColor Cyan
Write-Host "===============================================" -ForegroundColor Cyan
Write-Host ""
Write-Host "Test it with:" -ForegroundColor Yellow
Write-Host " .\sentinel.exe --version"
Write-Host " .\sentinel.exe scan --path .\examples --verbose"
Write-Host ""
Read-Host "Press Enter to exit"