gdp / adm / update-license.sh @ master
History | View | Annotate | Download (583 Bytes)
1 |
#!/bin/sh |
---|---|
2 |
|
3 |
adm=`dirname $0` |
4 |
|
5 |
update_license() { |
6 |
file=$1 |
7 |
{ |
8 |
cp $file $file.BAK && |
9 |
awk -f $adm/update-license.awk $file > $file.$$ && |
10 |
cp $file.$$ $file && |
11 |
rm $file.$$ |
12 |
} || |
13 |
echo WARNING: could not update license for $file 1>&2 |
14 |
} |
15 |
|
16 |
# Fudge LICENSE file in this directory or parent, no further up |
17 |
rmLICENSE=false |
18 |
if [ ! -r LICENSE ] |
19 |
then |
20 |
if [ -r ../LICENSE ] |
21 |
then |
22 |
ln -s ../LICENSE |
23 |
rmLICENSE=true |
24 |
else |
25 |
echo "[ERROR] LICENSE file must exist" |
26 |
exit 1 |
27 |
fi |
28 |
fi |
29 |
|
30 |
|
31 |
for f |
32 |
do |
33 |
echo Updating $f |
34 |
update_license $f |
35 |
done |
36 |
|
37 |
if $rmLICENSE |
38 |
then |
39 |
rm LICENSE |
40 |
fi |
41 |
|
42 |
exit 0 |