Repository navigation
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·91 lines (78 loc) · 2.32 KB
/
Copy pathinstall.sh
File metadata and controls
executable file
·91 lines (78 loc) · 2.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#!/bin/bash
# Install script for Watch Unlock Linux
set -e
INSTALL_DIR="/opt/watch-unlock-linux"
SERVICE_FILE="/etc/systemd/system/apple-watch-unlock.service"
CONFIG_DIR="/etc/watch-unlock-linux"
IRK_FILE="$CONFIG_DIR/irk"
echo "Watch Unlock Linux - Installer"
echo "==============================="
echo ""
# Check root
if [ "$EUID" -ne 0 ]; then
echo "Please run as root: sudo ./install.sh"
exit 1
fi
# Check dependencies
echo "[1/6] Checking dependencies..."
if ! command -v python3 &> /dev/null; then
echo "ERROR: python3 not found. Install with: sudo apt install python3"
exit 1
fi
if ! python3 -c "import cryptography" 2>/dev/null; then
if command -v apt-get &> /dev/null; then
echo "Installing python3-cryptography..."
apt-get install -y python3-cryptography
else
echo "ERROR: python3-cryptography not found. Install it with your package manager."
exit 1
fi
fi
if ! command -v btmon &> /dev/null; then
echo "ERROR: btmon not found. Install with: sudo apt install bluez"
exit 1
fi
# Create install directory
echo "[2/6] Installing to $INSTALL_DIR..."
mkdir -p "$INSTALL_DIR"
cp unlock_daemon.py "$INSTALL_DIR/"
cp debug_rssi.py "$INSTALL_DIR/"
chmod +x "$INSTALL_DIR/unlock_daemon.py" "$INSTALL_DIR/debug_rssi.py"
# Setup config
echo "[3/6] Setting up config..."
mkdir -p "$CONFIG_DIR"
chmod 700 "$CONFIG_DIR"
if [ ! -f "$IRK_FILE" ]; then
echo "YOUR_IRK_HEX" > "$IRK_FILE"
fi
chmod 600 "$IRK_FILE"
chown root:root "$IRK_FILE"
# Install service
echo "[4/6] Installing systemd service..."
cp apple-watch-unlock.service "$SERVICE_FILE"
# Detect Bluetooth adapter
echo "[5/6] Detecting Bluetooth adapter..."
HCI_DEV=$(hciconfig | grep -o "hci[0-9]" | head -1)
if [ -z "$HCI_DEV" ]; then
HCI_DEV="hci0"
echo "WARNING: No Bluetooth adapter found, using $HCI_DEV"
else
echo "Found: $HCI_DEV"
sed -i "s/hci0/$HCI_DEV/g" "$SERVICE_FILE"
fi
# Reload systemd
echo "[6/6] Reloading systemd..."
systemctl daemon-reload
echo ""
echo "Installation complete!"
echo ""
echo "Next steps:"
echo " 1. Edit $IRK_FILE"
echo " Set your IRK hex value"
echo ""
echo " 2. Start the service:"
echo " sudo systemctl enable --now apple-watch-unlock"
echo ""
echo " 3. Check status:"
echo " sudo systemctl status apple-watch-unlock"
echo " sudo journalctl -u apple-watch-unlock -f"