|
| 1 | +#!/bin/bash |
| 2 | +# licensecheck -r src |
| 3 | + |
| 4 | +for i in $(<files); do |
| 5 | + author= |
| 6 | + authordate= |
| 7 | + eval $(git log --reverse --pretty="export author='%an' authordate=\"\$(date --date='%ai' +'%%B %Y')\"" $i | head -1) |
| 8 | + basename=$(basename $i) |
| 9 | + authoryear=${authordate#* } |
| 10 | + case $author in |
| 11 | + wonder|"Martin Dobias") |
| 12 | + authorname="Martin Dobias" |
| 13 | + authoremail="wonder.sk at gmail.com" |
| 14 | + ;; |
| 15 | + |
| 16 | + "Marco Hugentobler"|mhugent) |
| 17 | + authorname="Marco Hugentobler" |
| 18 | + authoremail="marco dot hugentobler at sourcepole dot ch" |
| 19 | + ;; |
| 20 | + |
| 21 | + "Pirmin Kalberer") |
| 22 | + authorname="Pirmin Kalberer" |
| 23 | + authoremail="pka at sourcepole dot ch" |
| 24 | + ;; |
| 25 | + |
| 26 | + rblazek) |
| 27 | + authorname="Radim Blazek" |
| 28 | + authoremail="radim dot blazek at gmail dot com" |
| 29 | + ;; |
| 30 | + |
| 31 | + timlinux) |
| 32 | + authorname="Tim Sutton" |
| 33 | + authoremail="tim dot linfiniti at com" |
| 34 | + ;; |
| 35 | + |
| 36 | + *) |
| 37 | + echo "Author $author not found." |
| 38 | + exit 1 |
| 39 | + ;; |
| 40 | + esac |
| 41 | + |
| 42 | + src=$i |
| 43 | + if [ -f "$i.nocopyright" ]; then |
| 44 | + src=$i.nocopyright |
| 45 | + fi |
| 46 | + |
| 47 | + cat - $src >/tmp/new <<EOF |
| 48 | +/*************************************************************************** |
| 49 | + $basename |
| 50 | + --------------------- |
| 51 | + begin : $authordate |
| 52 | + copyright : (C) $authoryear by $authorname |
| 53 | + email : $authoremail |
| 54 | + *************************************************************************** |
| 55 | + * * |
| 56 | + * This program is free software; you can redistribute it and/or modify * |
| 57 | + * it under the terms of the GNU General Public License as published by * |
| 58 | + * the Free Software Foundation; either version 2 of the License, or * |
| 59 | + * (at your option) any later version. * |
| 60 | + * * |
| 61 | + ***************************************************************************/ |
| 62 | +EOF |
| 63 | + [ -f $i.nocopyright ] || mv $i $i.nocopyright |
| 64 | + cp /tmp/new $i |
| 65 | +done |
0 commit comments