-
Notifications
You must be signed in to change notification settings - Fork 33
/
Copy pathprint_licenses.sh
executable file
·49 lines (40 loc) · 2.12 KB
/
print_licenses.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/bin/bash
# Copyright (C) 2021-2024 Intel Corporation
# SPDX-License-Identifier: BSD-3-Clause
# Run this script from the root of the repository
# Dependencies: jq, go-licenses
# apt install jq
# go install github.com/google/go-licenses@latest
# List of GitHub projects, must have LICENSE file
github_projects=(
"async-profiler/async-profiler"
"harp-intel/avx-turbo"
"mirror/dmidecode"
"lyonel/lshw"
"pciutils/pciutils"
"intel/pcm"
"ColinIanKing/stress-ng"
"sysstat/sysstat"
)
# Loop through each URL
for github_project in "${github_projects[@]}"; do
# Fetch the repository data from GitHub API
response=$(curl -s "https://api.github.com/repos/$github_project")
# Extract the license type using jq
license=$(echo "$response" | jq -r '.license.spdx_id')
# Print the repository URL and its license type
echo "github.com/$github_project,https://github.com/$github_project/LICENSE,$license"
done
# non-comforming GitHub repos
echo "github.com/intel/msr-tools,https://github.com/intel/msr-tools/blob/master/cpuid.c,GPL-2.0"
echo "github.com/brendangregg/FlameGraph,https://github.com/brendangregg/FlameGraph/blob/master/flamegraph.pl,CDDL"
echo "github.com/ipmitool/ipmitool,https://github.com/ipmitool/ipmitool?tab=License-1-ov-file#readme,SUN Microsystems"
echo "github.com/speed47/spectre-meltdown-checker,https://github.com/speed47/spectre-meltdown-checker/blob/master/spectre-meltdown-checker.sh,GPL-3.0-only"
# repos not in GitHub
echo "etallen.com/cpuid,http://www.etallen.com/cpuid,GPL-2.0"
echo "git.kernel.org/pub/scm/network/ethtool,https://git.kernel.org/pub/scm/network/ethtool/ethtool.git/tree/LICENSE,GPL-2.0"
echo "sourceforge.net/projects/sshpass,https://sourceforge.net/p/sshpass/code-git/ci/main/tree/COPYING,GPL-2.0"
echo "github.com/torvalds/linux/blob/master/tools/power/x86/turbostat,https://github.com/torvalds/linux/blob/master/tools/power/x86/turbostat/turbostat.c,GPL-2.0"
echo "github.com/torvalds/linux/tree/master/tools/perf,https://github.com/torvalds/linux/tree/master/tools/perf,GPL-2.0"
# Generate a list of licenses for Go dependencies
go-licenses report . 2>/dev/null