diff --git a/scripts/deploy.sh b/scripts/deploy.sh index 760afeb..c3197f7 100755 --- a/scripts/deploy.sh +++ b/scripts/deploy.sh @@ -71,6 +71,9 @@ check_go_installation() { install_go() { log_info "Installing Go $GO_VERSION..." + # Save original directory + local original_dir=$(pwd) + # Determine architecture local arch=$(uname -m) case $arch in @@ -100,13 +103,17 @@ install_go() { rm -rf "$GOROOT" fi - # Extract Go - log_info "Extracting Go to $GOROOT..." - tar -xf "$go_archive" - + # Extract Go to a temporary location first, then move to final destination + log_info "Extracting Go..." + tar -xf "$go_archive" -C /tmp + mv /tmp/go "$GOROOT" + # Clean up rm -f "$go_archive" + # Return to original directory + cd "$original_dir" + log_success "Go $GO_VERSION installed successfully" } @@ -167,7 +174,10 @@ build_application() { log_info "Updating embedded web assets..." ./scripts/update-embedded-web.sh - # The update-embedded-web.sh script should have built the binary + # Build the binary in the current directory + log_info "Building binary in current directory..." + CGO_ENABLED=1 go build -o "$BINARY_NAME" + if [[ -f "./$BINARY_NAME" ]]; then log_success "ORLY relay built successfully" else diff --git a/scripts/ubuntu_install_libsecp256k1.sh b/scripts/ubuntu_install_libsecp256k1.sh index 6e38837..557b067 100755 --- a/scripts/ubuntu_install_libsecp256k1.sh +++ b/scripts/ubuntu_install_libsecp256k1.sh @@ -1,14 +1,40 @@ #!/usr/bin/env bash +set -e + SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) -apt -y install build-essential autoconf libtool git wget -cd $SCRIPT_DIR + +# Update package lists +apt-get update + +# Try to install from package manager first (much faster) +echo "Attempting to install secp256k1 from package manager..." +if apt-get install -y libsecp256k1-dev >/dev/null 2>&1; then + echo "✓ Installed secp256k1 from package manager" + exit 0 +fi + +# Fall back to building from source if package not available +echo "Package not available in repository, building from source..." + +# Install build dependencies +apt-get install -y build-essential autoconf automake libtool git wget pkg-config + +cd "$SCRIPT_DIR" rm -rf secp256k1 + +# Clone and setup secp256k1 git clone https://github.com/bitcoin-core/secp256k1.git cd secp256k1 git checkout v0.6.0 + +# Initialize and update submodules git submodule init git submodule update + +# Build and install ./autogen.sh ./configure --enable-module-schnorrsig --enable-module-ecdh --prefix=/usr -make -j1 -sudo make install +make -j$(nproc) +make install + +cd "$SCRIPT_DIR"