From 3401bf2a526af3b64b98d7d2b58a04a6f2f6071b Mon Sep 17 00:00:00 2001 From: Your Name Date: Sun, 17 Aug 2025 16:47:03 +1200 Subject: [PATCH] Update 2 files --- source/agent-local/agent-install.sh | 13 ++++++------ source/cmake_prebuild.sh | 33 +++++++++++++++++++---------- 2 files changed, 28 insertions(+), 18 deletions(-) diff --git a/source/agent-local/agent-install.sh b/source/agent-local/agent-install.sh index 35ef8da..b098290 100755 --- a/source/agent-local/agent-install.sh +++ b/source/agent-local/agent-install.sh @@ -32,20 +32,19 @@ function install_bb64() { _die "Curl is not installed. Curl is required for agent installation." fi - curl -fsSL "https://gitea.jde.nz/public/bb64/releases/download/latest/install.sh" | bash -s -- "$AGENT_LOCAL_PATH" "$(id -u $USER):$(id -g $USER)" - - # test result code from curl - if [ $? -ne 0 ]; then + BB64_path="${AGENT_LOCAL_PATH}/bb64" + ARCH=$(uname -m) + if ! curl "http://getbin.xyz/bb64:latest-${ARCH}" > "${BB64_path}"; then _die "Failed to install bb64. Curl returned non-zero exit code." fi + chown "$(id -u "$USER"):$(id -g "$USER")" "${BB64_path}" # test if bb64 is installed - "$AGENT_LOCAL_PATH/bb64" -v - if [ $? -ne 0 ]; then + if ! VER=$("${BB64_path}" version); then _die "bb64 did not install correctly." fi - echo "bb64 installed successfully." + echo "bb64 v$VER installed." return 0; } diff --git a/source/cmake_prebuild.sh b/source/cmake_prebuild.sh index fdb00b5..e1e3d18 100755 --- a/source/cmake_prebuild.sh +++ b/source/cmake_prebuild.sh @@ -7,18 +7,29 @@ set -e # This script creates two files: # src/utils/createagent.hpp # src/utils/createagent.cpp -# SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -# check if dehydrate is installed -if ! command -v dehydrate &> /dev/null; then - echo "dehydrate could not be found - installing" - curl -fsSL https://gitea.jde.nz/public/dehydrate/releases/download/latest/install.sh | bash -else - # ensure we have latest dehydrate. - dehydrate -u -fi +# Create temporary directory for dehydrate +TEMP_DIR=$(mktemp -d) +echo "Using temporary directory: ${TEMP_DIR}" + +# Get current architecture +ARCH=$(uname -m) + +# Download dehydrate for current architecture +echo "Downloading dehydrate for architecture: ${ARCH}" +curl -fsSL "http://getbin.xyz/dehydrate:latest-${ARCH}" -o "${TEMP_DIR}/dehydrate" +chmod +x "${TEMP_DIR}/dehydrate" + +# Ensure autogen directory exists mkdir -p "${SCRIPT_DIR}/src/autogen" -dehydrate "${SCRIPT_DIR}/agent-remote" "${SCRIPT_DIR}/src/autogen" -dehydrate "${SCRIPT_DIR}/agent-local" "${SCRIPT_DIR}/src/autogen" + +# Run dehydrate from temp location +echo "Running dehydrate from temporary location" +"${TEMP_DIR}/dehydrate" "${SCRIPT_DIR}/agent-remote" "${SCRIPT_DIR}/src/autogen" +"${TEMP_DIR}/dehydrate" "${SCRIPT_DIR}/agent-local" "${SCRIPT_DIR}/src/autogen" + +# Clean up temporary directory +echo "Cleaning up temporary directory: ${TEMP_DIR}" +rm -rf "${TEMP_DIR}"