-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathupdate_wiringpi.sh
executable file
·50 lines (38 loc) · 1.28 KB
/
update_wiringpi.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
source /home/pi/Dexter/lib/Dexter/script_tools/functions_library.sh
PIHOME=/home/pi
DEXTER=Dexter
LIB=lib
# Check if WiringPi Installed and has the latest version. If it does, skip the step.
# Gets the version of wiringPi installed
version=`gpio -v`
# Parses the version to get the number
set -- $version
# Gets the third word parsed out of the first line of gpio -v returned.
# Should be 2.36
WIRINGVERSIONDEC=$3
# Store to temp file
echo $WIRINGVERSIONDEC >> tmpversion
# Remove decimals
VERSION=$(sed 's/\.//g' tmpversion)
# Remove the temp file
delete_file tmpversion
feedback "wiringPi VERSION is $VERSION"
if [ $VERSION -eq '236' ]; then
feedback "FOUND WiringPi Version 2.36 No installation needed."
else
feedback "Did NOT find WiringPi Version 2.36"
# Check if the Dexter directory exists.
create_folder "$PIHOME/$DEXTER"
create_folder "$PIHOME/$DEXTER/$LIB"
# Change directories to Dexter/lib
cd $PIHOME/$DEXTER/$LIB
delete_folder wiringPi
# Install wiringPi
git clone https://github.com/DexterInd/wiringPi/ # Clone directories to Dexter.
cd wiringPi
sudo chmod +x ./build
sudo ./build
feedback "wiringPi Installed"
fi
# End check if WiringPi installed