xref: /aosp_15_r20/external/coreboot/util/scripts/no-fsf-addresses.sh (revision b9411a12aaaa7e1e6a6fb7c5e057f44ee179a49c)
1#!/usr/bin/env sh
2# SPDX-License-Identifier: ISC
3
4filelist=$(git ls-files $* | \
5		grep -Ev "^($(git submodule status |cut -d' ' -f3 |tr '\012' '|' | sed "s,|$,,"))$" | \
6		grep -Ev "\.patch$|_shipped$|\<LICENSE_GPL$|\<LGPL.txt$|\<COPYING$|\<DISCLAIMER$|^util/kconfig/|\<no-fsf-addresses.sh$")
7
8sed -i \
9	-e "s:Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, *MA[, ]*02110-1301[, ]*USA:Foundation, Inc.:" \
10	-e "s:Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, *MA[, ]*02110-1301[, ]*\$$:Foundation, Inc.:" \
11	-e "s:Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA:Foundation, Inc.:" \
12	-e "s:Foundation, Inc., 59 Temple Place[-, ]*Suite 330, Boston, MA *02111-1307[, ]*USA:Foundation, Inc.:" \
13	-e "s:Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.:Foundation, Inc.:" \
14	-e "/Foundation, Inc./ {N;s:Foundation, Inc.* USA\.* *:Foundation, Inc. :;s:Foundation, Inc. $:Foundation, Inc.:}" \
15	$filelist
16
17sed -i \
18	-e "/^[ \t\*#/-]*$/ {
19		N
20		/You should have received a copy of the GNU/ {
21			N
22			/You should have received a copy of the GNU.*along with this program\.[\., ]*$/ d
23			/You should have received a copy of the GNU.*[iI]f not, write to[^[:alnum:]]*the Free.*Software[^[:alnum:]]*Foundation,[^[:alnum:]]*Inc\.[\., ]*$/ d
24			/You should have received a copy of the GNU.*[iI]f not, see.*http:\/\/www.gnu.org\/licenses\/>[\. ]*$/ d
25			N
26			/You should have received a copy of the GNU.*[iI]f not, write to[^[:alnum:]]*the Free.*Software[^[:alnum:]]*Foundation,[^[:alnum:]]*Inc\.[\., ]*$/ d
27			/You should have received a copy of the GNU.*[iI]f not, write to[^[:alnum:]]*the Free.*Software[^[:alnum:]]*Foundation,[^[:alnum:]]*Inc\.[\., ]*\*\// s:^.*\*/:\*/:
28			/You should have received a copy of the GNU.*[iI]f not, write to[^[:alnum:]]*the Free.*Software[^[:alnum:]]*Foundation[\., ]*\*\// s:^.*\*/:\*/:
29			/You should have received a copy of the GNU.*[iI]f not, see.*http:\/\/www.gnu.org\/licenses\/>[\. ]*$/ d
30			N
31			/You should have received a copy of the GNU.*[iI]f not, see.*http:\/\/www.gnu.org\/licenses\/>[\. ]*$/ d
32			/You should have received a copy of the GNU.*[iI]f not, see.*http:\/\/www.gnu.org\/licenses\/>[\. ]*\*\// s:^.*\*/:\*/:
33		}}" \
34	$filelist
35