-
Notifications
You must be signed in to change notification settings - Fork 90
/
Copy pathinstall.sh
executable file
·76 lines (64 loc) · 1.48 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
#!/bin/bash
if [ "$(id -u)" != "0" ]; then
echo "This script must be run as root, i.e 'sudo ./install.sh'" 1>&2
exit 1
fi
# Ensure required libraries are installed
apt satisfy gpiod libgpiod-dev libgtk-3-dev -y 2> /dev/null
if [ $? -ne 0 ]; then
apt install gpiod libgpiod-dev libgtk-3-dev -y
if [ $? -ne 0 ]; then
echo "Error installing required libraries"
exit 1
fi
fi
# Build / install the C library and headers
echo "Building and installing library"
echo
make -C lib all
if [ $? -ne 0 ]; then
echo "Library build failed"
exit 1
fi
make -C lib install
if [ $? -ne 0 ]; then
echo "Library install failed"
exit 1
fi
make -C lib clean
echo
# Build / install tools
echo "Building and installing tools"
echo
make -C tools all
if [ $? -ne 0 ]; then
echo "Tools build failed"
exit 1
fi
make -C tools install
if [ $? -ne 0 ]; then
echo "Tools install failed"
exit 1
fi
make -C tools clean
echo
# Build examples
echo "Building examples"
echo
make -C examples/c all
if [ $? -ne 0 ]; then
echo "Examples build failed"
exit 1
fi
echo
# Read HAT EEPROMs to /etc/mcc/hats
echo "Reading DAQ HAT EEPROMs"
echo
daqhats_read_eeproms
echo
# Turn SPI on (needed for some MCC 118s that had incorrectly programmed EEPROMs)
if [ $(raspi-config nonint get_spi) -eq 1 ]; then
raspi-config nonint do_spi 0
fi
echo "Shared library install complete."
echo "The Python library is not automatically installed. See README.md for instructions to install the Python library."