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"