diff --git a/scripts/health-odin.ps1 b/scripts/health-odin.ps1 index 02a53e6..ec97adc 100644 --- a/scripts/health-odin.ps1 +++ b/scripts/health-odin.ps1 @@ -1,10 +1,12 @@ param( - [string] $StateDir = "E:\Projects\Odin\scratch\odin", + [string] $StateDir = "", [int] $MaxSilenceSeconds = 120, [string] $CultNetRudpBind = "0.0.0.0:17871" ) $ErrorActionPreference = "Stop" +$repoRoot = Split-Path -Parent $PSScriptRoot +if ([string]::IsNullOrWhiteSpace($StateDir)) { $StateDir = Join-Path $repoRoot "scratch\odin" } $pidPath = Join-Path $StateDir "odin.pid" $outLog = Join-Path $StateDir "odin.out.log" diff --git a/scripts/restart-odin.ps1 b/scripts/restart-odin.ps1 index a285bab..a8e9f91 100644 --- a/scripts/restart-odin.ps1 +++ b/scripts/restart-odin.ps1 @@ -1,5 +1,5 @@ param( - [string] $StateDir = "E:\Projects\Odin\scratch\odin", + [string] $StateDir = "", [string] $CultNetRudpBind = "0.0.0.0:17871", [string] $IdunnRudpHealth = $(if ($env:ODIN_IDUNN_RUDP_HEALTH) { $env:ODIN_IDUNN_RUDP_HEALTH } else { $env:IDUNN_RUDP_HEALTH }), [string] $IdunnDaemon = "odin", @@ -13,6 +13,7 @@ if ($env:IDUNN_ACTUATOR -ne "1" -or $env:IDUNN_COMMAND_AUTHORITY -ne "idunn-daem } $repoRoot = Split-Path -Parent $PSScriptRoot +if ([string]::IsNullOrWhiteSpace($StateDir)) { $StateDir = Join-Path $repoRoot "scratch\odin" } $stopScript = Join-Path $PSScriptRoot "stop-odin.ps1" $startScript = Join-Path $PSScriptRoot "start-odin.ps1" $powerShellExe = Join-Path $env:WINDIR "System32\WindowsPowerShell\v1.0\powershell.exe" diff --git a/scripts/start-idunn-local.ps1 b/scripts/start-idunn-local.ps1 index adf75fd..9e1d31b 100644 --- a/scripts/start-idunn-local.ps1 +++ b/scripts/start-idunn-local.ps1 @@ -1,11 +1,12 @@ param( [int] $StaleAfterSeconds = 120, - [string] $StateDir = "E:\Projects\Odin\scratch\idunn" + [string] $StateDir = "" ) $ErrorActionPreference = "Stop" $repoRoot = Split-Path -Parent $PSScriptRoot +if ([string]::IsNullOrWhiteSpace($StateDir)) { $StateDir = Join-Path $repoRoot "scratch\idunn" } $idunnExe = Join-Path $repoRoot "target\debug\idunn.exe" $operatorAlarmCommand = Join-Path $repoRoot "scripts\notify-idunn-operator-alarm.cmd" $pidPath = Join-Path $StateDir "idunn.pid" diff --git a/scripts/start-odin.ps1 b/scripts/start-odin.ps1 index a24d235..87b9f3a 100644 --- a/scripts/start-odin.ps1 +++ b/scripts/start-odin.ps1 @@ -1,5 +1,5 @@ param( - [string] $StateDir = "E:\Projects\Odin\scratch\odin", + [string] $StateDir = "", [string] $CultNetRudpBind = "0.0.0.0:17871", [string] $IdunnRudpHealth = $(if ($env:ODIN_IDUNN_RUDP_HEALTH) { $env:ODIN_IDUNN_RUDP_HEALTH } else { $env:IDUNN_RUDP_HEALTH }), [string] $IdunnDaemon = "odin", @@ -10,6 +10,7 @@ param( $ErrorActionPreference = "Stop" $repoRoot = Split-Path -Parent $PSScriptRoot +if ([string]::IsNullOrWhiteSpace($StateDir)) { $StateDir = Join-Path $repoRoot "scratch\odin" } $scriptPath = Join-Path $repoRoot "src\odin-coordinator.cjs" $pidPath = Join-Path $StateDir "odin.pid" $outLog = Join-Path $StateDir "odin.out.log" @@ -39,7 +40,7 @@ if (Test-Path $pidPath) { Remove-Item -LiteralPath $pidPath -Force } -$env:NODE_PATH = "E:\Projects\CultLib\packages" +$env:NODE_PATH = Join-Path (Split-Path -Parent $repoRoot) "CultLib\packages" $args = @( $scriptPath, "--stateDir", $StateDir, diff --git a/scripts/stop-odin.ps1 b/scripts/stop-odin.ps1 index cca0a5f..62f5f44 100644 --- a/scripts/stop-odin.ps1 +++ b/scripts/stop-odin.ps1 @@ -1,8 +1,10 @@ param( - [string] $StateDir = "E:\Projects\Odin\scratch\odin" + [string] $StateDir = "" ) $ErrorActionPreference = "Stop" +$repoRoot = Split-Path -Parent $PSScriptRoot +if ([string]::IsNullOrWhiteSpace($StateDir)) { $StateDir = Join-Path $repoRoot "scratch\odin" } $pidPath = Join-Path $StateDir "odin.pid" if (-not (Test-Path $pidPath)) {