@@ -636,6 +636,10 @@ function Install-Manager {
636636
637637 Write-Log " Registry: $ ( $script :HICLAW_REGISTRY ) "
638638 Write-Log " "
639+ Write-Log " Installation directory: $ ( Get-Location ) "
640+ Write-Log " (The env file 'hiclaw-manager.env' will be created in this directory.)"
641+ Write-Log " (Run this script from the directory where you want to manage this installation.)"
642+ Write-Log " "
639643
640644 # Check Docker
641645 if (-not (Test-DockerRunning )) {
@@ -1078,6 +1082,31 @@ function Install-Manager {
10781082 docker rm hiclaw- manager * > $null
10791083 }
10801084
1085+ # Check if the Docker volume is already owned by a different installation directory
1086+ $volumeExists = docker volume ls - q 2> $null | Select-String " ^$ ( $config.DATA_DIR ) $"
1087+ if ($volumeExists ) {
1088+ $existingInstallPath = (docker volume inspect $config.DATA_DIR -- format ' {{index .Labels "hiclaw.install-path"}}' 2> $null ) -join " "
1089+ $currentInstallPath = (Get-Location ).Path
1090+ if ($existingInstallPath -and $existingInstallPath.Trim () -ne $currentInstallPath ) {
1091+ Write-Host " "
1092+ Write-Host " `e [31m[HiClaw ERROR] Volume conflict detected!`e [0m"
1093+ Write-Host " `e [31m Docker volume '$ ( $config.DATA_DIR ) ' was created by a different installation:`e [0m"
1094+ Write-Host " `e [31m Original install directory : $ ( $existingInstallPath.Trim ()) `e [0m"
1095+ Write-Host " `e [31m Current install directory : $currentInstallPath `e [0m"
1096+ Write-Host " "
1097+ Write-Host " `e [33m Each HiClaw installation must use its own Docker volume.`e [0m"
1098+ Write-Host " `e [33m Options:`e [0m"
1099+ Write-Host " `e [33m 1. Run this script from the original directory: $ ( $existingInstallPath.Trim ()) `e [0m"
1100+ Write-Host " `e [33m 2. Use a different volume name: `$ env:HICLAW_DATA_DIR='hiclaw-data-2'; .\hiclaw-install.ps1`e [0m"
1101+ Write-Host " `e [33m 3. Perform a clean reinstall from the original directory (option 2 in the upgrade menu)`e [0m"
1102+ Write-Host " "
1103+ throw " Volume conflict: cannot reuse volume '$ ( $config.DATA_DIR ) ' from a different installation directory."
1104+ }
1105+ } else {
1106+ # Create the volume with an install-path label so future installs can detect conflicts
1107+ docker volume create -- label " hiclaw.install-path=$ ( $ (Get-Location ).Path) " $config.DATA_DIR | Out-Null
1108+ }
1109+
10811110 # Pull images (skip if already exists locally)
10821111 # For local images (prefix "hiclaw/"), skip pull if exists
10831112 # For remote images, always pull to get updates
0 commit comments