-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall
120 lines (115 loc) · 2.23 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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
#!/bin/bash
{
if ! type -- make &>/dev/null; then
echo "install: please install: coreutils build-essential" 1>&2
exit 1
fi
case "${UID:-"1000"}" in
0)
:
;;
*)
echo "install: please run as: root" 1>&2
exit 1
;;
esac
function keyboard_interrupt() {
exec 2>/dev/null
printf -- '\n'
exec >/dev/null
exit 130
}
if [[ -d "${0%"/"*}" ]]; then
if cd -- "${0%"/"*}"; then
src="${PWD}/src/"
dir="${PWD}/lib/"
else
exit 1
fi
else
src="${PWD}/src/"
dir="${PWD}/lib/"
fi
if ! [[ -d "${dir}" ]]; then
echo "${app}: please run: build" 1>&2
exit 1
fi
trap -- 'keyboard_interrupt' INT
app="${0##*"/"}"
code=0
set +H -uo pipefail
shopt -s -- extglob
shopt -s -- globstar
if [[ -d "${src}/bash-completion/completions" ]]; then
if [[ -d "/usr/share/bash-completion/completions/" ]]; then
if mkdir -p -- "/usr/local/share/bash-completion/completions/"; then
if cp -- "${src}/bash-completion/completions/"*"sum" "/usr/local/share/bash-completion/completions/"; then
echo "install: bash-completions are in: /usr/local/share/bash-completion/completions/"
else
code=1
fi
else
code=1
fi
fi
fi
if [[ -e "${src}/blake3/blake3" ]]; then
if cp -- "${src}/b3sum" "${src}/blake3/blake3" "/usr/local/bin/"; then
if chmod +x -- "/usr/local/bin/blake3"; then
echo "install: blake3 is in: /usr/local/bin/"
else
rm -- "/usr/local/bin/blake3"
code=1
fi
else
code=1
fi
fi
if [[ -e "${src}/crc32/crc32" ]]; then
if cp -- "${src}/crc32/crc32" "/usr/local/bin/"; then
if chmod +x -- "/usr/local/bin/crc32"; then
echo "install: crc32 is in: /usr/local/bin/"
else
rm -- "/usr/local/bin/crc32"
code=1
fi
else
code=1
fi
fi
for sum in "${src}/adler32" "${src}/"*"sum"; do
case "${sum##*"/"}" in
"b3sum")
continue
;;
esac
if cp -- "${sum}" "/usr/local/bin/"; then
if chmod +x -- "/usr/local/bin/${sum##*"/"}"; then
echo "install: ${sum##*"/"} is in: /usr/local/bin/"
else
rm -- "/usr/local/bin/${sum##*"/"}"
code=1
fi
else
code=1
fi
done
for perl in "${dir}digest-"*"-"*; do
if cd -- "${perl}"; then
if ! make install; then
code=1
fi
else
code=1
fi
done
case "${code:-"0"}" in
0)
echo "install: final status: OK"
;;
1)
echo "install: final status: FAILED"
;;
esac
exit "${code:-"0"}"
}