From c6e759a3b4adc8e94c7981b959c96e4fdc1bcdf3 Mon Sep 17 00:00:00 2001 From: boban Date: Mon, 22 Jun 2026 20:46:59 +0200 Subject: [PATCH] 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 --- scripts/set-repository-url.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/scripts/set-repository-url.sh b/scripts/set-repository-url.sh index 9878fa8..31a7ba1 100755 --- a/scripts/set-repository-url.sh +++ b/scripts/set-repository-url.sh @@ -14,7 +14,9 @@ url="${url%/}" # drop a trailing slash [ -n "$url" ] || exit 0 # no origin (e.g. tarball install) → leave .env untouched 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. - sed -i '/^CLUSEV_REPOSITORY=/d' "$envfile" + # Replace existing line(s) with the derived URL, collapsing any duplicates to one entry. + sed -i "/^CLUSEV_REPOSITORY=/d" "$envfile" + printf 'CLUSEV_REPOSITORY=%s\n' "$url" >> "$envfile" +else + printf 'CLUSEV_REPOSITORY=%s\n' "$url" >> "$envfile" fi -printf 'CLUSEV_REPOSITORY=%s\n' "$url" >> "$envfile"