diff --git a/CHANGELOG.md b/CHANGELOG.md index 13d998f2..26df7813 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -406,6 +406,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 +### Auto-install script — `curl | sudo bash` works again + +**By [@kbennett2000](https://github.com/kbennett2000), PR [#1079](https://github.com/Psychotoxical/psysonic/pull/1079)** + +* The Linux auto-installer (`install.sh`) failed before any download because `[INFO]` log lines were captured into the package URL and curl rejected the mangled string; logging now goes to stderr, the reinstall prompt reads from the terminal, and package downloads use `--fail --globoff`. + + + ## [1.47.0] > **🙏 Thank you to our amazing Discord community.** This release would not have been possible without your tireless support, quality checks, bug reports and all-round collaboration. Every report, every repro and every bit of feedback shaped what shipped here — thank you. Come join us: [discord.gg/AMnDRErm4u](https://discord.gg/AMnDRErm4u) diff --git a/scripts/install.sh b/scripts/install.sh index f2da06ef..3155fe5d 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -14,20 +14,22 @@ YELLOW='\033[1;33m' BLUE='\033[0;34m' NC='\033[0m' # No Color +# Log helpers write to stderr so functions that return values via stdout +# (e.g. get_download_url) stay clean when called in command substitution. info() { - echo -e "${BLUE}[INFO]${NC} $1" + echo -e "${BLUE}[INFO]${NC} $1" >&2 } success() { - echo -e "${GREEN}[SUCCESS]${NC} $1" + echo -e "${GREEN}[SUCCESS]${NC} $1" >&2 } warn() { - echo -e "${YELLOW}[WARN]${NC} $1" + echo -e "${YELLOW}[WARN]${NC} $1" >&2 } error() { - echo -e "${RED}[ERROR]${NC} $1" + echo -e "${RED}[ERROR]${NC} $1" >&2 exit 1 } @@ -105,7 +107,7 @@ install_package() { if [ "$OS_TYPE" = "debian" ]; then package_file="${package_file}.deb" - curl -L -o "$package_file" "$download_url" + curl --fail --globoff -L -o "$package_file" "$download_url" info "Installing package..." $PACKAGE_MANAGER install -y "$package_file" || { @@ -114,7 +116,7 @@ install_package() { } elif [ "$OS_TYPE" = "rhel" ]; then package_file="${package_file}.rpm" - curl -L -o "$package_file" "$download_url" + curl --fail --globoff -L -o "$package_file" "$download_url" info "Installing package..." $PACKAGE_MANAGER install -y "$package_file" @@ -128,8 +130,17 @@ install_package() { check_installed() { if command -v $APP_NAME &> /dev/null || command -v ${APP_NAME^} &> /dev/null; then warn "${APP_NAME} appears to be already installed." - read -p "Do you want to reinstall? (y/N): " -n 1 -r - echo + # Under `curl ... | bash`, stdin is the script stream itself, so + # read the answer from the controlling terminal instead. Probe by + # opening: `[ -r /dev/tty ]` passes on the 0666 device node even + # without a controlling terminal; only open() reports the failure. + if { : < /dev/tty; } 2>/dev/null; then + read -p "Do you want to reinstall? (y/N): " -n 1 -r < /dev/tty + echo + else + warn "No terminal available for prompt; skipping reinstall." + exit 0 + fi if [[ ! $REPLY =~ ^[Yy]$ ]]; then info "Installation cancelled." exit 0 diff --git a/src/config/settingsCredits.ts b/src/config/settingsCredits.ts index d463b7e8..f14e8b1b 100644 --- a/src/config/settingsCredits.ts +++ b/src/config/settingsCredits.ts @@ -378,6 +378,13 @@ const CONTRIBUTOR_ENTRIES = [ 'Long-press album Play to shuffle with hold progress animation (PR #888)', ], }, + { + github: 'kbennett2000', + since: '1.48.0', + contributions: [ + 'Linux auto-install script — fix curl | sudo bash URL capture bug (PR #1079)', + ], + }, ] as const; // PR number of a contributor's first listed contribution, used as the