1- #! /usr/ bin/env bash
1+ #! /bin/sh
22
33set -e
44
5- rootdir=" $( CDPATH= cd " $( dirname " ${BASH_SOURCE[0]} " ) /.." && pwd) "
5+ rootdir=" $( CDPATH=' ' cd " $( dirname " $0 " ) /.." && pwd) "
66licensefile=" ${rootdir} /LICENSE"
7- licensehead=" $( sed ' /^- /,$d' ${licensefile} ) "
7+ licensehead=" $( sed ' /^- /,$d' " ${licensefile} " ) "
88tmplicense=" ${rootdir} /~LICENSE.$$ "
9- echo -e " $licensehead " > $tmplicense
9+ echo " $licensehead " > " $tmplicense "
1010
1111
1212# addlicense <library> <location> <license text>
13- function addlicense {
13+ addlicense () {
1414
1515 echo "
1616- ${1} , located at ${2} , is licensed as follows:
1717 \"\"\"
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' )
1919 \"\"\"\
20- " >> $tmplicense
20+ " >> " $tmplicense "
2121
2222}
2323
2929
3030
3131# 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) "
3636if [ -f " ${rootdir} /deps/icu/LICENSE" ]; then
3737 # ICU 57 and following. Drop the BOM
3838 addlicense " ICU" " deps/icu" \
3939 " $( 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) "
4141elif [ -f " ${rootdir} /deps/icu/license.html" ]; then
4242 # ICU 56 and prior
4343 addlicense " ICU" " deps/icu" \
4444 " $( 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) "
4646elif [ -f " ${rootdir} /deps/icu-small/LICENSE" ]; then
4747 # ICU 57 and following. Drop the BOM
4848 addlicense " ICU" " deps/icu-small" \
4949 " $( 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) "
5151elif [ -f " ${rootdir} /deps/icu-small/license.html" ]; then
5252 # ICU 56 and prior
5353 addlicense " ICU" " deps/icu-small" \
5454 " $( 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) "
5656else
5757 echo " Could not find an ICU license file."
5858 exit 1
5959fi
6060
61- addlicense " libuv" " deps/uv" " $( cat ${rootdir} /deps/uv/LICENSE) "
61+ addlicense " libuv" " deps/uv" " $( cat " ${rootdir} " /deps/uv/LICENSE) "
6262addlicense " llhttp" " deps/llhttp" " $( cat deps/llhttp/LICENSE-MIT) "
6363addlicense " 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) "
6565addlicense " Punycode.js" " lib/punycode.js" \
6666 " $( 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) "
6868addlicense " SipHash" " deps/v8/src/third_party/siphash" \
6969 " $( sed -e ' /You should have received a copy of the CC0/,$d' -e ' s/^\/\* *//' -e ' s/^ \* *//' deps/v8/src/third_party/siphash/halfsiphash.cc) "
7070addlicense " 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) "
7272
7373# npm
74- addlicense " npm" " deps/npm" " $( cat ${rootdir} /deps/npm/LICENSE) "
74+ addlicense " npm" " deps/npm" " $( cat " ${rootdir} " /deps/npm/LICENSE) "
7575
7676# 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) "
8181
8282# Testing tools
8383addlicense " 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) "
8888
8989# nghttp2
90- addlicense " nghttp2" " deps/nghttp2" " $( cat ${rootdir} /deps/nghttp2/COPYING) "
90+ addlicense " nghttp2" " deps/nghttp2" " $( cat " ${rootdir} " /deps/nghttp2/COPYING) "
9191
9292# ngtcp2
93- addlicense " ngtcp2" " deps/ngtcp2" " $( cat ${rootdir} /deps/ngtcp2/COPYING) "
93+ addlicense " ngtcp2" " deps/ngtcp2" " $( cat " ${rootdir} " /deps/ngtcp2/COPYING) "
9494
9595# nghttp3
96- addlicense " nghttp3" " deps/nghttp3" " $( cat ${rootdir} /deps/nghttp3/COPYING) "
96+ addlicense " nghttp3" " deps/nghttp3" " $( cat " ${rootdir} " /deps/nghttp3/COPYING) "
9797
9898# node-inspect
99- addlicense " node-inspect" " deps/node-inspect" " $( cat ${rootdir} /deps/node-inspect/LICENSE) "
99+ addlicense " node-inspect" " deps/node-inspect" " $( cat " ${rootdir} " /deps/node-inspect/LICENSE) "
100100
101101# large_pages
102- addlicense " large_pages" " src/large_pages" " $( sed -e ' /SPDX-License-Identifier/,$d' -e ' s/^\/\///' ${rootdir} /src/large_pages/node_large_page.h) "
102+ addlicense " large_pages" " src/large_pages" " $( sed -e ' /SPDX-License-Identifier/,$d' -e ' s/^\/\///' " ${rootdir} " /src/large_pages/node_large_page.h) "
103103
104104# deep_freeze
105- addlicense " caja" " lib/internal/freeze_intrinsics.js" " $( sed -e ' /SPDX-License-Identifier/,$d' -e ' s/^\/\///' ${rootdir} /lib/internal/freeze_intrinsics.js) "
105+ addlicense " caja" " lib/internal/freeze_intrinsics.js" " $( sed -e ' /SPDX-License-Identifier/,$d' -e ' s/^\/\///' " ${rootdir} " /lib/internal/freeze_intrinsics.js) "
106106
107107# brotli
108- addlicense " brotli" " deps/brotli" " $( cat ${rootdir} /deps/brotli/LICENSE) "
108+ addlicense " brotli" " deps/brotli" " $( cat " ${rootdir} " /deps/brotli/LICENSE) "
109109
110- addlicense " HdrHistogram" " deps/histogram" " $( cat ${rootdir} /deps/histogram/LICENSE.txt) "
110+ addlicense " HdrHistogram" " deps/histogram" " $( cat " ${rootdir} " /deps/histogram/LICENSE.txt) "
111111
112112addlicense " highlight.js" " doc/api_assets/highlight.pack.js" \
113113 " $( curl -sL https://raw.githubusercontent.com/highlightjs/highlight.js/63f367c46f2eeb6f9b7a3545e325eeeb917f9942/LICENSE) "
@@ -118,6 +118,6 @@ addlicense "node-heapdump" "src/heap_utils.cc" \
118118addlicense " rimraf" " lib/internal/fs/rimraf.js" \
119119 " $( curl -sL https://raw.githubusercontent.com/isaacs/rimraf/0e365ac4e4d64a25aa2a3cc026348f13410210e1/LICENSE) "
120120
121- addlicense " uvwasi" " deps/uvwasi" " $( cat ${rootdir} /deps/uvwasi/LICENSE) "
121+ addlicense " uvwasi" " deps/uvwasi" " $( cat " ${rootdir} " /deps/uvwasi/LICENSE) "
122122
123- mv $tmplicense $licensefile
123+ mv " $tmplicense " " $licensefile "
0 commit comments