From fdf8dbf1f46cfba693409852e27b16a6e2b301a4 Mon Sep 17 00:00:00 2001 From: illuminatus Date: Sat, 21 Oct 2023 13:09:35 -0700 Subject: [PATCH] guild-deploy option to download mithril binaries --- scripts/cnode-helper-scripts/guild-deploy.sh | 25 +++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/scripts/cnode-helper-scripts/guild-deploy.sh b/scripts/cnode-helper-scripts/guild-deploy.sh index fe7162cd27..ce976f0d02 100755 --- a/scripts/cnode-helper-scripts/guild-deploy.sh +++ b/scripts/cnode-helper-scripts/guild-deploy.sh @@ -61,7 +61,7 @@ versionCheck() { printf '%s\n%s' "${1//v/}" "${2//v/}" | sort -C -V; } #$1=avail usage() { cat <<-EOF >&2 - Usage: $(basename "$0") [-n ] [-p path] [-t ] [-b ] [-u] [-s [p][b][l][f][d][c][o][w][x]] + Usage: $(basename "$0") [-n ] [-p path] [-t ] [-b ] [-u] [-s [p][b][l][m][f][d][c][o][w][x]] Set up dependencies for building/using common tools across cardano ecosystem. The script will always update dynamic content from existing scripts retaining existing user variables @@ -74,6 +74,7 @@ usage() { p Install common pre-requisite OS-level Dependencies for most tools on this repo (Default: skip) b Install OS level dependencies for tools required while building cardano-node/cardano-db-sync components (Default: skip) l Build and Install libsodium fork from IO repositories (Default: skip) + m Build and install mithril from IO repositories (Default: skip) f Force overwrite entire content of scripts and config files (backups of existing ones will be created) (Default: skip) d Download latest (released) binaries for bech32, cardano-address, cardano-node, cardano-cli, cardano-db-sync and cardano-submit-api (Default: skip) c Install/Upgrade CNCLI binary (Default: skip) @@ -92,6 +93,7 @@ set_defaults() { [[ -z ${WANT_BUILD_DEPS} ]] && WANT_BUILD_DEPS='N' [[ -z ${FORCE_OVERWRITE} ]] && FORCE_OVERWRITE='N' [[ -z ${LIBSODIUM_FORK} ]] && LIBSODIUM_FORK='N' + [[ -z ${INSTALL_MITHRIL} ]] && INSTALL_MITHRIL='N' [[ -z ${INSTALL_CNCLI} ]] && INSTALL_CNCLI='N' [[ -z ${INSTALL_CWHCLI} ]] && INSTALL_CWHCLI='N' [[ -z ${INSTALL_OGMIOS} ]] && INSTALL_OGMIOS='N' @@ -322,6 +324,25 @@ build_libsodium() { echo -e "\nIOG fork of libsodium installed to /usr/local/lib/" } +# Build mithril +download_mithril() { + echo -e "\nDownloading mithril binaries..." + pushd "${HOME}"/tmp >/dev/null || err_exit + # dynamic latest release updated automatically, uncomment and comment out the hardcoded release below if needed + # mithril_release="$(curl -s https://api.github.com/repos/input-output-hk/mithril/releases/latest | jq -r '.tag_name')" + # hardcoded latest release requiring a bump + mithril_release="2337.0" + echo -e "\n Downloading mithril ${mithril_release}..." + rm -f mithril-signer mithril-client + curl -m 200 -sfL https://github.com/input-output-hk/mithril/releases/download/${mithril_release}/mithril-${mithril_release}-linux-x64.tar.gz -o mithril.tar.gz || err_exit " Could not download mithril's latest release archive from IO github!" + tar zxf mithril.tar.gz mithril-signer mithril-client &>/dev/null + rm -f mithril.tar.gz + [[ -f mithril-signer ]] || err_exit " mithril archive downloaded but binary (mithril-signer) not found after extracting package!" + [[ -f mithril-client ]] || err_exit " mithril archive downloaded but binary (mithril-client) not found after extracting package!" + mv -t "${HOME}"/.local/bin mithril-signer mithril-client + chmod +x "${HOME}"/.local/bin/* +} + # Download cardano-node, cardano-cli, cardano-db-sync, bech32 and cardano-submit-api # TODO: Replace these with self-hosted ones (potentially consider IPFS as upload destination for CI) download_cnodebins() { @@ -591,6 +612,7 @@ parse_args() { [[ "${S_ARGS}" =~ "p" ]] && INSTALL_OS_DEPS="Y" [[ "${S_ARGS}" =~ "b" ]] && INSTALL_OS_DEPS="Y" && WANT_BUILD_DEPS="Y" [[ "${S_ARGS}" =~ "l" ]] && INSTALL_OS_DEPS="Y" && WANT_BUILD_DEPS="Y" && INSTALL_LIBSODIUM_FORK="Y" + [[ "${S_ARGS}" =~ "m" ]] && INSTALL_MITHRIL="Y" && WANT_BUILD_DEPS="Y" [[ "${S_ARGS}" =~ "f" ]] && FORCE_OVERWRITE="Y" && POPULATE_CNODE="F" [[ "${S_ARGS}" =~ "d" ]] && INSTALL_CNODEBINS="Y" [[ "${S_ARGS}" =~ "c" ]] && INSTALL_CNCLI="Y" @@ -613,6 +635,7 @@ main_flow() { [[ "${INSTALL_OS_DEPS}" == "Y" ]] && os_dependencies [[ "${WANT_BUILD_DEPS}" == "Y" ]] && build_dependencies [[ "${INSTALL_LIBSODIUM_FORK}" == "Y" ]] && build_libsodium + [[ "${INSTALL_MITHRIL}" == "Y" ]] && download_mithril [[ "${FORCE_OVERWRITE}" == "Y" ]] && POPULATE_CNODE="F" && populate_cnode [[ "${POPULATE_CNODE}" == "Y" ]] && populate_cnode [[ "${INSTALL_CNODEBINS}" == "Y" ]] && download_cnodebins