|
| 1 | +#!/bin/bash |
| 2 | + |
| 3 | +set -e |
| 4 | + |
| 5 | +# Generate open source attribution file with parameterized URL |
| 6 | +# Usage: ./generate_oss_attribution.sh <image_name> <tag> <arch> [output_file] |
| 7 | + |
| 8 | +show_usage() { |
| 9 | + local error_msg="${1}" |
| 10 | + |
| 11 | + if [ -n "${error_msg}" ]; then |
| 12 | + echo "ERROR: ${error_msg}" |
| 13 | + echo "" |
| 14 | + fi |
| 15 | + |
| 16 | + echo "Usage: $0 <image_name> <tag> <arch> [output_file]" |
| 17 | + echo "" |
| 18 | + echo "Arguments:" |
| 19 | + echo " image_name - Name of the image (e.g., tensorrt-llm)" |
| 20 | + echo " tag - Image tag/version (e.g., 1.0.0)" |
| 21 | + echo " arch - Architecture (e.g., amd64, arm64)" |
| 22 | + echo " output_file - Optional output file path (default: /third-party-source/NOTICE.txt)" |
| 23 | + echo "" |
| 24 | + echo "Example:" |
| 25 | + echo " $0 tensorrt-llm 1.0.0 amd64" |
| 26 | + echo "" |
| 27 | + exit 1 |
| 28 | +} |
| 29 | + |
| 30 | +IMAGE_NAME="${1}" |
| 31 | +TAG="${2}" |
| 32 | +ARCH="${3}" |
| 33 | +OUTPUT_FILE="/NOTICE.txt" |
| 34 | + |
| 35 | +# Validate required parameters |
| 36 | +[ -z "${IMAGE_NAME}" ] && show_usage "Missing required parameter IMAGE_NAME" |
| 37 | +[ -z "${TAG}" ] && show_usage "Missing required parameter TAG" |
| 38 | +[ -z "${ARCH}" ] && show_usage "Missing required parameter ARCH" |
| 39 | + |
| 40 | +# Construct the URL |
| 41 | +ROOT_URL="https://opensource.nvidia.com/oss/teams/nvidia" |
| 42 | +OSS_URL="${ROOT_URL}/${IMAGE_NAME}/${TAG}:linux-${ARCH}/index.html" |
| 43 | + |
| 44 | +# Create output directory if needed |
| 45 | +OUTPUT_DIR="$(dirname "${OUTPUT_FILE}")" |
| 46 | +mkdir -p "${OUTPUT_DIR}" |
| 47 | + |
| 48 | +# Generate the attribution file |
| 49 | +cat > "${OUTPUT_FILE}" << EOF |
| 50 | +This distribution includes open source which is archived at the following URL: ${OSS_URL} |
| 51 | +
|
| 52 | +For further inquiries or assistance, contact us at [email protected] |
| 53 | +EOF |
| 54 | + |
| 55 | +echo "✓ Attribution file generated: ${OUTPUT_FILE}" |
| 56 | +echo " URL: ${OSS_URL}" |
| 57 | + |
0 commit comments