-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathinstall.sh
executable file
·85 lines (67 loc) · 2.54 KB
/
install.sh
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
#!/bin/bash
sudo apt update
sudo apt install -y nginx sox libsox-fmt-mp3 rws ffmpeg gstreamer1.0-plugins-good gstreamer1.0-tools
sudo cp /etc/nginx/sites-available/default /etc/nginx/sites-available/default.bak
sudo cp etc/nginx.conf /etc/nginx/sites-available/default
sudo cp etc/car.service /etc/systemd/system/
sudo cp -r etc/rpi-car-control /etc/
sudo systemctl enable nginx.service
sudo systemctl restart nginx.service
sudo systemctl enable car.service
sudo apt install -y ansible
if [ ! -f ~/.ssh/id_rsa.pub ]
then
ssh-keygen -q -N "" -f ~/.ssh/id_rsa
fi
if [ -f ~/.ssh/authorized_keys ]
then
mv ~/.ssh/authorized_keys ~/.ssh/authorized_keys.bak
fi
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
chmod 600 ~/.ssh/authorized_keys
ssh -o "StrictHostKeyChecking no" localhost echo "Added localhost to .ssh/known_hosts" 2>/dev/null
ansible-playbook -i localhost, raspbian-python3.6.yml
if [ -f ~/.ssh/authorized_keys.bak ]
then
mv ~/.ssh/authorized_keys.bak ~/.ssh/authorized_keys
else
rm ~/.ssh/authorized_keys
fi
sudo pip3.6 install --upgrade pip setuptools wheel
sudo pip3.6 install rpi.gpio
sudo pip3.6 install websockets
sudo pip3.6 install smbus2
sudo pip3.6 install vl53l1x
sudo pip3.6 install Adafruit_DHT
(
# Install Rust
curl https://sh.rustup.rs -sSf | sh
. ~/.cargo/env
# Clone the raspivid_mjpeg_server repo and build and install the server
git clone https://github.com/kig/raspivid_mjpeg_server
cd raspivid_mjpeg_server
echo "Building raspivid_mjpeg_server. This is going to take forever (15 minutes on Raspberry Pi 3B+) so do some pushups in the meanwhile."
cargo build --release
cp target/release/raspivid_mjpeg_server ../bin/
)
sudo mkdir -p /opt/rpi-car-control
sudo cp -r bin control html sensors video web_server run.sh /opt/rpi-car-control
echo "The car is installed"
echo
echo "For rproxy SSH server:"
echo "----------------------"
echo 'export RPROXY=my.rproxy.server'
echo 'ssh $RPROXY -- "sudo useradd car -s /bin/false"; sudo mkdir ~car/.ssh; sudo touch ~car/.ssh/authorized_keys; sudo chmod -R go-rwx ~car/.ssh'
echo 'ssh $RPROXY -- "cat >> sudo tee ~car/.ssh/authorized_keys" < ~/.ssh/id_rsa.pub'
echo 'ssh $RPROXY -- "sudo tee /etc/sshd_config" < etc/sshd_config'
echo
echo 'After starting the car server, you can now connect to the car at http://$RPROXY:9999/car/'
echo 'For HTTPS and authentication, set up an nginx reverse proxy on $RPROXY (see etc/remote_nginx.conf)'
echo
echo "To start the car server"
echo "-----------------------"
echo "sudo systemctl start car"
echo
echo "Open http://raspberrypi/car/"
echo
exit