43
by Michael Hope
Started adding the modified BSD license everywhere. |
1 |
#!/bin/bash
|
2 |
#
|
|
3 |
# Add the modified BSD license to a file
|
|
4 |
#
|
|
5 |
||
6 |
f=`mktemp -d` |
|
7 |
trap "rm -rf $f" EXIT |
|
8 |
||
9 |
year=`date +%Y` |
|
10 |
cat > $f/original <<EOF |
|
53
by Michael Hope
Changed 'Linaro Inc.' for the correct 'Linaro Limited' everywhere. |
11 |
Copyright (c) $year, Linaro Limited
|
43
by Michael Hope
Started adding the modified BSD license everywhere. |
12 |
All rights reserved.
|
13 |
||
14 |
Redistribution and use in source and binary forms, with or without
|
|
15 |
modification, are permitted provided that the following conditions are met:
|
|
16 |
* Redistributions of source code must retain the above copyright
|
|
17 |
notice, this list of conditions and the following disclaimer.
|
|
18 |
* Redistributions in binary form must reproduce the above copyright
|
|
19 |
notice, this list of conditions and the following disclaimer in the
|
|
20 |
documentation and/or other materials provided with the distribution.
|
|
21 |
* Neither the name of the Linaro nor the
|
|
22 |
names of its contributors may be used to endorse or promote products
|
|
23 |
derived from this software without specific prior written permission.
|
|
24 |
||
25 |
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
26 |
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
27 |
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
53
by Michael Hope
Changed 'Linaro Inc.' for the correct 'Linaro Limited' everywhere. |
28 |
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY
|
43
by Michael Hope
Started adding the modified BSD license everywhere. |
29 |
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
30 |
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
31 |
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
|
32 |
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
33 |
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
82
by Michael Hope
Remove trailing whitespace from the copyright headers. |
34 |
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
43
by Michael Hope
Started adding the modified BSD license everywhere. |
35 |
EOF
|
36 |
||
37 |
# Translate it to C style
|
|
38 |
echo "/*" > $f/c |
|
82
by Michael Hope
Remove trailing whitespace from the copyright headers. |
39 |
sed -r 's/(.*)/ * \1/' $f/original | sed -r 's/ +$//' >> $f/c |
43
by Michael Hope
Started adding the modified BSD license everywhere. |
40 |
echo " */" >> $f/c |
41 |
echo >> $f/c |
|
42 |
||
45
by Michael Hope
Removed obsolete build files. Updated the license on more files. |
43 |
# ...and shell style
|
82
by Michael Hope
Remove trailing whitespace from the copyright headers. |
44 |
sed -r 's/(.*)/# \1/' $f/original | sed -r 's/ +$//' >> $f/shell |
45
by Michael Hope
Removed obsolete build files. Updated the license on more files. |
45 |
echo '#' >> $f/shell |
46 |
echo >> $f/shell |
|
47 |
||
43
by Michael Hope
Started adding the modified BSD license everywhere. |
48 |
for name in $@; do |
49 |
if grep -q Copyright $name; then |
|
50 |
echo $name already has some type of copyright |
|
51 |
continue
|
|
52 |
fi
|
|
53 |
||
54 |
case $name in |
|
45
by Michael Hope
Removed obsolete build files. Updated the license on more files. |
55 |
# These files don't have an explicit license
|
56 |
*autogen.sh*)
|
|
57 |
continue;; |
|
58 |
*reference/newlib/*)
|
|
59 |
continue;; |
|
60 |
*reference/newlib-xscale/*)
|
|
61 |
continue;; |
|
62 |
*/dhry/*)
|
|
63 |
continue;; |
|
64 |
||
43
by Michael Hope
Started adding the modified BSD license everywhere. |
65 |
*.c)
|
66 |
src=$f/c |
|
67 |
;;
|
|
45
by Michael Hope
Removed obsolete build files. Updated the license on more files. |
68 |
*.sh|*.am|*.ac) |
69 |
src=$f/shell |
|
70 |
;;
|
|
43
by Michael Hope
Started adding the modified BSD license everywhere. |
71 |
*)
|
72 |
echo Unrecognied extension on $name |
|
73 |
continue
|
|
74 |
esac
|
|
75 |
||
76 |
cat $src $name > $f/next |
|
77 |
mv $f/next $name |
|
78 |
echo Updated $name |
|
79 |
done
|