1
- #! /usr/ bin/env bash
1
+ #! /bin/sh
2
2
3
3
set -e
4
4
5
- rootdir=" $( CDPATH= cd " $( dirname " ${BASH_SOURCE[0]} " ) /.." && pwd) "
5
+ rootdir=" $( CDPATH=' ' cd " $( dirname " $0 " ) /.." && pwd) "
6
6
licensefile=" ${rootdir} /LICENSE"
7
- licensehead=" $( sed ' /^- /,$d' ${licensefile} ) "
7
+ licensehead=" $( sed ' /^- /,$d' " ${licensefile} " ) "
8
8
tmplicense=" ${rootdir} /~LICENSE.$$ "
9
- echo -e " $licensehead " > $tmplicense
9
+ echo " $licensehead " > " $tmplicense "
10
10
11
11
12
12
# addlicense <library> <location> <license text>
13
- function addlicense {
13
+ addlicense () {
14
14
15
15
echo "
16
16
- ${1} , located at ${2} , is licensed as follows:
17
17
\"\"\"
18
- $( echo -e " $3 " | sed -e ' s/^/ /' -e ' s/^ $//' -e ' s/ *$//' | sed -e ' /./,$!d' | sed -e ' /^$/N;/^\n$/D' )
18
+ $( echo " $3 " | sed -e ' s/^/ /' -e ' s/^ $//' -e ' s/ *$//' | sed -e ' /./,$!d' | sed -e ' /^$/N;/^\n$/D' )
19
19
\"\"\"\
20
- " >> $tmplicense
20
+ " >> " $tmplicense "
21
21
22
22
}
23
23
29
29
30
30
31
31
# Dependencies bundled in distributions
32
- addlicense " Acorn" " deps/acorn" " $( cat ${rootdir} /deps/acorn/acorn/LICENSE) "
33
- addlicense " Acorn plugins" " deps/acorn-plugins" " $( cat ${rootdir} /deps/acorn-plugins/acorn-class-fields/LICENSE) "
34
- addlicense " c-ares" " deps/cares" " $( tail -n +3 ${rootdir} /deps/cares/LICENSE.md) "
35
- addlicense " cjs-module-lexer" " deps/cjs-module-lexer" " $( cat ${rootdir} /deps/cjs-module-lexer/LICENSE) "
32
+ addlicense " Acorn" " deps/acorn" " $( cat " ${rootdir} " /deps/acorn/acorn/LICENSE) "
33
+ addlicense " Acorn plugins" " deps/acorn-plugins" " $( cat " ${rootdir} " /deps/acorn-plugins/acorn-class-fields/LICENSE) "
34
+ addlicense " c-ares" " deps/cares" " $( tail -n +3 " ${rootdir} " /deps/cares/LICENSE.md) "
35
+ addlicense " cjs-module-lexer" " deps/cjs-module-lexer" " $( cat " ${rootdir} " /deps/cjs-module-lexer/LICENSE) "
36
36
if [ -f " ${rootdir} /deps/icu/LICENSE" ]; then
37
37
# ICU 57 and following. Drop the BOM
38
38
addlicense " ICU" " deps/icu" \
39
39
" $( sed -e ' 1s/^[^a-zA-Z ]*ICU/ICU/' -e :a \
40
- -e ' s/<[^>]*>//g;s/ / /g;s/ +$//;/</N;//ba' ${rootdir} /deps/icu/LICENSE) "
40
+ -e ' s/<[^>]*>//g;s/ / /g;s/ +$//;/</N;//ba' " ${rootdir} " /deps/icu/LICENSE) "
41
41
elif [ -f " ${rootdir} /deps/icu/license.html" ]; then
42
42
# ICU 56 and prior
43
43
addlicense " ICU" " deps/icu" \
44
44
" $( sed -e ' 1,/ICU License - ICU 1\.8\.1 and later/d' -e :a \
45
- -e ' s/<[^>]*>//g;s/ / /g;s/ +$//;/</N;//ba' ${rootdir} /deps/icu/license.html) "
45
+ -e ' s/<[^>]*>//g;s/ / /g;s/ +$//;/</N;//ba' " ${rootdir} " /deps/icu/license.html) "
46
46
elif [ -f " ${rootdir} /deps/icu-small/LICENSE" ]; then
47
47
# ICU 57 and following. Drop the BOM
48
48
addlicense " ICU" " deps/icu-small" \
49
49
" $( sed -e ' 1s/^[^a-zA-Z ]*ICU/ICU/' -e :a \
50
- -e ' s/<[^>]*>//g;s/ / /g;s/ +$//;/</N;//ba' ${rootdir} /deps/icu-small/LICENSE) "
50
+ -e ' s/<[^>]*>//g;s/ / /g;s/ +$//;/</N;//ba' " ${rootdir} " /deps/icu-small/LICENSE) "
51
51
elif [ -f " ${rootdir} /deps/icu-small/license.html" ]; then
52
52
# ICU 56 and prior
53
53
addlicense " ICU" " deps/icu-small" \
54
54
" $( sed -e ' 1,/ICU License - ICU 1\.8\.1 and later/d' -e :a \
55
- -e ' s/<[^>]*>//g;s/ / /g;s/ +$//;/</N;//ba' ${rootdir} /deps/icu-small/license.html) "
55
+ -e ' s/<[^>]*>//g;s/ / /g;s/ +$//;/</N;//ba' " ${rootdir} " /deps/icu-small/license.html) "
56
56
else
57
57
echo " Could not find an ICU license file."
58
58
exit 1
59
59
fi
60
60
61
- addlicense " libuv" " deps/uv" " $( cat ${rootdir} /deps/uv/LICENSE) "
61
+ addlicense " libuv" " deps/uv" " $( cat " ${rootdir} " /deps/uv/LICENSE) "
62
62
addlicense " llhttp" " deps/llhttp" " $( cat deps/llhttp/LICENSE-MIT) "
63
63
addlicense " OpenSSL" " deps/openssl" \
64
- " $( sed -e ' /^ \*\/$/,$d' -e ' /^ [^*].*$/d' -e ' /\/\*.*$/d' -e ' /^$/d' -e ' s/^[/ ]\* *//' ${rootdir} /deps/openssl/openssl/LICENSE) "
64
+ " $( sed -e ' /^ \*\/$/,$d' -e ' /^ [^*].*$/d' -e ' /\/\*.*$/d' -e ' /^$/d' -e ' s/^[/ ]\* *//' " ${rootdir} " /deps/openssl/openssl/LICENSE) "
65
65
addlicense " Punycode.js" " lib/punycode.js" \
66
66
" $( curl -sL https://raw.githubusercontent.com/bestiejs/punycode.js/master/LICENSE-MIT.txt) "
67
- addlicense " V8" " deps/v8" " $( cat ${rootdir} /deps/v8/LICENSE) "
67
+ addlicense " V8" " deps/v8" " $( cat " ${rootdir} " /deps/v8/LICENSE) "
68
68
addlicense " SipHash" " deps/v8/src/third_party/siphash" \
69
69
" $( sed -e ' /You should have received a copy of the CC0/,$d' -e ' s/^\/\* *//' -e ' s/^ \* *//' deps/v8/src/third_party/siphash/halfsiphash.cc) "
70
70
addlicense " zlib" " deps/zlib" \
71
- " $( sed -e ' /The data format used by the zlib library/,$d' -e ' s/^\/\* *//' -e ' s/^ *//' ${rootdir} /deps/zlib/zlib.h) "
71
+ " $( sed -e ' /The data format used by the zlib library/,$d' -e ' s/^\/\* *//' -e ' s/^ *//' " ${rootdir} " /deps/zlib/zlib.h) "
72
72
73
73
# npm
74
- addlicense " npm" " deps/npm" " $( cat ${rootdir} /deps/npm/LICENSE) "
74
+ addlicense " npm" " deps/npm" " $( cat " ${rootdir} " /deps/npm/LICENSE) "
75
75
76
76
# Build tools
77
- addlicense " GYP" " tools/gyp" " $( cat ${rootdir} /tools/gyp/LICENSE) "
78
- addlicense " inspector_protocol" " tools/inspector_protocol" " $( cat ${rootdir} /tools/inspector_protocol/LICENSE) "
79
- addlicense " jinja2" " tools/inspector_protocol/jinja2" " $( cat ${rootdir} /tools/inspector_protocol/jinja2/LICENSE) "
80
- addlicense " markupsafe" " tools/inspector_protocol/markupsafe" " $( cat ${rootdir} /tools/inspector_protocol/markupsafe/LICENSE) "
77
+ addlicense " GYP" " tools/gyp" " $( cat " ${rootdir} " /tools/gyp/LICENSE) "
78
+ addlicense " inspector_protocol" " tools/inspector_protocol" " $( cat " ${rootdir} " /tools/inspector_protocol/LICENSE) "
79
+ addlicense " jinja2" " tools/inspector_protocol/jinja2" " $( cat " ${rootdir} " /tools/inspector_protocol/jinja2/LICENSE) "
80
+ addlicense " markupsafe" " tools/inspector_protocol/markupsafe" " $( cat " ${rootdir} " /tools/inspector_protocol/markupsafe/LICENSE) "
81
81
82
82
# Testing tools
83
83
addlicense " cpplint.py" " tools/cpplint.py" \
84
- " $( sed -e ' /^$/,$d' -e ' s/^#$//' -e ' s/^# //' ${rootdir} /tools/cpplint.py | tail -n +3) "
85
- addlicense " ESLint" " tools/node_modules/eslint" " $( cat ${rootdir} /tools/node_modules/eslint/LICENSE) "
86
- addlicense " babel-eslint" " tools/node_modules/babel-eslint" " $( cat ${rootdir} /tools/node_modules/babel-eslint/LICENSE) "
87
- addlicense " gtest" " test/cctest/gtest" " $( cat ${rootdir} /test/cctest/gtest/LICENSE) "
84
+ " $( sed -e ' /^$/,$d' -e ' s/^#$//' -e ' s/^# //' " ${rootdir} " /tools/cpplint.py | tail -n +3) "
85
+ addlicense " ESLint" " tools/node_modules/eslint" " $( cat " ${rootdir} " /tools/node_modules/eslint/LICENSE) "
86
+ addlicense " babel-eslint" " tools/node_modules/babel-eslint" " $( cat " ${rootdir} " /tools/node_modules/babel-eslint/LICENSE) "
87
+ addlicense " gtest" " test/cctest/gtest" " $( cat " ${rootdir} " /test/cctest/gtest/LICENSE) "
88
88
89
89
# nghttp2
90
- addlicense " nghttp2" " deps/nghttp2" " $( cat ${rootdir} /deps/nghttp2/COPYING) "
90
+ addlicense " nghttp2" " deps/nghttp2" " $( cat " ${rootdir} " /deps/nghttp2/COPYING) "
91
91
92
92
# node-inspect
93
- addlicense " node-inspect" " deps/node-inspect" " $( cat ${rootdir} /deps/node-inspect/LICENSE) "
93
+ addlicense " node-inspect" " deps/node-inspect" " $( cat " ${rootdir} " /deps/node-inspect/LICENSE) "
94
94
95
95
# large_pages
96
- addlicense " large_pages" " src/large_pages" " $( sed -e ' /SPDX-License-Identifier/,$d' -e ' s/^\/\///' ${rootdir} /src/large_pages/node_large_page.h) "
96
+ addlicense " large_pages" " src/large_pages" " $( sed -e ' /SPDX-License-Identifier/,$d' -e ' s/^\/\///' " ${rootdir} " /src/large_pages/node_large_page.h) "
97
97
98
98
# deep_freeze
99
- addlicense " caja" " lib/internal/freeze_intrinsics.js" " $( sed -e ' /SPDX-License-Identifier/,$d' -e ' s/^\/\///' ${rootdir} /lib/internal/freeze_intrinsics.js) "
99
+ addlicense " caja" " lib/internal/freeze_intrinsics.js" " $( sed -e ' /SPDX-License-Identifier/,$d' -e ' s/^\/\///' " ${rootdir} " /lib/internal/freeze_intrinsics.js) "
100
100
101
101
# brotli
102
- addlicense " brotli" " deps/brotli" " $( cat ${rootdir} /deps/brotli/LICENSE) "
102
+ addlicense " brotli" " deps/brotli" " $( cat " ${rootdir} " /deps/brotli/LICENSE) "
103
103
104
- addlicense " HdrHistogram" " deps/histogram" " $( cat ${rootdir} /deps/histogram/LICENSE.txt) "
104
+ addlicense " HdrHistogram" " deps/histogram" " $( cat " ${rootdir} " /deps/histogram/LICENSE.txt) "
105
105
106
106
addlicense " highlight.js" " doc/api_assets/highlight.pack.js" \
107
107
" $( curl -sL https://raw.githubusercontent.com/highlightjs/highlight.js/63f367c46f2eeb6f9b7a3545e325eeeb917f9942/LICENSE) "
@@ -112,6 +112,6 @@ addlicense "node-heapdump" "src/heap_utils.cc" \
112
112
addlicense " rimraf" " lib/internal/fs/rimraf.js" \
113
113
" $( curl -sL https://raw.githubusercontent.com/isaacs/rimraf/0e365ac4e4d64a25aa2a3cc026348f13410210e1/LICENSE) "
114
114
115
- addlicense " uvwasi" " deps/uvwasi" " $( cat ${rootdir} /deps/uvwasi/LICENSE) "
115
+ addlicense " uvwasi" " deps/uvwasi" " $( cat " ${rootdir} " /deps/uvwasi/LICENSE) "
116
116
117
- mv $tmplicense $licensefile
117
+ mv " $tmplicense " " $licensefile "
0 commit comments