forked from doches/progressbar
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall
77 lines (58 loc) · 1.43 KB
/
install
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
77
#!/bin/bash
URL=https://raw.githubusercontent.com/limix/progressbar/master/VERSION
VERSION=$(curl -s $URL)
echo "[_/_] Library(progressbar==$VERSION)"
rm /tmp/progressbar.XXXX.log >/dev/null 2>&1 || true
logfile=$(mktemp /tmp/progressbar.XXXX.log)
exec 3>"$logfile"
function silent_run
{
eval "$@ >&3 2>&1"
}
function silent_trun
{
eval "$@ >&3 2>&1 || true"
}
function do_then_sudo
{
eval "$@"
if [ $? != 0 ]; then
eval "sudo $@"
fi
}
function failed
{
echo "FAILED."
echo "[_/_] LOG OUTPUT:"
cat $logfile
exit 1
}
FILE=progressbar-$VERSION.tar.gz
DIR=progressbar-$VERSION
URL=https://github.com/limix/progressbar/archive/$VERSION.tar.gz
silent_trun rm $FILE
silent_trun rm -rf $DIR
echo -n "[1/5] Downloading... "
silent_run curl -o $FILE -L $URL
[ $? == 0 ] && echo "done." || failed
tar xzf $FILE && cd $DIR
mkdir build && cd build
echo -n "[2/5] Configuring... "
silent_run cmake ..
[ $? == 0 ] && echo "done." || failed
echo -n "[3/5] Compiling... "
silent_run make
[ $? == 0 ] && echo "done." || failed
echo -n "[4/5] Testing... "
silent_run make test
[ $? == 0 ] && echo "done." || failed
echo -n "[5/5] Installing... "
silent_run do_then_sudo make install
[ $? == 0 ] && echo "done." || failed
cd .. && cd ..
silent_trun rm progressbar-$VERSION.tar.gz
silent_trun rm -rf progressbar-$VERSION
if type "ldconfig" >/dev/null 2>&1; then
silent_run do_then_sudo ldconfig
fi
rm "$logfile" || true