-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathunifiedremote.sh
More file actions
executable file
·127 lines (105 loc) · 3.26 KB
/
unifiedremote.sh
File metadata and controls
executable file
·127 lines (105 loc) · 3.26 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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
#!/bin/bash
CREDIT="Taz"
echo "🔥 Unified Remote Bluetooth SDP Fix by $CREDIT 🔥"
echo "=================================================="
if [ "$EUID" -ne 0 ]; then
echo "❌ Run as root! Use: sudo bash $0"
exit 1
fi
echo "[*] Stopping bluetooth services..."
systemctl stop urserver 2>/dev/null
systemctl stop sdp-fix 2>/dev/null
systemctl stop bluetooth
echo "[*] Cleaning old overrides..."
rm -rf /etc/systemd/system/bluetooth.service.d/compat.conf 2>/dev/null
rm -rf /etc/systemd/system/bluetooth.service.d/override.conf 2>/dev/null
echo "[*] Creating bluetooth override..."
mkdir -p /etc/systemd/system/bluetooth.service.d
cat > /etc/systemd/system/bluetooth.service.d/99-compat.conf << 'EOF'
[Service]
ExecStart=
ExecStart=/usr/libexec/bluetooth/bluetoothd --compat --noplugin=sap --experimental
EOF
chmod 644 /etc/systemd/system/bluetooth.service.d/99-compat.conf
echo "[+] Override created with --compat flag"
echo "[*] Reloading systemd..."
systemctl daemon-reload
echo "[*] Starting bluetooth..."
systemctl start bluetooth
sleep 3
echo "[*] Checking bluetoothd process..."
BT_PROC=$(ps aux | grep bluetoothd | grep -v grep)
echo "$BT_PROC"
if echo "$BT_PROC" | grep -q "\-\-compat"; then
echo "[✓] --compat flag active!"
else
echo "[✗] --compat not detected! Trying manual start..."
systemctl stop bluetooth
/usr/libexec/bluetooth/bluetoothd --compat --noplugin=sap --experimental &
sleep 2
fi
echo "[*] Waiting for SDP socket..."
sleep 2
echo "[*] Setting SDP permissions..."
if [ -S /var/run/sdp ]; then
chmod 777 /var/run/sdp
echo "[✓] SDP socket found and configured"
elif [ -e /var/run/sdp ]; then
rm -f /var/run/sdp
echo "[!] Removed non-socket SDP file"
else
echo "[!] SDP socket not created"
fi
echo "[*] Testing SDP connection..."
sdptool browse local 2>&1 | head -5
echo ""
echo "[*] Creating Unified Remote service..."
cat > /etc/systemd/system/urserver.service << 'EOF'
[Unit]
Description=Unified Remote Server
After=bluetooth.service
Wants=bluetooth.service
[Service]
Environment="HOME=/opt/urserver"
Type=forking
PIDFile=/opt/urserver/.urserver/urserver.pid
ExecStartPre=/bin/sleep 3
ExecStartPre=/bin/bash -c 'while [ ! -S /var/run/sdp ]; do sleep 1; done; chmod 777 /var/run/sdp'
ExecStart=/opt/urserver/urserver-start --no-manager --no-notify
ExecStop=/opt/urserver/urserver-stop
Restart=on-failure
RestartSec=10s
[Install]
WantedBy=multi-user.target
EOF
chmod 644 /etc/systemd/system/urserver.service
systemctl daemon-reload
echo "[*] Starting Unified Remote..."
systemctl enable urserver
systemctl start urserver
sleep 2
echo ""
echo "=========================================="
echo "🔥 Status Check 🔥"
echo "=========================================="
echo ""
echo "Bluetooth Process:"
ps aux | grep bluetoothd | grep -v grep
echo ""
echo "SDP Socket:"
ls -la /var/run/sdp 2>/dev/null || echo "NOT FOUND"
echo ""
echo "SDP Test:"
timeout 3 sdptool browse local 2>&1 || echo "SDP Connection failed"
echo ""
echo "Services:"
systemctl is-active bluetooth
systemctl is-active urserver
echo ""
echo "=========================================="
echo "Web Interface: http://localhost:9510/web/"
echo ""
echo "Manual test command:"
echo " sudo /usr/libexec/bluetooth/bluetoothd --compat -n -d"
echo ""
echo "Done by $CREDIT 🔥"