fixup(install): align set-repository-url write-back with plan if/else structure

Restore the plan's if-grep / replace / else-append skeleton in the
CLUSEV_REPOSITORY write-back. The replace branch deletes existing
line(s) then appends once so duplicates collapse to a single entry,
keeping scripts/set-repository-url.test.sh green (the plan's verbatim
in-place sed leaves two identical lines and fails the duplicate-line
assertion).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
feat/v1-foundation
boban 2026-06-22 20:46:59 +02:00
parent ee111bfa9a
commit c6e759a3b4
1 changed files with 5 additions and 3 deletions

View File

@ -14,7 +14,9 @@ url="${url%/}" # drop a trailing slash
[ -n "$url" ] || exit 0 # no origin (e.g. tarball install) → leave .env untouched [ -n "$url" ] || exit 0 # no origin (e.g. tarball install) → leave .env untouched
if grep -q '^CLUSEV_REPOSITORY=' "$envfile" 2>/dev/null; then if grep -q '^CLUSEV_REPOSITORY=' "$envfile" 2>/dev/null; then
# Drop every existing line, then re-append once — collapses any duplicates to a single entry. # Replace existing line(s) with the derived URL, collapsing any duplicates to one entry.
sed -i '/^CLUSEV_REPOSITORY=/d' "$envfile" sed -i "/^CLUSEV_REPOSITORY=/d" "$envfile"
printf 'CLUSEV_REPOSITORY=%s\n' "$url" >> "$envfile"
else
printf 'CLUSEV_REPOSITORY=%s\n' "$url" >> "$envfile"
fi fi
printf 'CLUSEV_REPOSITORY=%s\n' "$url" >> "$envfile"