diff --git a/Dockerfile-demo b/Dockerfile-demo index 46b0985..bcc52ea 100644 --- a/Dockerfile-demo +++ b/Dockerfile-demo @@ -32,10 +32,10 @@ RUN wget https://dist.ipfs.io/go-ipfs/v0.9.1/go-ipfs_v0.9.1_linux-amd64.tar.gz & rm -rf go-ipfs go-ipfs_v0.9.1_linux-amd64.tar.gz # Make fetch-params.sh executable -RUN chmod +x fetch-params.sh +RUN chmod +x ./zcutil/fetch-params.sh # Run fetch-params.sh -RUN ./fetch-params.sh +RUN ./zcutil/fetch-params.sh # Create necessary directories RUN mkdir -p /root/.local/share/ZcashParams diff --git a/fetch-params.sh b/fetch-params.sh deleted file mode 100644 index 7b5ff35..0000000 --- a/fetch-params.sh +++ /dev/null @@ -1,252 +0,0 @@ -#!/usr/bin/env bash - -export LC_ALL=C -set -eu - -SCRIPT_NAME=$(basename $0) - -#[[ -v XDG_CACHE_HOME ]] || XDG_CACHE_HOME="${HOME}/.cache" -if [ -z "${XDG_CACHE_HOME+x}" ]; then - XDG_CACHE_HOME="${HOME}/.cache" -fi -# We don’t care too much about most of the properties of `XDG_RUNTIME_DIR` in -# this script, so we just fall back to `XDG_CACHE_HOME`. -#[[ -v XDG_RUNTIME_DIR ]] || XDG_RUNTIME_DIR="${XDG_CACHE_HOME}" -if [ -z "${XDG_RUNTIME_DIR+x}" ]; then - XDG_RUNTIME_DIR="${XDG_CACHE_HOME}" -fi - -uname_S=$(uname -s 2>/dev/null || echo not) - -if [ "$uname_S" = "Darwin" ]; then - PARAMS_DIR="$HOME/Library/Application Support/ZcashParams" -else - PARAMS_DIR="$HOME/.zcash-params" -fi - -# Commented out because these are unused; see below. -#SPROUT_PKEY_NAME='sprout-proving.key' -#SPROUT_VKEY_NAME='sprout-verifying.key' -SAPLING_SPEND_NAME='sapling-spend.params' -SAPLING_OUTPUT_NAME='sapling-output.params' -SAPLING_SPROUT_GROTH16_NAME='sprout-groth16.params' -DOWNLOAD_URL="https://download.z.cash/downloads" -IPFS_HASH="/ipfs/QmXRHVGLQBiKwvNq7c2vPxAKz1zRVmMYbmt7G5TQss7tY7" - -SHA256CMD="$(command -v sha256sum || echo shasum)" -SHA256ARGS="$(command -v sha256sum >/dev/null || echo '-a 256')" - -WGETCMD="$(command -v wget || echo '')" -IPFSCMD="$(command -v ipfs || echo '')" -CURLCMD="$(command -v curl || echo '')" - -# fetch methods can be disabled with ZC_DISABLE_SOMETHING=1 -ZC_DISABLE_WGET="${ZC_DISABLE_WGET:-}" -ZC_DISABLE_IPFS="${ZC_DISABLE_IPFS:-}" -ZC_DISABLE_CURL="${ZC_DISABLE_CURL:-}" - -LOCK_DIR="${XDG_RUNTIME_DIR}/zcash" -mkdir -p "${LOCK_DIR}" -LOCKFILE="${LOCK_DIR}/fetch-params.lock" - -fetch_wget() { - if [ -z "$WGETCMD" ] || [ -n "$ZC_DISABLE_WGET" ]; then - return 1 - fi - - cat <&2 < "${dlname}" - rm "${dlname}.part.1" "${dlname}.part.2" - - "$SHA256CMD" $SHA256ARGS -c <&2 - exit 1 - fi - fi - - unset -v filename - unset -v output - unset -v dlname - unset -v expectedhash -} - -# Use flock to prevent parallel execution. -lock() { - if [ "$uname_S" = "Darwin" ]; then - if shlock -f ${LOCKFILE} -p $$; then - return 0 - else - return 1 - fi - else - # create lock file - eval "exec 9>$LOCKFILE" - # acquire the lock - flock -n 9 \ - && return 0 \ - || return 1 - fi -} - -exit_locked_error() { - echo "Only one instance of ${SCRIPT_NAME} can be run at a time." >&2 - echo "If you are certain no other instance is running, you can try removing" >&2 - echo "${LOCKFILE}" >&2 - exit 1 -} - -main() { - - lock \ - || exit_locked_error - - cat <> "$README_PATH" <