diff --git a/tools/create-macos-launchagent.sh b/tools/create-macos-launchagent.sh index 4af93d89..7058de37 100755 --- a/tools/create-macos-launchagent.sh +++ b/tools/create-macos-launchagent.sh @@ -2,11 +2,11 @@ # Helper to install a LaunchAgent for Solaar to keep it running in the background. set -euo pipefail -SOLAR_PATH=${SOLAR_PATH:-/opt/homebrew/bin/solaar} - -if [[ ! -x "${SOLAR_PATH}" ]]; then - echo "Error: Unable to execute ${SOLAR_PATH}. Set SOLAR_PATH to the solaar binary." >&2 - exit 1 +SOLAAR_PATH=${SOLAAR_PATH:-solaar} +SOLAAR_RESOLVED_PATH=$(command -v "${SOLAAR_PATH}" 2>/dev/null || echo "") +if [ -z "${SOLAAR_RESOLVED_PATH}" ]; then + echo "Warning: '${SOLAAR_PATH}' not found" >&2 + SOLAAR_RESOLVED_PATH="${SOLAAR_PATH}" fi LAUNCH_AGENT_DIR="${HOME}/Library/LaunchAgents" @@ -28,7 +28,7 @@ cat > "${LAUNCH_AGENT_PLIST}" <io.github.pwr-solaar.solaar ProgramArguments - ${SOLAR_PATH} + ${SOLAAR_PATH} --window=hide RunAtLoad