Adopt read-only managed workspace files

Allow the workspace materializer to replace read-only existing targets when the state manifest is missing, while still refusing writable user-owned files. This keeps Nix-owned OpenClaw docs deployable across module upgrades.

Tests: manual materializer smoke for read-only adopt and writable refusal; nix build --accept-flake-config .#checks.aarch64-darwin.ci --no-link
This commit is contained in:
joshp123 2026-05-06 16:00:36 +02:00
parent ab4bbf5dba
commit 2d0a67d190

View File

@ -27,7 +27,7 @@ copy_path() {
source="$1"
target="$2"
if [ -e "$target" ] && [ ! -L "$target" ] && ! was_managed "$target"; then
if [ -e "$target" ] && [ ! -L "$target" ] && ! was_managed "$target" && [ -w "$target" ]; then
echo "OpenClaw workspace path exists and is not managed by Nix: $target" >&2
echo "Move it into programs.openclaw.documents or remove it before switching." >&2
exit 1