-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrunFor_T4.sh
More file actions
56 lines (55 loc) · 1.97 KB
/
Copy pathrunFor_T4.sh
File metadata and controls
56 lines (55 loc) · 1.97 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
#!/bin/bash
log() {
now="`date '+%Y-%m-%d %H:%M:%S.%3N'`";
printf -v now "[%s %s]" $now
echo "${now} ${@}"
}
cd ~
wget https://w1.fi/cgit/hostap/plain/hostapd/hostapd.conf
sudo cp hostapd.conf /etc/hostapd/hostapd.conf
sudo systemctl restart hostapd
rm hostapd.conf
cd ~/blueServer
log "複製dbus-org.bluez.service設定檔"
sudo cp dbus-org.bluez.service /etc/systemd/system/dbus-org.bluez.service
log "將時區更新為 /亞洲/台北"
sudo cp /usr/share/zoneinfo/Asia/Taipei /etc/localtime
log "取得最新軟體清單"
sudo apt-get update;wait
log "安裝基本組件"
sudo apt-get -y install ntpdate curl software-properties-common
sudo ntpdate tick.stdtime.gov.tw;wait
log "安裝 apt-fast..."
sudo add-apt-repository ppa:apt-fast/stable -y;wait
sudo apt-get update
sudo apt-get -y install apt-fast;wait
log "apt-fast 安裝完成"
log "開始安裝主要元件,這需費時較久,請稍後。"
sudo apt-fast -y install build-essential cmake pkg-config cmake automake autoconf autotools-dev fswebcam unzip p7zip-full locate libbluetooth-dev libopenobex* python-pip libusb-dev libdbus-1-dev libglib2.0-dev libudev-dev libical-dev libreadline-dev bluez-tools;wait
log "主要元件安裝完成"
log "開始克隆必要的python程式庫"
cd ~/
git clone https://github.com/0-1-0/lightblue-0.4.git ~/lightblue-0.4;wait
cd ~/lightblue-0.4
sudo -H python setup.py install;wait
log "重啟藍芽服務中"
sudo sed -i 's/^#IdleTimeout=.*/IdleTimeout=0/' /etc/bluetooth/input.conf
sudo systemctl daemon-reload
sudo systemctl restart bluetooth
log "重啟藍芽裝置"
sudo hciconfig hci0 up
log "藍芽重啟成功"
log "變更Service Discovery Protocol(SDP)執行權限"
sudo chmod 777 /var/run/sdp
log "開始使用pip安裝必要的python程式庫"
sudo -H python -m pip install pybluez
#sudo /usr/bin/sdptool add sp
log "設定藍芽可被偵測、配對"
sudo bluetoothctl <<EOF
power on
discoverable on
pairable on
agent NoInputNoOutput
default-agent
EOF
log "可以跑該死的藍芽序列伺服器了"