This commit is contained in:
@@ -32,20 +32,19 @@ function install_bb64() {
|
|||||||
_die "Curl is not installed. Curl is required for agent installation."
|
_die "Curl is not installed. Curl is required for agent installation."
|
||||||
fi
|
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)"
|
BB64_path="${AGENT_LOCAL_PATH}/bb64"
|
||||||
|
ARCH=$(uname -m)
|
||||||
# test result code from curl
|
if ! curl "http://getbin.xyz/bb64:latest-${ARCH}" > "${BB64_path}"; then
|
||||||
if [ $? -ne 0 ]; then
|
|
||||||
_die "Failed to install bb64. Curl returned non-zero exit code."
|
_die "Failed to install bb64. Curl returned non-zero exit code."
|
||||||
fi
|
fi
|
||||||
|
chown "$(id -u "$USER"):$(id -g "$USER")" "${BB64_path}"
|
||||||
|
|
||||||
# test if bb64 is installed
|
# test if bb64 is installed
|
||||||
"$AGENT_LOCAL_PATH/bb64" -v
|
if ! VER=$("${BB64_path}" version); then
|
||||||
if [ $? -ne 0 ]; then
|
|
||||||
_die "bb64 did not install correctly."
|
_die "bb64 did not install correctly."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "bb64 installed successfully."
|
echo "bb64 v$VER installed."
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -7,18 +7,29 @@ set -e
|
|||||||
# This script creates two files:
|
# This script creates two files:
|
||||||
# src/utils/createagent.hpp
|
# src/utils/createagent.hpp
|
||||||
# src/utils/createagent.cpp
|
# src/utils/createagent.cpp
|
||||||
#
|
|
||||||
|
|
||||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
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"
|
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}"
|
||||||
|
Reference in New Issue
Block a user