diff --git a/modules/beacon/mkosi.extra/usr/local/lib/scripts/beacon-report.sh b/modules/beacon/mkosi.extra/usr/local/lib/scripts/beacon-report.sh index 0a16455..85fd800 100755 --- a/modules/beacon/mkosi.extra/usr/local/lib/scripts/beacon-report.sh +++ b/modules/beacon/mkosi.extra/usr/local/lib/scripts/beacon-report.sh @@ -25,6 +25,15 @@ else OS_LABEL="${OS_NAME}" fi +# Determine proc version +PROC_LABEL="unknown" + +# Parse AMD processor model +model="$(cat /proc/cpuinfo | grep 'model name' | uniq | grep -Eo "AMD EPYC [0-9]+" | cut -d' ' -f3)" +if [[ -n "${model}" ]]; then + PROC_LABEL="${model:0:1}xx${model:3}" +fi + # Loop over to generate beacon report for all SEV certificates for sev_version in "${SEV_VERSIONS[@]}"; do # Build title @@ -37,13 +46,20 @@ for sev_version in "${SEV_VERSIONS[@]}"; do # Obtain SEV Version Content SEV_CERT_FILE="${HOME:-/root}/sev_certificate_v${sev_version}.txt" - # Call beacon + # Set up parameters + PARAMS=() + + # Add labels + PARAMS+=("--label" "certificate") + PARAMS+=("--label" "os-${OS_LABEL}") + PARAMS+=("--label" "proc-${PROC_LABEL}") + + # Add milestone for valid test if [ -e "${SEV_CERT_FILE}" ] && [ -z "$(grep "❌" "${SEV_CERT_FILE}")" ]; then - # Add milestone if no errors encountered - beacon report --title "$SEV_TITLE" --body "$SEV_CERT_FILE" --label "certificate" --label "os-${OS_LABEL}" --milestone "$MILESTONE" - else - beacon report --title "$SEV_TITLE" --body "$SEV_CERT_FILE" --label "certificate" --label "os-${OS_LABEL}" + PARAMS+=("--milestone" "$MILESTONE") fi + beacon report --title "$SEV_TITLE" --body "$SEV_CERT_FILE" "${PARAMS[@]}" + echo "Published SEV certificate via beacon with title: $SEV_TITLE" done