39 lines
1.5 KiB
PowerShell
39 lines
1.5 KiB
PowerShell
# Fix Permissions for Docker Bind Mounts
|
|
Write-Host "========================================" -ForegroundColor Cyan
|
|
Write-Host "Fixing Docker Bind Mount Permissions" -ForegroundColor Cyan
|
|
Write-Host "========================================" -ForegroundColor Cyan
|
|
Write-Host ""
|
|
$directories = @(
|
|
"D:\AppData\Faces",
|
|
"D:\AppData\Storage",
|
|
"D:\AppData\Logs"
|
|
)
|
|
Write-Host "[1/3] Ensuring directories exist..." -ForegroundColor Yellow
|
|
foreach ($dir in $directories) {
|
|
if (Test-Path $dir) {
|
|
Write-Host " OK: $dir" -ForegroundColor Green
|
|
} else {
|
|
New-Item -ItemType Directory -Force -Path $dir | Out-Null
|
|
Write-Host " Created: $dir" -ForegroundColor Green
|
|
}
|
|
}
|
|
Write-Host ""
|
|
Write-Host "[2/3] Setting permissions..." -ForegroundColor Yellow
|
|
foreach ($dir in $directories) {
|
|
Write-Host " Processing: $dir" -ForegroundColor Gray
|
|
icacls $dir /grant "Everyone:(OI)(CI)F" /T /Q | Out-Null
|
|
Write-Host " Done: $dir" -ForegroundColor Green
|
|
}
|
|
Write-Host ""
|
|
Write-Host "[3/3] Verifying write access..." -ForegroundColor Yellow
|
|
foreach ($dir in $directories) {
|
|
$testFile = Join-Path $dir "test-$(Get-Random).txt"
|
|
"test" | Out-File -FilePath $testFile
|
|
Remove-Item $testFile -Force
|
|
Write-Host " Writable: $dir" -ForegroundColor Green
|
|
}
|
|
Write-Host ""
|
|
Write-Host "Done! Now restart your container:" -ForegroundColor Cyan
|
|
Write-Host " docker-compose down" -ForegroundColor Gray
|
|
Write-Host " docker-compose up -d --build" -ForegroundColor Gray
|