this repo has no description
at main 32 lines 828 B view raw
1#!/usr/bin/env bash 2set -euo pipefail 3 4APP="/Applications/CodexBar.app" 5HELPER="$APP/Contents/Helpers/CodexBarCLI" 6TARGETS=("/usr/local/bin/codexbar" "/opt/homebrew/bin/codexbar") 7 8if [[ ! -x "$HELPER" ]]; then 9 echo "CodexBarCLI helper not found at $HELPER. Please reinstall CodexBar." >&2 10 exit 1 11fi 12 13install_script=$(mktemp) 14cat > "$install_script" <<'EOF' 15#!/usr/bin/env bash 16set -euo pipefail 17HELPER="__HELPER__" 18TARGETS=("/usr/local/bin/codexbar" "/opt/homebrew/bin/codexbar") 19 20for t in "${TARGETS[@]}"; do 21 mkdir -p "$(dirname "$t")" 22 ln -sf "$HELPER" "$t" 23 echo "Linked $t -> $HELPER" 24done 25EOF 26 27perl -pi -e "s#__HELPER__#$HELPER#g" "$install_script" 28 29osascript -e "do shell script \"bash '$install_script'\" with administrator privileges" 30rm -f "$install_script" 31 32echo "CodexBar CLI installed. Try: codexbar usage"