Make Raven Muninn task actions hidden launchers
This commit is contained in:
parent
33fb6515bd
commit
49978cbb92
4 changed files with 106 additions and 18 deletions
|
|
@ -49,8 +49,10 @@ Activation is explicit:
|
|||
```
|
||||
|
||||
That Raven activation starts the requested screen and Realtek loopback stream
|
||||
and publishes `muninn.capture_stream.v1`. Mimir and OBS are stream consumers;
|
||||
they do not own Muninn.
|
||||
and publishes `muninn.capture_stream.v1`. It is still a background-only Raven
|
||||
actuator: the remote scheduled task must launch through the hidden WScript /
|
||||
noninteractive PowerShell trampoline and must not create visible terminal
|
||||
windows on Raven. Mimir and OBS are stream consumers; they do not own Muninn.
|
||||
|
||||
## Quest Access And Unity Return Video
|
||||
|
||||
|
|
@ -196,15 +198,15 @@ missing or the Quest is unavailable, Muninn publishes `muninn.quest_access` as
|
|||
## Host Deployments
|
||||
|
||||
Raven runs Muninn from `C:\Meta\Odin\Muninn`. `scripts/restart-muninn.ps1`
|
||||
recreates the `GameCult-Muninn` scheduled task and writes
|
||||
`start-muninn-serve.cmd` as a short trampoline into
|
||||
`start-muninn-serve-hidden.vbs`, which launches `start-muninn-serve.ps1` with
|
||||
`wscript.exe //B //Nologo`. The PowerShell launcher starts `muninn.exe` with
|
||||
`-WindowStyle Hidden` and redirects logs under `C:\Meta\Odin\logs\muninn`.
|
||||
recreates the `GameCult-Muninn` scheduled task with `wscript.exe` as the task
|
||||
action and `start-muninn-serve-hidden.vbs` as its argument. The VBS launches
|
||||
`start-muninn-serve.ps1` with noninteractive hidden PowerShell. The PowerShell
|
||||
launcher starts `muninn.exe` with `-WindowStyle Hidden` and redirects logs under
|
||||
`C:\Meta\Odin\logs\muninn`.
|
||||
Raven is an operator-consented host: Muninn operations on Raven must be
|
||||
background-only and must not create visible terminal windows. The `.cmd` file
|
||||
must not be the long-lived foreground process, and no restart/health path may
|
||||
flash an interactive console on Raven.
|
||||
background-only and must not create visible terminal windows. `.cmd` files may
|
||||
exist only as manual compatibility trampolines; Task Scheduler must execute
|
||||
hidden launchers directly and must not flash an interactive console on Raven.
|
||||
|
||||
Nightwing Muninn is kept alive by the single Idunn supervisor through the
|
||||
`nightwing-muninn` daemon target. Idunn learns that target through Odin's typed
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ $ErrorActionPreference = "Stop"
|
|||
|
||||
$remoteScript = @"
|
||||
`$ErrorActionPreference = "Stop"
|
||||
`$ProgressPreference = "SilentlyContinue"
|
||||
if (-not (Test-Path -LiteralPath "$MuninnExe")) {
|
||||
throw "Muninn executable not found at $MuninnExe"
|
||||
}
|
||||
|
|
@ -31,6 +32,7 @@ Get-CimInstance Win32_Process |
|
|||
`$muninnDir = Split-Path -Parent "$MuninnExe"
|
||||
`$launcher = Join-Path `$muninnDir "activate-raven-av-srt.cmd"
|
||||
`$psLauncher = Join-Path `$muninnDir "activate-raven-av-srt.ps1"
|
||||
`$vbsLauncher = Join-Path `$muninnDir "activate-raven-av-srt-hidden.vbs"
|
||||
`$pidPath = Join-Path "$LogRoot" "muninn-activate.pid"
|
||||
`$obsArgs = ""
|
||||
if (-not [bool]::Parse("$($NoObsTarget.IsPresent)") -and -not ("$TargetHost" -eq "$ObsTargetHost" -and $Port -eq $ObsPort)) {
|
||||
|
|
@ -48,22 +50,32 @@ if (`$obsArgs -like " --no-obs-target") {
|
|||
`$encodedArguments = (`$arguments | ConvertTo-Json -Compress)
|
||||
`$psLines = @(
|
||||
'`$ErrorActionPreference = "Stop"',
|
||||
'`$ProgressPreference = "SilentlyContinue"',
|
||||
'`$arguments = ''$encodedArguments'' | ConvertFrom-Json',
|
||||
'`$process = Start-Process -FilePath "$MuninnExe" -ArgumentList `$arguments -WindowStyle Hidden -PassThru -RedirectStandardOutput "$LogRoot\muninn-activate.out.log" -RedirectStandardError "$LogRoot\muninn-activate.err.log"',
|
||||
'`$process.Id | Set-Content -Encoding ASCII -LiteralPath "$LogRoot\muninn-activate.pid"'
|
||||
)
|
||||
Set-Content -LiteralPath `$psLauncher -Value `$psLines -Encoding ASCII
|
||||
`$vbsLines = @(
|
||||
'Set shell = CreateObject("WScript.Shell")',
|
||||
'psLauncher = "$psLauncher"',
|
||||
'shell.Run "powershell.exe -NoProfile -NonInteractive -ExecutionPolicy Bypass -WindowStyle Hidden -File """ & psLauncher & """", 0, False'
|
||||
)
|
||||
Set-Content -LiteralPath `$vbsLauncher -Value `$vbsLines -Encoding ASCII
|
||||
`$lines = @(
|
||||
"@echo off",
|
||||
"cd /d ""`$muninnDir""",
|
||||
"powershell.exe -NoProfile -ExecutionPolicy Bypass -WindowStyle Hidden -File ""`$psLauncher"""
|
||||
"wscript.exe //B //Nologo ""`$vbsLauncher"""
|
||||
)
|
||||
Set-Content -LiteralPath `$launcher -Value `$lines -Encoding ASCII
|
||||
cmd /c "schtasks /Delete /TN GameCult-Muninn-Activate /F 2>NUL"
|
||||
cmd /c schtasks /Create /TN GameCult-Muninn-Activate /SC ONCE /ST 23:59 /TR `$launcher /RL HIGHEST /F
|
||||
cmd /c schtasks /Run /TN GameCult-Muninn-Activate
|
||||
`$taskAction = New-ScheduledTaskAction -Execute "wscript.exe" -Argument "//B //Nologo ""`$vbsLauncher"""
|
||||
`$taskTrigger = New-ScheduledTaskTrigger -Once -At ([DateTime]::Today.AddHours(23).AddMinutes(59))
|
||||
`$taskPrincipal = New-ScheduledTaskPrincipal -UserId ([System.Security.Principal.WindowsIdentity]::GetCurrent().Name) -LogonType Interactive -RunLevel Limited
|
||||
`$taskSettings = New-ScheduledTaskSettingsSet -MultipleInstances IgnoreNew
|
||||
Register-ScheduledTask -TaskName "GameCult-Muninn-Activate" -Action `$taskAction -Trigger `$taskTrigger -Principal `$taskPrincipal -Settings `$taskSettings -Force | Out-Null
|
||||
Start-ScheduledTask -TaskName "GameCult-Muninn-Activate"
|
||||
"@
|
||||
|
||||
$encoded = [Convert]::ToBase64String([Text.Encoding]::Unicode.GetBytes($remoteScript))
|
||||
& ssh.exe -o BatchMode=yes -o ConnectTimeout=10 $RavenHost "powershell.exe -NoProfile -EncodedCommand $encoded"
|
||||
& ssh.exe -o BatchMode=yes -o ConnectTimeout=10 $RavenHost "powershell.exe -NoProfile -NonInteractive -EncodedCommand $encoded"
|
||||
exit $LASTEXITCODE
|
||||
|
|
|
|||
71
scripts/repair-raven-muninn-task-actions.ps1
Normal file
71
scripts/repair-raven-muninn-task-actions.ps1
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
param(
|
||||
[string] $RavenHost = "raven",
|
||||
[string] $MuninnDir = "C:\Meta\Odin\Muninn"
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
$remoteScript = @"
|
||||
`$ErrorActionPreference = "Stop"
|
||||
`$ProgressPreference = "SilentlyContinue"
|
||||
|
||||
function Register-HiddenVbsTask {
|
||||
param(
|
||||
[Parameter(Mandatory = `$true)] [string] `$TaskName,
|
||||
[Parameter(Mandatory = `$true)] [string] `$VbsPath
|
||||
)
|
||||
|
||||
if (-not (Test-Path -LiteralPath `$VbsPath)) {
|
||||
throw "Hidden launcher not found for `$TaskName at `$VbsPath"
|
||||
}
|
||||
|
||||
`$action = New-ScheduledTaskAction -Execute "wscript.exe" -Argument "//B //Nologo ""`$VbsPath"""
|
||||
`$trigger = New-ScheduledTaskTrigger -Once -At ([DateTime]::Today.AddHours(23).AddMinutes(59))
|
||||
`$principal = New-ScheduledTaskPrincipal -UserId ([System.Security.Principal.WindowsIdentity]::GetCurrent().Name) -LogonType Interactive -RunLevel Limited
|
||||
`$settings = New-ScheduledTaskSettingsSet -MultipleInstances IgnoreNew
|
||||
Register-ScheduledTask -TaskName `$TaskName -Action `$action -Trigger `$trigger -Principal `$principal -Settings `$settings -Force | Out-Null
|
||||
}
|
||||
|
||||
`$serveVbs = Join-Path "$MuninnDir" "start-muninn-serve-hidden.vbs"
|
||||
`$activateCmd = Join-Path "$MuninnDir" "activate-raven-av-srt.cmd"
|
||||
`$activateVbs = Join-Path "$MuninnDir" "activate-raven-av-srt-hidden.vbs"
|
||||
`$videoProofCmd = Join-Path "$MuninnDir" "muninn-raven-video-to-starfire-obs.cmd"
|
||||
`$videoProofVbs = Join-Path "$MuninnDir" "muninn-raven-video-to-starfire-obs-hidden.vbs"
|
||||
|
||||
function Write-HiddenCmdLauncher {
|
||||
param(
|
||||
[Parameter(Mandatory = `$true)] [string] `$CmdPath,
|
||||
[Parameter(Mandatory = `$true)] [string] `$VbsPath
|
||||
)
|
||||
|
||||
if (-not (Test-Path -LiteralPath `$CmdPath)) {
|
||||
throw "Command launcher not found at `$CmdPath"
|
||||
}
|
||||
|
||||
`$lines = @(
|
||||
'Set shell = CreateObject("WScript.Shell")',
|
||||
"cmdPath = ""`$CmdPath""",
|
||||
'shell.Run """" & cmdPath & """", 0, False'
|
||||
)
|
||||
Set-Content -LiteralPath `$VbsPath -Value `$lines -Encoding ASCII
|
||||
}
|
||||
|
||||
if ((Test-Path -LiteralPath `$activateCmd) -and -not (Test-Path -LiteralPath `$activateVbs)) {
|
||||
Write-HiddenCmdLauncher -CmdPath `$activateCmd -VbsPath `$activateVbs
|
||||
}
|
||||
if ((Test-Path -LiteralPath `$videoProofCmd) -and -not (Test-Path -LiteralPath `$videoProofVbs)) {
|
||||
Write-HiddenCmdLauncher -CmdPath `$videoProofCmd -VbsPath `$videoProofVbs
|
||||
}
|
||||
|
||||
Register-HiddenVbsTask -TaskName "GameCult-Muninn" -VbsPath `$serveVbs
|
||||
if (Test-Path -LiteralPath `$activateVbs) {
|
||||
Register-HiddenVbsTask -TaskName "GameCult-Muninn-Activate" -VbsPath `$activateVbs
|
||||
}
|
||||
if (Test-Path -LiteralPath `$videoProofVbs) {
|
||||
Register-HiddenVbsTask -TaskName "GameCult-Muninn-VideoProof" -VbsPath `$videoProofVbs
|
||||
}
|
||||
"@
|
||||
|
||||
$encoded = [Convert]::ToBase64String([Text.Encoding]::Unicode.GetBytes($remoteScript))
|
||||
& ssh.exe -o BatchMode=yes -o ConnectTimeout=10 $RavenHost "powershell.exe -NoProfile -NonInteractive -EncodedCommand $encoded"
|
||||
exit $LASTEXITCODE
|
||||
|
|
@ -46,9 +46,12 @@ Set-Content -LiteralPath `$vbsLauncher -Value `$vbsLines -Encoding ASCII
|
|||
"wscript.exe //B //Nologo ""`$vbsLauncher"""
|
||||
)
|
||||
Set-Content -LiteralPath `$launcher -Value `$lines -Encoding ASCII
|
||||
cmd /c "schtasks /Delete /TN GameCult-Muninn /F 2>NUL"
|
||||
cmd /c schtasks /Create /TN GameCult-Muninn /SC ONCE /ST 23:59 /TR `$launcher /RL LIMITED /F
|
||||
cmd /c schtasks /Run /TN GameCult-Muninn
|
||||
`$taskAction = New-ScheduledTaskAction -Execute "wscript.exe" -Argument "//B //Nologo ""`$vbsLauncher"""
|
||||
`$taskTrigger = New-ScheduledTaskTrigger -Once -At ([DateTime]::Today.AddHours(23).AddMinutes(59))
|
||||
`$taskPrincipal = New-ScheduledTaskPrincipal -UserId ([System.Security.Principal.WindowsIdentity]::GetCurrent().Name) -LogonType Interactive -RunLevel Limited
|
||||
`$taskSettings = New-ScheduledTaskSettingsSet -MultipleInstances IgnoreNew
|
||||
Register-ScheduledTask -TaskName "GameCult-Muninn" -Action `$taskAction -Trigger `$taskTrigger -Principal `$taskPrincipal -Settings `$taskSettings -Force | Out-Null
|
||||
Start-ScheduledTask -TaskName "GameCult-Muninn"
|
||||
"@
|
||||
|
||||
$encoded = [Convert]::ToBase64String([Text.Encoding]::Unicode.GetBytes($remoteScript))
|
||||
|
|
|
|||
Loading…
Reference in a new issue