|
| 1 | +#!/bin/bash |
| 2 | +# |
| 3 | +# Script to install scripts from the software-layer repo into the EESSI software stack |
| 4 | + |
| 5 | +display_help() { |
| 6 | + echo "usage: $0 [OPTIONS]" |
| 7 | + echo " -p | --prefix - prefix to copy the scripts to" |
| 8 | + echo " -h | --help - display this usage information" |
| 9 | +} |
| 10 | + |
| 11 | + |
| 12 | +POSITIONAL_ARGS=() |
| 13 | + |
| 14 | +while [[ $# -gt 0 ]]; do |
| 15 | + case $1 in |
| 16 | + -o|--prefix) |
| 17 | + INSTALL_PREFIX="$2" |
| 18 | + shift 2 |
| 19 | + ;; |
| 20 | + -h|--help) |
| 21 | + display_help # Call your function |
| 22 | + # no shifting needed here, we're done. |
| 23 | + exit 0 |
| 24 | + ;; |
| 25 | + -*|--*) |
| 26 | + echo "Error: Unknown option: $1" >&2 |
| 27 | + exit 1 |
| 28 | + ;; |
| 29 | + *) # No more options |
| 30 | + POSITIONAL_ARGS+=("$1") # save positional arg |
| 31 | + shift |
| 32 | + ;; |
| 33 | + esac |
| 34 | +done |
| 35 | + |
| 36 | +set -- "${POSITIONAL_ARGS[@]}" |
| 37 | + |
| 38 | +TOPDIR=$(dirname $(realpath $0)) |
| 39 | + |
| 40 | +# Subdirs for generic scripts |
| 41 | +SCRIPTS_DIR_SOURCE=${TOPDIR}/scripts/ # Source dir |
| 42 | +SCRIPTS_DIR_TARGET=${INSTALL_PREFIX}/scripts/ # Target dir |
| 43 | + |
| 44 | +# Create target dir |
| 45 | +mkdir -p ${SCRIPTS_DIR_TARGET} |
| 46 | + |
| 47 | +# Copy scripts into this prefix |
| 48 | +for file in utils.sh; do |
| 49 | + cp ${SCRIPTS_DIR_SOURCE}/${file} ${SCRIPTS_DIR_TARGET}/${file} |
| 50 | +done |
| 51 | +# Subdirs for GPU support |
| 52 | +NVIDIA_GPU_SUPPORT_DIR_SOURCE=${TOPDIR}/gpu_support/nvidia/ # Source dir |
| 53 | +NVIDIA_GPU_SUPPORT_DIR_TARGET=${INSTALL_PREFIX}/gpu_support/nvidia/ # Target dir |
| 54 | + |
| 55 | +# Create target dir |
| 56 | +mkdir -p ${NVIDIA_GPU_SUPPORT_DIR_TARGET} |
| 57 | + |
| 58 | +# Copy files from this directory into the prefix |
| 59 | +# To be on the safe side, we dont do recursive copies, but we are explicitely copying each individual file we want to add |
| 60 | +for file in install_cuda_host_injections.sh link_nvidia_host_injections.sh; do |
| 61 | + cp ${NVIDIA_GPU_SUPPORT_DIR_SOURCE}/${file} ${NVIDIA_GPU_SUPPORT_DIR_TARGET}/${file} |
| 62 | +done |
0 commit comments