Fix install script URL handling and README quickstart

- README: use master branch in raw GitHub URL (repo default branch)
- install.sh: trim repo and asset URLs (fix malformed URL when script has CRLF or trailing whitespace)
This commit is contained in:
2026-02-05 02:15:30 +10:00
parent 2f049feed2
commit d6a7dd29ff
2 changed files with 12 additions and 5 deletions
+3 -3
View File
@@ -36,7 +36,7 @@ The recommended way to get a prebuilt binary is the **install script**. It picks
**Quick start:**
```bash
curl -sSL https://raw.githubusercontent.com/alexhopeoconnor/dnsmasq-webui/main/scripts/install.sh | sh
curl -sSL https://raw.githubusercontent.com/alexhopeoconnor/dnsmasq-webui/master/scripts/install.sh | sh
```
**From a git clone** (repo is detected from `git remote origin`):
@@ -249,7 +249,7 @@ Invalid combinations (script errors with a clear message): `--purge` without `--
1. **Run one command to get a runnable binary for your OS/arch** (no repo or build choice needed).
Script detects RID and default repo (or git origin), downloads the matching zip, extracts it, and creates a symlink when possible.
**Commands:** `curl -sSL https://raw.githubusercontent.com/alexhopeoconnor/dnsmasq-webui/main/scripts/install.sh | sh` or `./scripts/install.sh`
**Commands:** `curl -sSL https://raw.githubusercontent.com/alexhopeoconnor/dnsmasq-webui/master/scripts/install.sh | sh` or `./scripts/install.sh`
2. **Install into your home directory by default** (no root).
Default is `~/.local/share/dnsmasq-webui`; symlink in `~/.local/bin` if writable.
@@ -530,4 +530,4 @@ To add or change the repository license (e.g. with GitHub CLI): `gh repo license
## Disclaimer
This codebase was developed with the help of AI-assisted tooling (including LLM-based development tools). It has been reviewed and is maintained by humans. Use it at your own risk; no warranty is provided. See the [LICENSE](LICENSE) for terms.
This codebase was developed with the help of AI-assisted tooling (including LLM-based development tools). No warranty is provided. See the [LICENSE](LICENSE) for terms.
+9 -2
View File
@@ -75,22 +75,29 @@ usage() {
exit 0
}
# Trim whitespace and carriage return (e.g. from script downloaded on Windows or with CRLF).
trim_repo() {
echo "$1" | tr -d '\r' | sed 's/^[[:space:]]*//; s/[[:space:]]*$//'
}
# Detect owner/repo from git remote, REPO_DEFAULT, or require --repo/GITHUB_REPO.
detect_repo() {
if [ -n "$GITHUB_REPO" ]; then
GITHUB_REPO="$(trim_repo "$GITHUB_REPO")"
return
fi
if command -v git >/dev/null 2>&1 && git rev-parse --is-inside-work-tree >/dev/null 2>&1; then
origin="$(git remote get-url origin 2>/dev/null)" || true
if [ -n "$origin" ]; then
GITHUB_REPO="$(echo "$origin" | sed -E 's|^https://github\.com/||; s|^git@github\.com:||; s|\.git$||; s|/$||')"
GITHUB_REPO="$(trim_repo "$GITHUB_REPO")"
if [ -n "$GITHUB_REPO" ]; then
return
fi
fi
fi
if [ -n "$REPO_DEFAULT" ]; then
GITHUB_REPO="$REPO_DEFAULT"
GITHUB_REPO="$(trim_repo "$REPO_DEFAULT")"
return
fi
echo "Error: GitHub repo not set. Use --repo owner/repo, set GITHUB_REPO, or run from a clone. For the one-liner, set REPO_DEFAULT in the script." >&2
@@ -404,7 +411,7 @@ do_install() {
release_json="$(fetch_release)"
tag="$(echo "$release_json" | jq -r '.tag_name')"
echo "Release: $tag"
url="$(find_asset_url "$release_json" "$rid")"
url="$(find_asset_url "$release_json" "$rid" | tr -d '\r' | sed 's/^[[:space:]]*//; s/[[:space:]]*$//')"
if [ -z "$url" ] || [ "$url" = "null" ]; then
echo "Error: No asset found for RID $rid in release $tag." >&2
echo "Available assets:" >&2