Files
dropshell/source/cmake_prebuild.sh
j ae5a6fabe9
All checks were successful
Build-Test-Publish / build (linux/amd64) (push) Successful in 35s
Build-Test-Publish / build (linux/arm64) (push) Successful in 3m15s
feat: Update 7 files
2026-01-02 22:27:40 +13:00

39 lines
1.3 KiB
Bash
Executable File

#!/bin/bash
set -e
# CMake pre-build script.
# Runs before the build process.
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"
# Generate agent hash BEFORE dehydration
# Hash all files in agent-remote (excluding agent.hash itself) to create a content fingerprint
echo "Generating agent hash..."
AGENT_HASH=$(find "${SCRIPT_DIR}/agent-remote" -type f ! -name 'agent.hash' -exec sha256sum {} \; | sort | sha256sum | cut -d' ' -f1)
echo "${AGENT_HASH}" > "${SCRIPT_DIR}/agent-remote/agent.hash"
echo "Agent hash: ${AGENT_HASH}"
# 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}"