Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-07-26 08:22:03

0001 #!/bin/bash
0002 #
0003 # (c) 2023-2025 CERN for the benefit of the ACTS project
0004 #
0005 # Mozilla Public License Version 2.0
0006 #
0007 # Script generating TGZ/MD5 files that could then be uploaded to the ACTS web
0008 # service.
0009 #
0010 
0011 # Stop on errors.
0012 set -e
0013 set -o pipefail
0014 
0015 # Function printing the usage information for the script.
0016 usage() {
0017    echo "Script generating data TGZ/MD5 files"
0018    echo ""
0019    echo "Usage: traccc_data_package_files.sh [options]"
0020    echo ""
0021    echo "Options:"
0022    echo "  -o <outputName>      Set the name of the output file(s)"
0023    echo "  -i <inputDirectory>  Additional input directory to pick up"
0024    echo "  -d <dataDirectory>   Main data directory"
0025    echo "  -c <cmakeExecutable> CMake executable to use in the script"
0026    echo ""
0027 }
0028 
0029 # Default script arguments.
0030 TRACCC_DATA_NAME=${TRACCC_DATA_NAME:-"traccc-data-v11"}
0031 TRACCC_DATA_DIRECTORY_NAMES=("cca_test" "detray_simulation" "geometries" "odd"
0032    "single_module" "tml_detector" "tml_full" "tml_pixel_barrel" "tml_pixels"
0033    "two_modules")
0034 TRACCC_DATA_DIRECTORY=${TRACCC_DATA_DIRECTORY:-$(cd $(dirname "${BASH_SOURCE[0]}") && pwd)}
0035 TRACCC_CMAKE_EXECUTABLE=${TRACCC_CMAKE_EXECUTABLE:-cmake}
0036 
0037 # Parse the command line argument(s).
0038 while getopts ":o:i:d:ch" opt; do
0039    case $opt in
0040       o)
0041          TRACCC_DATA_NAME=$OPTARG
0042          ;;
0043       i)
0044          TRACCC_DATA_DIRECTORY_NAMES+=($OPTARG)
0045          ;;
0046       d)
0047          TRACCC_DATA_DIRECTORY=$OPTARG
0048          ;;
0049       c)
0050          TRACCC_CMAKE_EXECUTABLE=$OPTARG
0051          ;;
0052       h)
0053          usage
0054          exit 0
0055          ;;
0056       :)
0057          echo "Argument -$OPTARG requires a parameter!"
0058          usage
0059          exit 1
0060          ;;
0061       ?)
0062          echo "Unknown argument: -$OPTARG"
0063          usage
0064          exit 1
0065          ;;
0066    esac
0067 done
0068 
0069 # Go into the source directory.
0070 cd "${TRACCC_DATA_DIRECTORY}"
0071 
0072 # Compress the directories.
0073 "${TRACCC_CMAKE_EXECUTABLE}" -E tar czf "${TRACCC_DATA_NAME}.tar.gz" \
0074    ${TRACCC_DATA_DIRECTORY_NAMES[@]}
0075 
0076 # Generate an MD5 file.
0077 "${TRACCC_CMAKE_EXECUTABLE}" -E md5sum "${TRACCC_DATA_NAME}.tar.gz" > \
0078    "${TRACCC_DATA_NAME}.md5"
0079 
0080 # Leave the user with a message.
0081 "${TRACCC_CMAKE_EXECUTABLE}" -E echo \
0082    "Generated files '${TRACCC_DATA_NAME}.tar.gz' and '${TRACCC_DATA_NAME}.md5'"