#!/bin/bash # Fail if required environment variables are not set if [ -z "$DUCO_USERNAME" ] || [ -z "$DUCO_MINING_KEY" ]; then echo "ERROR: DUCO_USERNAME and DUCO_MINING_KEY must be set." exit 1 fi # Base64-encode the mining key ENCODED_KEY=$(echo -n "$DUCO_MINING_KEY" | base64) # Use environment variable DUCO_DIR or default to /duino-coin/Duino-Coin PC Miner 4.3 DUCO_DIR="${DUCO_DIR:-/duino-coin/Duino-Coin PC Miner 4.3}" # Create the directory if it doesn't exist mkdir -p "$DUCO_DIR" # Generate the Settings.cfg using environment variables or defaults cat > "$DUCO_DIR/Settings.cfg" <