#!/bin/bash # Note: This is kind of AI slop and needs to be more carefully reviewed. set -eu DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" # shellcheck source=framework/versions source "$DIR/framework/versions" # shellcheck source=framework/platform source "$DIR/framework/platform" # Get platform-specific variables nodejs_binary_var="nodejs_binary_${platform}" nodejs_checksum_var="nodejs_checksum_${platform}" nodejs_dirname_var="nodejs_dirname_${platform}" nodejs_binary="${!nodejs_binary_var}" nodejs_checksum="${!nodejs_checksum_var}" nodejs_dirname="${!nodejs_dirname_var}" pnpm_binary_var="pnpm_binary_${platform}" pnpm_checksum_var="pnpm_checksum_${platform}" pnpm_binary_url="${!pnpm_binary_var}" pnpm_checksum="${!pnpm_checksum_var}" # Set up paths for shims to use nodejs_dist_dir="framework/binaries/$nodejs_dirname" nodejs_bin_dir="$nodejs_dist_dir/bin" # Ensure correct node version is installed node_installed_checksum_file="$DIR/framework/binaries/.node.checksum" node_installed_checksum="" if [ -f "$node_installed_checksum_file" ]; then node_installed_checksum=$(cat "$node_installed_checksum_file") fi if [ "$node_installed_checksum" != "$nodejs_checksum" ]; then echo "Downloading Node.js for $platform..." node_archive="$DIR/framework/downloads/node.tar.xz" curl -fsSL "$nodejs_binary" -o "$node_archive" echo "Verifying checksum..." echo "$nodejs_checksum $node_archive" | sha256_check echo "Extracting Node.js..." tar -xf "$node_archive" -C "$DIR/framework/binaries" rm "$node_archive" echo "$nodejs_checksum" >"$node_installed_checksum_file" fi # Ensure correct pnpm version is installed pnpm_binary="$DIR/framework/binaries/pnpm" pnpm_installed_checksum_file="$DIR/framework/binaries/.pnpm.checksum" pnpm_installed_checksum="" if [ -f "$pnpm_installed_checksum_file" ]; then pnpm_installed_checksum=$(cat "$pnpm_installed_checksum_file") fi if [ "$pnpm_installed_checksum" != "$pnpm_checksum" ]; then echo "Downloading pnpm for $platform..." curl -fsSL "$pnpm_binary_url" -o "$pnpm_binary" echo "Verifying checksum..." echo "$pnpm_checksum $pnpm_binary" | sha256_check chmod +x "$pnpm_binary" echo "$pnpm_checksum" >"$pnpm_installed_checksum_file" fi # Get golang binaries in place cd "$DIR/master" go build cd "$DIR/logger" go build # Update framework code cd "$DIR/backend" ../cmd pnpm install