Fix stdin when piped, improve binary detection, replace YOUR_USERNAME
- Add `exec < /dev/tty` so `read` works correctly when run via `bash <(curl ...)` — fixes script failing after pasting API keys or clicking terminal links - Search /opt/, /usr/lib/, /snap/bin/ and `dpkg -L` for the open-whispr binary — fixes "Could not find openwhispr in PATH" - Replace YOUR_USERNAME with outis1one in all files - Show detected binary name in summary useful commands https://claude.ai/code/session_01XKYC1basxdwtHy71tky7xm
This commit is contained in:
+56
-13
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
# setup-openwhispr.sh — One-command installer for OpenWhispr on Linux
|
||||
# https://github.com/YOUR_USERNAME/openwhispr-easy-setup
|
||||
# https://github.com/outis1one/openwhispr-easy-setup
|
||||
# License: MIT
|
||||
|
||||
# Do NOT use set -e — we handle errors explicitly
|
||||
@@ -11,6 +11,13 @@ readonly MARKER="# Added by openwhispr-easy-setup"
|
||||
readonly GITHUB_API="https://api.github.com/repos/OpenWhispr/openwhispr/releases/latest"
|
||||
readonly TMP_DIR="/tmp/openwhispr-install"
|
||||
|
||||
# ── Ensure interactive input works when piped (bash <(curl ...)) ──────────────
|
||||
# When run via bash <(curl ...), stdin is the curl stream, not the terminal.
|
||||
# We must read user input from /dev/tty instead.
|
||||
if [[ ! -t 0 ]] && [[ -e /dev/tty ]]; then
|
||||
exec < /dev/tty
|
||||
fi
|
||||
|
||||
# ── Colours & formatting ─────────────────────────────────────────────────────
|
||||
|
||||
if [[ -t 1 ]]; then
|
||||
@@ -565,22 +572,56 @@ OpenWhispr will open now for first-run setup.
|
||||
LAUNCH_INFO
|
||||
|
||||
LAUNCHED=false
|
||||
if command_exists openwhispr; then
|
||||
openwhispr &>/dev/null &
|
||||
LAUNCHED=true
|
||||
elif command_exists open-whispr; then
|
||||
open-whispr &>/dev/null &
|
||||
LAUNCH_CMD=""
|
||||
|
||||
# Check PATH first, then common Electron install locations
|
||||
for cmd in openwhispr open-whispr; do
|
||||
if command_exists "$cmd"; then
|
||||
LAUNCH_CMD="$cmd"
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
# If not in PATH, search common install directories
|
||||
if [[ -z "$LAUNCH_CMD" ]]; then
|
||||
for path in \
|
||||
/opt/OpenWhispr/open-whispr \
|
||||
/opt/open-whispr/open-whispr \
|
||||
/opt/openwhispr/openwhispr \
|
||||
/usr/lib/open-whispr/open-whispr \
|
||||
/usr/lib/openwhispr/openwhispr \
|
||||
/snap/bin/openwhispr \
|
||||
/snap/bin/open-whispr; do
|
||||
if [[ -x "$path" ]]; then
|
||||
LAUNCH_CMD="$path"
|
||||
break
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
# Last resort: ask dpkg where it installed the binary
|
||||
if [[ -z "$LAUNCH_CMD" ]] && command_exists dpkg; then
|
||||
LAUNCH_CMD="$(dpkg -L open-whispr 2>/dev/null | grep -E '/bin/|/opt/' | head -1 || true)"
|
||||
if [[ -n "$LAUNCH_CMD" && ! -x "$LAUNCH_CMD" ]]; then
|
||||
LAUNCH_CMD=""
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ -n "$LAUNCH_CMD" ]]; then
|
||||
"$LAUNCH_CMD" &>/dev/null &
|
||||
LAUNCHED=true
|
||||
fi
|
||||
|
||||
if [[ "$LAUNCHED" == true ]]; then
|
||||
info "OpenWhispr launched in the background."
|
||||
else
|
||||
warn "Could not find openwhispr in PATH."
|
||||
warn "Could not auto-detect OpenWhispr binary location."
|
||||
warn "Try launching manually:"
|
||||
warn " openwhispr"
|
||||
warn " open-whispr"
|
||||
warn " /opt/openwhispr/openwhispr"
|
||||
warn " openwhispr"
|
||||
if command_exists dpkg; then
|
||||
warn " Find it: dpkg -L open-whispr | grep bin"
|
||||
fi
|
||||
fi
|
||||
|
||||
# ══════════════════════════════════════════════════════════════════════════════
|
||||
@@ -594,9 +635,11 @@ divider
|
||||
# shellcheck disable=SC2059
|
||||
printf "${BOLD} OpenWhispr is ready${RESET}\n"
|
||||
divider
|
||||
DISPLAY_CMD="${LAUNCH_CMD:-open-whispr}"
|
||||
DISPLAY_CMD_BASE="$(basename "$DISPLAY_CMD")"
|
||||
cat <<EOF
|
||||
|
||||
Hotkey: backtick (\`) — change in Settings
|
||||
Hotkey: backtick (\`) — change in Settings → Hotkey
|
||||
STT: ${STT_LABEL}
|
||||
AI cleanup: ${CLEANUP_LABEL}
|
||||
|
||||
@@ -604,15 +647,15 @@ cat <<EOF
|
||||
Apply now: source ${BASHRC}
|
||||
|
||||
Useful commands:
|
||||
openwhispr launch the app
|
||||
openwhispr --help show options
|
||||
${DISPLAY_CMD_BASE} launch the app
|
||||
${DISPLAY_CMD_BASE} --help show options
|
||||
|
||||
Settings → Hotkey change your hotkey
|
||||
Settings → Models download better speech models
|
||||
Settings → Processing change STT or AI provider
|
||||
|
||||
Troubleshoot: https://github.com/OpenWhispr/openwhispr/blob/main/TROUBLESHOOTING.md
|
||||
This installer: https://github.com/YOUR_USERNAME/openwhispr-easy-setup
|
||||
This installer: https://github.com/outis1one/openwhispr-easy-setup
|
||||
|
||||
EOF
|
||||
divider
|
||||
|
||||
Reference in New Issue
Block a user