-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathinstall.sh
executable file
·50 lines (38 loc) · 1 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
#!/bin/bash
echo "fpvlaptracker raspbian install v1.0"
echo
if [[ $EUID -ne 0 ]]; then
echo "this script must be run as root"
exit 1
fi
if [[ $# -eq 0 ]]; then
echo "usage: $0 <version>"
echo " version - version you want to install, e.g. 1.0.5"
exit
fi
VERSION=$1
mkdir -p /home/pi/fpvlaptracker
cd /home/pi/fpvlaptracker
wget https://github.com/warhog/fpvlaptracker/releases/download/${VERSION}/fpvlaptracker-${VERSION}.zip
if [[ $? -ne 0 ]]; then
echo "failed to download"
exit 1
fi
unzip -o fpvlaptracker-${VERSION}.zip
if [[ $? -ne 0 ]]; then
echo "failed to unzip"
exit 1
fi
rm fpvlaptracker-${VERSION}.zip
chmod +x fpvlaptracker-${VERSION}.jar
sed -i "s/0.0.0/${VERSION}/g" fpvlaptracker.service
cp fpvlaptracker.service /lib/systemd/system/
chown 644 /lib/systemd/system/fpvlaptracker.service
systemctl daemon-reload
systemctl enable fpvlaptracker.service
if [[ $? -ne 0 ]]; then
echo "failed to enable service"
exit 1
fi
echo
echo "installation done, please reboot"