blob: 8358baff862d05dbcad0c286356611aacf30339b (
plain)
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
|
#!/usr/bin/env bash
curr_year=$(date +%Y || exit 1)
line() {
head -n "$1" | tail -n 1
}
check() {
local file="$1"
local line="$2"
local mtch="$3"
local desc="$4"
cat "$file" | line "$line" | grep "$mtch" 2>/dev/null >/dev/null || {
echo "[LICENSE ERROR]: '$desc' is missing or wrong in '$file'"
return 1
}
}
find lib bin -name "*.rs" -type f | grep -v target | while read filename; do
check "$filename" 2 \
"imag - the personal information management suite for the commandline" \
"Description line" \
|| exit 1
check "$filename" 3 \
"Copyright (C) 2015-${curr_year}" \
"Copyright name" \
|| exit 1
check "$filename" 5 \
"This library is free software" \
"License" \
|| exit 1
echo "[LICENSE OK]: $filename"
done
|