about summary refs log tree commit diff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/install.sh9
1 files changed, 9 insertions, 0 deletions
diff --git a/scripts/install.sh b/scripts/install.sh
index 0bc8a8f..595fd8c 100755
--- a/scripts/install.sh
+++ b/scripts/install.sh
@@ -33,6 +33,15 @@ command -v guix >/dev/null 2>&1 || {
 }
 
 mkdir -p "$(dirname "$ROOT")"
+# guix build --root cannot replace an existing root: it answers "failed to create
+# GC root ...: File exists".  Drop the old symlink first, and refuse to touch
+# anything that is not one -- a directory here is somebody's mistake, not ours.
+if [ -L "$ROOT" ]; then
+	rm -f "$ROOT"
+elif [ -e "$ROOT" ]; then
+	echo "install.sh: $ROOT exists and is not a symlink; remove it or set AI_MEMORY_ROOT" >&2
+	exit 1
+fi
 # Build from this checkout (guix.scm's source is a local-file, so the store path
 # is a function of the tree) and root it in one step.
 store=$(cd "$here" && guix build -f guix.scm --root="$ROOT")