-
Notifications
You must be signed in to change notification settings - Fork 0
/
liberasurecodeCheck.sh
executable file
·55 lines (50 loc) · 1.56 KB
/
liberasurecodeCheck.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
#!/usr/bin/env bash
# Checks to make sure liberasurecode is working before starting SAIO
set -eo pipefail
progress() {
local pid=${1}
while ps -ef | grep $pid >/dev/null 2>&1; do
echo -n "."
sleep .5
done
}
cd ${LIBERASURECODE_DIR} || { echo "ERROR: ${LIBERASURECODE_DIR} not found"; exit 1; }
echo "Checking liberasurecode..."
sleep 3
if ! make test; then
echo ""
echo "liberasurecode test failed... reconfiguring liberasurecode."
echo ""
echo -n "Preparing for build."
sudo make clean >/dev/null 2>&1 || { echo "ERROR: failed to clean liberasurecode"; exit 1; }
progress ${!}
sudo ./autogen.sh >/dev/null 2>&1 || { echo "ERROR: failed to generate configuration fiile"; exit 1; } &
progress ${!}
sudo ./configure >/dev/null 2>&1 || { echo "ERROR: failed to configure liberasurecode"; exit 1; }
progress ${!}
echo "ready"
echo ""
echo -n "Compiling liberasurecode."
sudo make >/dev/null 2>&1 || { echo "ERROR: failed to clean liberasurecode"; exit 1; } &
progress ${!}
echo "done"
echo ""
echo "Testing liberasurecode..."
echo ""
sleep 3
sudo make test || { echo "ERROR: liberasurecode tests failed"; exit 1; }
echo ""
echo "liberasurecode tests passed"
echo ""
echo -n "Installing liberasurecode."
sudo make install >/dev/null 2>&1 || { echo "ERROR: failed to install liberasurecode"; exit 1; } &
progress ${!}
echo "done"
sudo ldconfig
echo "liberasurecode reconfiguration complete."
else
echo ""
echo "liberasurecode: ok"
fi
cd -
exit 0