From 0cfea042147be713d2cd2911aaf85ccf4bf5f0e3 Mon Sep 17 00:00:00 2001 From: aalu1418 Date: Mon, 21 Feb 2022 11:01:12 -0500 Subject: [PATCH] make filepaths relative --- scripts/lib.sh | 10 +++++----- scripts/setup-local.sh | 21 +++++++++++---------- scripts/setup-staging.sh | 9 ++++----- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/scripts/lib.sh b/scripts/lib.sh index 0adfa67db..cec4935db 100644 --- a/scripts/lib.sh +++ b/scripts/lib.sh @@ -6,13 +6,13 @@ function modify_program { store=$3 # Replace existing declare_id!() - sed -i "s/DzzjdPWNfwHZmzPVxnmqkkMJraYQQRCpgFZajqkqmU6G/$ac/" contracts/programs/access-controller/src/lib.rs - sed -i "s/HW3ipKzeeduJq6f1NqRCw4doknMeWkfrM4WxobtG3o5v/$ocr2/" contracts/programs/ocr2/src/lib.rs - sed -i "s/CaH12fwNTKJAG8PxEvo9R96Zc2j8qNHZaFj8ZW49yZNT/$store/" contracts/programs/store/src/lib.rs + sed -i "s/DzzjdPWNfwHZmzPVxnmqkkMJraYQQRCpgFZajqkqmU6G/$ac/" "${BASH_SOURCE%/*}/../contracts/programs/access-controller/src/lib.rs" + sed -i "s/HW3ipKzeeduJq6f1NqRCw4doknMeWkfrM4WxobtG3o5v/$ocr2/" "${BASH_SOURCE%/*}/../contracts/programs/ocr2/src/lib.rs" + sed -i "s/CaH12fwNTKJAG8PxEvo9R96Zc2j8qNHZaFj8ZW49yZNT/$store/" "${BASH_SOURCE%/*}/../contracts/programs/store/src/lib.rs" } function build { - cd contracts + cd "${BASH_SOURCE%/*}/../contracts" anchor build - cd .. + cd $1 } diff --git a/scripts/setup-local.sh b/scripts/setup-local.sh index 0d0326574..449e6e383 100755 --- a/scripts/setup-local.sh +++ b/scripts/setup-local.sh @@ -1,24 +1,25 @@ #!/usr/bin/env bash -set -e -source ./scripts/lib.sh +set -euxo pipefail +source "${BASH_SOURCE%/*}/lib.sh" -ACCESS_CONTROLLER_PROGRAM_ID=$(<./contracts/artifacts/localnet/access_controller-keypair.pub) -OCR2_PROGRAM_ID=$(<./contracts/artifacts/localnet/ocr2-keypair.pub) -STORE_PROGRAM_ID=$(<./contracts/artifacts/localnet/store-keypair.pub) +ACCESS_CONTROLLER_PROGRAM_ID=$(<"${BASH_SOURCE%/*}/../contracts/artifacts/localnet/access_controller-keypair.pub") +OCR2_PROGRAM_ID=$(<"${BASH_SOURCE%/*}/../contracts/artifacts/localnet/ocr2-keypair.pub") +STORE_PROGRAM_ID=$(<"${BASH_SOURCE%/*}/../contracts/artifacts/localnet/store-keypair.pub") modify_program $ACCESS_CONTROLLER_PROGRAM_ID $OCR2_PROGRAM_ID $STORE_PROGRAM_ID # build artifacts -build +build ${PWD%/} # copy build artifacts -mkdir -p ./gauntlet/packages/gauntlet-solana-contracts/artifacts/bin -cp ./contracts/target/deploy/*.so ./gauntlet/packages/gauntlet-solana-contracts/artifacts/bin +mkdir -p "${BASH_SOURCE%/*}/../gauntlet/packages/gauntlet-solana-contracts/artifacts/bin" +echo $PWD +cp ${BASH_SOURCE%/*}/../contracts/target/deploy/*.so "${BASH_SOURCE%/*}/../gauntlet/packages/gauntlet-solana-contracts/artifacts/bin" # copy keypairs -mkdir -p ./gauntlet/packages/gauntlet-solana-contracts/artifacts/programId +mkdir -p "${BASH_SOURCE%/*}/../gauntlet/packages/gauntlet-solana-contracts/artifacts/programId" programs=("access_controller" "store" "ocr2") for t in ${programs[@]}; do - cp "./contracts/artifacts/localnet/$t-keypair.json" ./gauntlet/packages/gauntlet-solana-contracts/artifacts/programId/$t.json + cp "${BASH_SOURCE%/*}/../contracts/artifacts/localnet/$t-keypair.json" "${BASH_SOURCE%/*}/../gauntlet/packages/gauntlet-solana-contracts/artifacts/programId/$t.json" done diff --git a/scripts/setup-staging.sh b/scripts/setup-staging.sh index 2fa6e0fe4..6b48b9a11 100755 --- a/scripts/setup-staging.sh +++ b/scripts/setup-staging.sh @@ -1,11 +1,10 @@ #!/usr/bin/env bash -# note call from repo root -set -e -source ./scripts/lib.sh -source ./gauntlet/packages/gauntlet-solana-contracts/networks/.env.staging +set -euxo pipefail +source "${BASH_SOURCE%/*}/lib.sh" +source "${BASH_SOURCE%/*}/../gauntlet/packages/gauntlet-solana-contracts/networks/.env.staging" modify_program $PROGRAM_ID_ACCESS_CONTROLLER $PROGRAM_ID_OCR2 $PROGRAM_ID_STORE # build artifacts -build +build ${PWD%/}