github.com/Finschia/finschia-sdk@v0.48.1/contrib/images/simd-dlv/wrapper.sh (about) 1 #!/usr/bin/env sh 2 set -euo pipefail 3 set -x 4 5 DEBUG=${DEBUG:-0} 6 BINARY=/simd/${BINARY:-simd} 7 ID=${ID:-0} 8 LOG=${LOG:-simd.log} 9 10 if ! [ -f "${BINARY}" ]; then 11 echo "The binary $(basename "${BINARY}") cannot be found. Please add the binary to the shared folder. Please use the BINARY environment variable if the name of the binary is not 'simd'" 12 exit 1 13 fi 14 15 export SIMDHOME="/data/node${ID}/simd" 16 17 if [ "$DEBUG" -eq 1 ]; then 18 dlv --listen=:2345 --continue --headless=true --api-version=2 --accept-multiclient exec "${BINARY}" -- --home "${SIMDHOME}" "$@" 19 elif [ "$DEBUG" -eq 1 ] && [ -d "$(dirname "${SIMDHOME}"/"${LOG}")" ]; then 20 dlv --listen=:2345 --continue --headless=true --api-version=2 --accept-multiclient exec "${BINARY}" -- --home "${SIMDHOME}" "$@" | tee "${SIMDHOME}/${LOG}" 21 elif [ -d "$(dirname "${SIMDHOME}"/"${LOG}")" ]; then 22 "${BINARY}" --home "${SIMDHOME}" "$@" | tee "${SIMDHOME}/${LOG}" 23 else 24 "${BINARY}" --home "${SIMDHOME}" "$@" 25 fi