41 lines
1.2 KiB
Bash
41 lines
1.2 KiB
Bash
#!/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" <<EOF
|
|
[PC Miner]
|
|
username="$DUCO_USERNAME"
|
|
mining_key="$ENCODED_KEY"
|
|
intensity=${DUCO_INTENSITY:-95}
|
|
threads=${DUCO_THREADS:-1}
|
|
start_diff=${DUCO_START_DIFF:-LOW}
|
|
donate=${DUCO_DONATE:-5}
|
|
identifier=${DUCO_IDENTIFIER:-$(hostname)}
|
|
algorithm=${DUCO_ALGORITHM:-DUCO-S1}
|
|
language=${DUCO_LANGUAGE:-english}
|
|
soc_timeout=${DUCO_SOC_TIMEOUT:-10}
|
|
report_sec=${DUCO_REPORT_SEC:-300}
|
|
raspi_leds=${DUCO_RASPI_LEDS:-y}
|
|
raspi_cpu_iot=${DUCO_RASPI_CPU_IOT:-y}
|
|
discord_rp=${DUCO_DISCORD_RP:-y}
|
|
EOF
|
|
|
|
echo "Settings.cfg generated at $DUCO_DIR/Settings.cfg"
|
|
|
|
# Execute any command passed to the container
|
|
exec "$@"
|