forked from ToninoTarsi/swpi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathswpi-update.sh
76 lines (57 loc) · 1.25 KB
/
swpi-update.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
#! /bin/bash
echo $1
if [ $# -eq 0 ]
then
echo "No arguments supplied"
theurl="http://www.vololiberomontecucco.it/swpi/swpi-src.tar.gz"
thefile="swpi-src.tar.gz"
else
echo "arguments supplied"
theurl="http://www.vololiberomontecucco.it/swpi/swpi_"
theurl+=$1
theurl+=.tar.gz
thefile="swpi_"
thefile+=$1
thefile+=.tar.gz
fi
echo $theurl
test=`awk '$4~/(^|,)ro($|,)/' /proc/mounts | grep /dev/root`
if [ -z "$test" ]
then
ro=0
else
ro=1
echo "Mounting in rw"
sudo mount / -o remount,rw
fi
sudo mount / -o remount,rw
cd /home/pi/swpi
sudo chown -R pi /home/pi/swpi
sudo chown pi ./DHT
sudo chown pi ./mcp3002
sudo chown pi ./TX23
sudo chown pi ./wh1080_rf
cd /home/pi/
wget $theurl
tar -xvf $thefile
rm $thefile
cd swpi
echo "Changing permissions"
sudo chmod +x ./usbreset
sudo chmod +x ./wifi_reset.sh
sudo chmod +x ./swpi.sh
sudo chmod +x ./swpi-update.sh
sudo chmod +x ./killswpi.sh
sudo chmod +x ./restore.sh
sudo chmod +x ./backup.sh
sudo chmod +x ./DHT/DHT
sudo chmod +x ./DHT/DHT_rf
sudo chmod +x ./wh1080_rf/wh1080_rf
sudo chmod +x ./wh1080_rf/spi_init
sudo chmod +x ./mcp3002/atod
sudo chmod +x ./mcp3002/libMCP3002.so
sudo chmod 755 ./swpi.py
if [ $ro = 1 ] ; then
echo "Mounting in ro"
sudo mount / -o remount,ro
fi