-
Notifications
You must be signed in to change notification settings - Fork 3
/
preinstall
executable file
·53 lines (48 loc) · 1.2 KB
/
preinstall
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
#!/bin/bash
echo -n "Check for package libgpiod-dev and install if needed..."
if [ `apt list --installed libgpiod-dev 2>/dev/null | grep -c libgpiod-dev` -lt 1 ]
then
echo "missing"
echo "Installing missing package libgpiod-dev..."
sudo apt -y update && sudo apt -y install libgpiod-dev
if [ $? -gt 0 ]
then
echo "failed"
exit 1
else
echo "done"
fi
else
echo "Skipping. Already installed."
fi
echo -n "Check for package gpiod and install if needed..."
if [ `apt list --installed gpiod 2>/dev/null | grep -c gpiod` -lt 1 ]
then
echo "missing"
echo "Installing missing package gpiod..."
sudo apt -y update && sudo apt -y install gpiod
if [ $? -gt 0 ]
then
echo "failed"
exit 1
else
echo "done"
fi
else
echo "Skipping. Already installed."
fi
echo "Calling converter script to gather info about the gpio chips, lines and names..."
/bin/env 1>/dev/null 2>/dev/null
if [ $? -gt 0 ]
then
python3 ./convertGpioInfo2Json.py
else
./convertGpioInfo2Json.py
fi
if [ $? -gt 0 ]
then
echo "Failed to convert info of gpioinfo command. Aborting"
exit 1
else
echo "Got the info we need and got it converted."
fi