Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 21 additions & 5 deletions modules/beacon/mkosi.extra/usr/local/lib/scripts/beacon-report.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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