-
Notifications
You must be signed in to change notification settings - Fork 0
/
check-scripts.sh
executable file
·66 lines (56 loc) · 1.22 KB
/
check-scripts.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
#!/bin/bash -efu
bindirs=SCRIPTDIR
bindirs="$bindirs:bootchain-core/data/sbin"
bindirs="$bindirs:bootchain-core/data/bin"
bindirs="$bindirs:bootchain-altboot/data/bin"
bindirs="$bindirs:bootchain-interactive/data/bin"
bindirs="$bindirs:bootchain-localdev/data/bin"
bindirs="$bindirs:bootchain-waitnet/data/bin"
sclist="
SC1003
SC1090
SC1091
SC2004
SC2006
SC2015
SC2034
SC2086
SC2154
SC2317
"
skip_check="
bootchain-doc/samples/80-make-initrd-for-pipeline
"
do_check()
{
local fname ftype nc
# shellcheck disable=SC2035
( set +f; find *.sh bootchain-* -type f ) |
grep -v bootchain-doc/altboot-mixed/ |
while read -r fname; do
ftype="$(file -b -- "$fname")"
[ -z "${ftype##*shell script*}" ] ||
continue
for nc in $skip_check _; do
[ "x$nc" != x_ ] ||
continue
[ "x$nc" != "x$fname" ] ||
continue 2
done
shellcheck --norc -s bash -P "$bindirs" "$@" -x "$fname" || :> ERROR
done
if [ -f ERROR ]; then
rm -f ERROR
return 1
fi
}
excludes=
for e in $sclist; do
excludes="${excludes:+$excludes,}$e"
if [ "${1-}" = "-v" ] || [ "${1-}" = "--verbose" ]; then
printf "*** Checking to %s...\n" "$e"
do_check -i "$e" ||:
fi
done
printf "*** Checking with all excludes...\n"
do_check -e "$excludes"