Add Joplin, old Mac, and Fedora WiFi runbooks; simplify JA3 Whisky scripts and hotspot recovery.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
76
docs/old_mac/scripts/send-to-fedora-bluetooth.sh
Executable file
76
docs/old_mac/scripts/send-to-fedora-bluetooth.sh
Executable file
@@ -0,0 +1,76 @@
|
||||
#!/usr/bin/env bash
|
||||
# Отправить файл на Fedora MacBook по Bluetooth (с этого Mac).
|
||||
#
|
||||
# Порядок:
|
||||
# 1. FEDORA: Blueman → «Принять файл» (диалог «Ожидание…»)
|
||||
# 2. MAC: bash send-to-fedora-bluetooth.sh [файл] [устройство]
|
||||
# 3. MAC: Bluetooth File Exchange → fedora → Send
|
||||
#
|
||||
# Примеры:
|
||||
# bash docs/old_mac/scripts/send-to-fedora-bluetooth.sh
|
||||
# bash docs/old_mac/scripts/send-to-fedora-bluetooth.sh ~/Desktop/foo.tar.gz
|
||||
# bash docs/old_mac/scripts/send-to-fedora-bluetooth.sh foo.tar.gz fedora
|
||||
set -euo pipefail
|
||||
|
||||
OLD_MAC="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
DEFAULT_ARCHIVE="$OLD_MAC/deliverable/fedora-bcm4322-wifi-fix.tar.gz"
|
||||
DEFAULT_DEVICE="fedora"
|
||||
BFX="/System/Library/CoreServices/Bluetooth File Exchange.app"
|
||||
|
||||
die() { printf 'error: %s\n' "$*" >&2; exit 1; }
|
||||
|
||||
usage() {
|
||||
cat <<EOF
|
||||
usage: $0 [файл] [устройство_bluetooth]
|
||||
|
||||
файл путь к отправляемому файлу (по умолчанию: delivery-архив Wi-Fi fix)
|
||||
устройство имя BT-устройства Fedora (по умолчанию: fedora)
|
||||
|
||||
Перед запуском на Fedora: Blueman → «Принять файл».
|
||||
См. docs/old_mac/BLUETOOTH_FILE_TRANSFER.md
|
||||
EOF
|
||||
}
|
||||
|
||||
FILE=""
|
||||
DEVICE="$DEFAULT_DEVICE"
|
||||
|
||||
case $# in
|
||||
0) FILE="$DEFAULT_ARCHIVE" ;;
|
||||
1)
|
||||
if [ "$1" = "-h" ] || [ "$1" = "--help" ]; then usage; exit 0; fi
|
||||
if [ -f "$1" ]; then
|
||||
FILE="$1"
|
||||
else
|
||||
FILE="$DEFAULT_ARCHIVE"
|
||||
DEVICE="$1"
|
||||
fi
|
||||
;;
|
||||
2)
|
||||
[ -f "$1" ] || die "файл не найден: $1"
|
||||
FILE="$1"
|
||||
DEVICE="$2"
|
||||
;;
|
||||
*) usage; exit 1 ;;
|
||||
esac
|
||||
|
||||
[ -f "$FILE" ] || die "файл не найден: $FILE"
|
||||
[ -d "$BFX" ] || BFX="/System/Applications/Utilities/Bluetooth File Exchange.app"
|
||||
[ -d "$BFX" ] || die "Bluetooth File Exchange не найден"
|
||||
|
||||
MAC_BT="$(system_profiler SPBluetoothDataType 2>/dev/null || true)"
|
||||
if ! printf '%s\n' "$MAC_BT" | grep -A1 "Connected:" | grep -qi "$DEVICE"; then
|
||||
die "«$DEVICE» не в Connected. На Fedora: Bluetooth on, Trust этого Mac."
|
||||
fi
|
||||
|
||||
printf '\n=== Отправка по Bluetooth ===\n\n'
|
||||
printf 'СНАЧАЛА на Fedora: Blueman → «Принять файл».\n'
|
||||
printf 'Без этого диалог приёма НЕ появится.\n\n'
|
||||
printf 'Файл : %s (%s bytes)\n' "$FILE" "$(stat -f%z "$FILE" 2>/dev/null || stat -c%s "$FILE")"
|
||||
printf 'Куда : %s\n\n' "$DEVICE"
|
||||
printf 'Открываю Bluetooth File Exchange → выберите «%s» → Send.\n\n' "$DEVICE"
|
||||
|
||||
killall "Bluetooth File Exchange" 2>/dev/null || true
|
||||
sleep 0.5
|
||||
open -a "Bluetooth File Exchange" "$FILE"
|
||||
|
||||
printf 'Готово. Подтвердите отправку в окне Bluetooth File Exchange.\n'
|
||||
Reference in New Issue
Block a user