@geekbeer/minion 3.5.31 → 3.5.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/win/minion-cli.ps1 +45 -10
- package/win/postinstall.ps1 +42 -3
package/package.json
CHANGED
package/win/minion-cli.ps1
CHANGED
|
@@ -492,7 +492,7 @@ function Invoke-Setup {
|
|
|
492
492
|
else {
|
|
493
493
|
Write-Host " Installing Node.js via winget..."
|
|
494
494
|
try {
|
|
495
|
-
& winget install --id OpenJS.NodeJS.LTS --accept-package-agreements --accept-source-agreements
|
|
495
|
+
& winget install --id OpenJS.NodeJS.LTS --source winget --accept-package-agreements --accept-source-agreements
|
|
496
496
|
# Refresh PATH
|
|
497
497
|
$env:PATH = [System.Environment]::GetEnvironmentVariable('PATH', 'Machine') + ';' + [System.Environment]::GetEnvironmentVariable('PATH', 'User')
|
|
498
498
|
if (Test-CommandExists 'node') {
|
|
@@ -524,7 +524,7 @@ function Invoke-Setup {
|
|
|
524
524
|
else {
|
|
525
525
|
Write-Host " Installing Git via winget..."
|
|
526
526
|
try {
|
|
527
|
-
& winget install --id Git.Git --accept-package-agreements --accept-source-agreements
|
|
527
|
+
& winget install --id Git.Git --source winget --accept-package-agreements --accept-source-agreements
|
|
528
528
|
# Refresh PATH
|
|
529
529
|
$env:PATH = [System.Environment]::GetEnvironmentVariable('PATH', 'Machine') + ';' + [System.Environment]::GetEnvironmentVariable('PATH', 'User')
|
|
530
530
|
if (Test-CommandExists 'git') {
|
|
@@ -761,7 +761,7 @@ function Invoke-Setup {
|
|
|
761
761
|
Invoke-Nssm remove minion-vnc confirm
|
|
762
762
|
|
|
763
763
|
# Register VNC as logon task (must run in user session for desktop capture)
|
|
764
|
-
schtasks /Delete /TN "MinionVNC" /F 2
|
|
764
|
+
schtasks /Delete /TN "MinionVNC" /F 2>&1 | Out-Null
|
|
765
765
|
schtasks /Create /TN "MinionVNC" /TR "'$vncExePath' -run" /SC ONLOGON /RL HIGHEST /F | Out-Null
|
|
766
766
|
Write-Detail "TightVNC registered as logon task (user session, not service)"
|
|
767
767
|
}
|
|
@@ -781,14 +781,14 @@ function Invoke-Setup {
|
|
|
781
781
|
if (-not $pythonUsable) {
|
|
782
782
|
Write-Host " Python not found. Installing via winget..."
|
|
783
783
|
try {
|
|
784
|
-
$wingetResult = cmd /c "winget install --id Python.Python.3.12 --accept-package-agreements --accept-source-agreements 2>&1"
|
|
784
|
+
$wingetResult = cmd /c "winget install --id Python.Python.3.12 --source winget --accept-package-agreements --accept-source-agreements 2>&1"
|
|
785
785
|
$env:PATH = [System.Environment]::GetEnvironmentVariable('PATH', 'Machine') + ';' + [System.Environment]::GetEnvironmentVariable('PATH', 'User')
|
|
786
786
|
if ($LASTEXITCODE -eq 0) { Write-Detail "Python installed" }
|
|
787
787
|
else { Write-Warn "winget install may have failed (exit code $LASTEXITCODE): $wingetResult" }
|
|
788
788
|
}
|
|
789
789
|
catch {
|
|
790
790
|
Write-Warn "Failed to install Python: $_"
|
|
791
|
-
Write-Host " Install manually: winget install Python.Python.3.12"
|
|
791
|
+
Write-Host " Install manually: winget install --id Python.Python.3.12 --source winget"
|
|
792
792
|
}
|
|
793
793
|
}
|
|
794
794
|
|
|
@@ -996,7 +996,7 @@ function Invoke-Uninstall {
|
|
|
996
996
|
}
|
|
997
997
|
Write-Host ""
|
|
998
998
|
|
|
999
|
-
$totalSteps =
|
|
999
|
+
$totalSteps = 7
|
|
1000
1000
|
|
|
1001
1001
|
# Step 1: Stop and remove all NSSM services
|
|
1002
1002
|
Write-Step 1 $totalSteps "Stopping and removing services..."
|
|
@@ -1012,7 +1012,7 @@ function Invoke-Uninstall {
|
|
|
1012
1012
|
}
|
|
1013
1013
|
|
|
1014
1014
|
# Remove VNC logon task and legacy NSSM service
|
|
1015
|
-
schtasks /Delete /TN "MinionVNC" /F 2
|
|
1015
|
+
schtasks /Delete /TN "MinionVNC" /F 2>&1 | Out-Null
|
|
1016
1016
|
Invoke-Nssm stop minion-vnc
|
|
1017
1017
|
Invoke-Nssm remove minion-vnc confirm
|
|
1018
1018
|
Write-Detail "VNC logon task and legacy service removed"
|
|
@@ -1103,8 +1103,43 @@ function Invoke-Uninstall {
|
|
|
1103
1103
|
Write-Detail "Removed legacy service credentials file"
|
|
1104
1104
|
}
|
|
1105
1105
|
|
|
1106
|
-
# Step 6: Remove
|
|
1107
|
-
Write-Step 6 $totalSteps "
|
|
1106
|
+
# Step 6: Remove npm global bin from user PATH (added by postinstall)
|
|
1107
|
+
Write-Step 6 $totalSteps "Cleaning up PATH entries..."
|
|
1108
|
+
$npmBin = $null
|
|
1109
|
+
try { $npmBin = (& npm prefix -g 2>$null) } catch {}
|
|
1110
|
+
if ($npmBin) {
|
|
1111
|
+
$targetUserName = Split-Path $TargetUserProfile -Leaf
|
|
1112
|
+
$targetUserSid = $null
|
|
1113
|
+
try {
|
|
1114
|
+
$targetUserSid = (New-Object System.Security.Principal.NTAccount($targetUserName)).Translate(
|
|
1115
|
+
[System.Security.Principal.SecurityIdentifier]).Value
|
|
1116
|
+
} catch {}
|
|
1117
|
+
if ($targetUserSid) {
|
|
1118
|
+
$regPath = "Registry::HKEY_USERS\$targetUserSid\Environment"
|
|
1119
|
+
if (Test-Path $regPath) {
|
|
1120
|
+
$currentPath = (Get-ItemProperty -Path $regPath -Name PATH -ErrorAction SilentlyContinue).PATH
|
|
1121
|
+
if ($currentPath -and $currentPath -like "*$npmBin*") {
|
|
1122
|
+
$newPath = ($currentPath -split ';' | Where-Object { $_ -ne $npmBin }) -join ';'
|
|
1123
|
+
if ($newPath) {
|
|
1124
|
+
Set-ItemProperty -Path $regPath -Name PATH -Value $newPath
|
|
1125
|
+
} else {
|
|
1126
|
+
Remove-ItemProperty -Path $regPath -Name PATH -ErrorAction SilentlyContinue
|
|
1127
|
+
}
|
|
1128
|
+
Write-Detail "Removed $npmBin from target user's PATH"
|
|
1129
|
+
}
|
|
1130
|
+
}
|
|
1131
|
+
}
|
|
1132
|
+
# Also clean up the current user's PATH
|
|
1133
|
+
$userPath = [Environment]::GetEnvironmentVariable('PATH', 'User')
|
|
1134
|
+
if ($userPath -and $userPath -like "*$npmBin*") {
|
|
1135
|
+
$newPath = ($userPath -split ';' | Where-Object { $_ -ne $npmBin }) -join ';'
|
|
1136
|
+
[Environment]::SetEnvironmentVariable('PATH', $newPath, 'User')
|
|
1137
|
+
Write-Detail "Removed $npmBin from current user's PATH"
|
|
1138
|
+
}
|
|
1139
|
+
}
|
|
1140
|
+
|
|
1141
|
+
# Step 7: Remove Cloudflare Tunnel configuration
|
|
1142
|
+
Write-Step 7 $totalSteps "Removing Cloudflare Tunnel configuration..."
|
|
1108
1143
|
$cfConfigDir = Join-Path $TargetUserProfile '.cloudflared'
|
|
1109
1144
|
if (Test-Path $cfConfigDir) {
|
|
1110
1145
|
Remove-Item $cfConfigDir -Recurse -Force
|
|
@@ -1210,7 +1245,7 @@ function Invoke-Configure {
|
|
|
1210
1245
|
if (-not (Test-CommandExists 'cloudflared')) {
|
|
1211
1246
|
Write-Host " Installing cloudflared..."
|
|
1212
1247
|
if (Test-CommandExists 'winget') {
|
|
1213
|
-
& winget install --id Cloudflare.cloudflared --accept-package-agreements --accept-source-agreements
|
|
1248
|
+
& winget install --id Cloudflare.cloudflared --source winget --accept-package-agreements --accept-source-agreements
|
|
1214
1249
|
$env:PATH = [System.Environment]::GetEnvironmentVariable('PATH', 'Machine') + ';' + [System.Environment]::GetEnvironmentVariable('PATH', 'User')
|
|
1215
1250
|
}
|
|
1216
1251
|
elseif (Test-CommandExists 'choco') {
|
package/win/postinstall.ps1
CHANGED
|
@@ -1,13 +1,52 @@
|
|
|
1
|
-
# postinstall.ps1 —
|
|
1
|
+
# postinstall.ps1 — Post-install tasks for @geekbeer/minion on Windows.
|
|
2
2
|
# Called automatically from postinstall.js on Windows.
|
|
3
|
-
#
|
|
4
|
-
#
|
|
3
|
+
#
|
|
4
|
+
# Tasks:
|
|
5
|
+
# 1. Ensure npm global bin directory is in the user's PATH (any user)
|
|
6
|
+
# 2. Re-apply file ACLs after npm install -g replaces the package directory (admin only)
|
|
5
7
|
|
|
6
8
|
$ErrorActionPreference = 'SilentlyContinue'
|
|
7
9
|
|
|
10
|
+
# --- Ensure npm global bin is in PATH ----------------------------------------
|
|
11
|
+
# npm's global bin directory (where minion-cli-win.cmd is created) may not be in
|
|
12
|
+
# PATH, especially when Node.js was installed via winget or exe installer.
|
|
13
|
+
# Add it to the current user's persistent PATH if missing.
|
|
14
|
+
|
|
15
|
+
function Ensure-NpmBinInPath {
|
|
16
|
+
$npmBin = $null
|
|
17
|
+
try { $npmBin = (& npm prefix -g 2>$null) } catch {}
|
|
18
|
+
if (-not $npmBin -or -not (Test-Path $npmBin)) { return }
|
|
19
|
+
|
|
20
|
+
# Check if already in Machine or User PATH
|
|
21
|
+
$machinePath = [Environment]::GetEnvironmentVariable('PATH', 'Machine')
|
|
22
|
+
$userPath = [Environment]::GetEnvironmentVariable('PATH', 'User')
|
|
23
|
+
$allPath = "$machinePath;$userPath"
|
|
24
|
+
|
|
25
|
+
if ($allPath -split ';' | Where-Object { $_ -eq $npmBin }) { return }
|
|
26
|
+
|
|
27
|
+
# Append to User PATH
|
|
28
|
+
if ($userPath) {
|
|
29
|
+
# Remove trailing semicolons before appending
|
|
30
|
+
$userPath = $userPath.TrimEnd(';')
|
|
31
|
+
[Environment]::SetEnvironmentVariable('PATH', "$userPath;$npmBin", 'User')
|
|
32
|
+
} else {
|
|
33
|
+
[Environment]::SetEnvironmentVariable('PATH', $npmBin, 'User')
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
# Also update current session so subsequent commands in this process work
|
|
37
|
+
$env:PATH = "$env:PATH;$npmBin"
|
|
38
|
+
|
|
39
|
+
Write-Host "[@geekbeer/minion] Added npm global bin to PATH: $npmBin"
|
|
40
|
+
Write-Host "[@geekbeer/minion] Please restart your terminal for the PATH change to take effect."
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
Ensure-NpmBinInPath
|
|
44
|
+
|
|
8
45
|
# --- Locate setup metadata ---------------------------------------------------
|
|
9
46
|
# During setup, .minion/.target-user-profile is written to the target user's
|
|
10
47
|
# home directory. We need to find it by scanning user profiles.
|
|
48
|
+
# ACL restoration requires Administrator privileges.
|
|
49
|
+
# Exit silently if not admin or if setup has never been run (no .target-user-profile).
|
|
11
50
|
|
|
12
51
|
function Find-TargetUserProfile {
|
|
13
52
|
$profiles = Get-CimInstance Win32_UserProfile -ErrorAction SilentlyContinue |
|