add audit target for collecting legal/cve details

This commit is contained in:
Lance Vick 2020-07-24 03:08:28 -07:00
parent 2d00082279
commit b54b103009
Signed by: lrvick
GPG Key ID: 8E47A1EC35A1551D
1 changed files with 26 additions and 0 deletions

26
scripts/audit Executable file
View File

@ -0,0 +1,26 @@
#!/bin/bash
[ -f /.dockerenv ] || { echo "please run in supplied container"; exit 1; }
set -e; source environment
build_dir="${BUILD_DIR?}"
audit_dir="${BUILD_DIR?}/audit"
buildroot_dir="${build_dir}/buildroot"
heads_dir="${build_dir}/heads"
mkdir -p ${audit_dir}
echo version "${VERSION}"
openssl sha256 -r ${buildroot_dir}/dl/*/*.tar.* > ${audit_dir}/os_src_hashes.txt
openssl sha256 -r ${heads_dir}/packages/* > ${audit_dir}/fw_src_hashes.txt
cat ${audit_dir}/os_src_hashes.txt \
${audit_dir}/fw_src_hashes.txt \
| sed 's/ .*\// /g' \
| awk '{ t = $1; $1 = $2; $2 = t; print;}' \
| sort \
| uniq \
> ${audit_dir}/hashes.txt
(cd ${buildroot_dir} && make cpe-info legal-info)
cp ${buildroot_dir}/output/cpe-manifest.csv ${audit_dir}/cpe-manifest.csv
cp -R ${buildroot_dir}/output/legal-info ${audit_dir}/legal-info