36 lines
1.0 KiB
Bash
Executable File
36 lines
1.0 KiB
Bash
Executable File
#!/bin/bash
|
|
set -e
|
|
|
|
# CMake pre-build script.
|
|
# Runs before the build process.
|
|
|
|
# This script creates two files:
|
|
# src/utils/createagent.hpp
|
|
# src/utils/createagent.cpp
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
|
|
# 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"
|
|
|
|
# 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}"
|