I’ve been wondering if there’s a tool that does “installing” the licenses in my foss projects automatic. For some licenses it’s as simple as dumping the license text in the repository but for things like GPL I’d have to go add license headers to my files to comply.
There’s also some things that harder to verify like the MIT requirement to install the license text which would require checking the build system.
I don’t know of any tool like this. I do want to clarify one point though:
While I am not a lawyer, my understanding is that it’s safer to add a license notice to all files regardless of which license is in use. This is because in a combined work it might be ambiguous which license covers which files (ironically, this problem is more likely to occur with permissive licenses and less likely to occur with the GPL). This might be a problem with the way the author who created the combination presented the work and there might be legal recourse for that, but as a practical matter is safer, easier, and cheaper to add a per-file license notice.
There is REUSE, which can fetch licenses to a LICENSES directory, add SPDX-License-Identifier and copyright notice headers to files, and generate a little dep5 file containing a little bit of metadata. The things it does are documented in a short specification.
No, to use the GPL, you are not required to add the GPL boilerplate to the files. Something like SPDX-License-Identifier is a good idea anyway.
Why do you say that? The terms of the GPL or AGPL only say that you need to specify the license in particular files if there are “additional terms” that apply to them (section 7 of either license). There is a non-normative commentary typically attached to the license terms that suggests to add a license notice on each source file, but that is all. If you want to distribute all your files under the same license you can just mention it once on your zip file (or git repo) and that will be clear enough.
To answer your question, if you want to add the same license note to each file, you can just use “cat”
for i in *.c ; do cat note.txt >> $i ; done
This will append the note at the end of each source file, where this ancillary information belongs. Thus you can start each source file with actual content, which is beautiful.
Same place you add the SPDX-License-Identifier, see Frequently Asked Questions | REUSE. You can use reuse annotate to annotate existing files with these headers.