diff --git a/install.sh b/install.sh index 2d8f3d5..0de8a1a 100644 --- a/install.sh +++ b/install.sh @@ -284,7 +284,7 @@ install_mineradm() { local new_version new_version=$(get_mineradm_version "$src_utils_sh") - log_info "--- Starting CESS mineradm installation (v$new_version) ---" + log_info "--- Starting CESS mineradm installation ($new_version) ---" if [ -f "$install_dir/config.yaml" ] && [ "$retain_config" != "true" ]; then confirm_config_overwrite "$old_version" @@ -308,7 +308,7 @@ install_mineradm() { setup_bash_completion attempt_enable_docker_api - log_success "CESS mineradm v$new_version installed successfully!" + log_success "CESS mineradm $new_version installed successfully!" } main() { diff --git a/scripts/completion.sh b/scripts/completion.sh index 1060752..ad8ab06 100644 --- a/scripts/completion.sh +++ b/scripts/completion.sh @@ -8,7 +8,7 @@ _mineradm_completions() { prev2="${COMP_WORDS[COMP_CWORD - 2]}" if [[ ${COMP_CWORD} -eq 1 ]]; then - opts="miners cacher stop restart down status pullimg purge config profile tools help" + opts="miners cacher stop restart down status pullimg purge config profile tools version increase help" else case "$prev" in miners) @@ -23,6 +23,9 @@ _mineradm_completions() { increase) opts="staking space" ;; + config) + opts="show generate help" + ;; esac fi @@ -30,4 +33,4 @@ _mineradm_completions() { return 0 } -complete -F _mineradm_completions mineradm \ No newline at end of file +complete -F _mineradm_completions mineradm diff --git a/scripts/config.sh b/scripts/config.sh index c713184..7d88ce3 100644 --- a/scripts/config.sh +++ b/scripts/config.sh @@ -76,20 +76,22 @@ prepare_build_dir() { run_config_generator() { log_info "Running config generator..." pullimg # Ensure latest images are used - + + local cidfile=$(mktemp) + rm $cidfile + local cg_image="cesslab/config-gen:$profile" - local cidfile - cidfile=$(mktemp) - - # The trap ensures the container is removed even if the script fails. - trap 'docker rm -f "$(cat "$cidfile")" &>/dev/null || true; rm -f "$cidfile"' EXIT - - docker run --cidfile "$cidfile" \ - -v "$base_dir/etc:/opt/app/etc" \ - -v "$build_dir/.tmp:/opt/app/.tmp" \ - -v "$config_path:/opt/app/config.yaml" \ - "$cg_image" - + docker run --cidfile $cidfile -v $base_dir/etc:/opt/app/etc -v $build_dir/.tmp:/opt/app/.tmp -v $config_path:/opt/app/config.yaml $cg_image + + local res="$?" + local cid=$(cat $cidfile) + docker rm $cid + + if [ "$res" -ne "0" ]; then + log_err "Failed to generate configurations, please check your config file and try again." + exit 1 + fi + log_success "Config generator finished." } @@ -133,16 +135,6 @@ deploy_generated_configs() { log_success "All configurations deployed." } -# Patches the generated docker-compose.yaml for compatibility. -patch_compose_file() { - log_info "Patching docker-compose.yaml..." - # This sed command removes extra single quotes from the 'test' command array, - # which can cause issues with some Docker versions. - # e.g., '["CMD", "nc", ...]' -> ["CMD", "nc", ...] - sed -i "s/'\([\"CMD\".*\)'/\1/" "$compose_yaml" - log_success "docker-compose.yaml patched." -} - # Main function to generate all configuration files. config_generate() { log_info "--- Starting Configuration Generation ---" @@ -151,18 +143,15 @@ config_generate() { prepare_build_dir run_config_generator deploy_generated_configs - patch_compose_file - + log_success "Configuration generation complete. Docker Compose file is at: $compose_yaml" } # --- Main Execution --- - +mode=$(yq eval ".node.mode" "$config_path") # Main router for the 'config' command. config() { # Set default mode if not valid - local mode - mode=$(yq eval ".node.mode" "$config_path") if [ "$mode" != "multiminer" ]; then log_info "The mode in $config_path is invalid, setting value to: multiminer" yq -i eval '.node.mode="multiminer"' "$config_path" @@ -171,7 +160,8 @@ config() { case "${1:-help}" in -s | show) config_show - ;;n -g | generate) + ;; + -g | generate) config_generate ;; -h | help | *) @@ -179,10 +169,3 @@ config() { ;; esac } - -# If run directly, execute the main function. -if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then - # Load profile from config before running. - load_profile - config "$@" -fi \ No newline at end of file diff --git a/scripts/miner.sh b/scripts/miner.sh index 7d7d464..71e9da7 100644 --- a/scripts/miner.sh +++ b/scripts/miner.sh @@ -210,27 +210,331 @@ cacher_ops() { # --- Miner Operations --- -# This is a placeholder for the complex miner_ops logic. -# A full refactor would break this down significantly. miner_ops() { - log_info "Miner operations are complex and require a more detailed refactoring." - log_info "Executing original logic for now." - # The original miner_ops function would be pasted here. - # For brevity in this example, I'm leaving it out. - # You would call sub-functions like: - # miner_ops_increase "$@" - # miner_ops_exit "$@" - # etc. - echo "Running miner operation: ${@}" -} + if [ ! -f "$compose_yaml" ]; then + log_err "docker-compose.yaml not found in /opt/cess/mineradm/build" + return 1 + fi + if ! docker compose -f $compose_yaml config >/dev/null; then + log_err "docker-compose.yaml is not valid !" + exit 1 + fi + + local miner_names=$(yq eval '.services | keys | map(select(. == "miner*" )) | join(" ")' $compose_yaml) + local volumes=$(yq eval '.services | to_entries | map(select(.key | test("^miner.*"))) | from_entries | .[] | .volumes' $compose_yaml | xargs | sed "s/['\"]//g" | sed "s/- /-v /g" | xargs -n 4 echo) + readarray -t volumes_array <<<"$volumes" # read array split with /n + read -a names_array <<<"$miner_names" # read array split with " " + local miner_image="cesslab/cess-miner:$profile" + local -r cfg_arg="-c /opt/miner/config.yaml" # read only + + case "$1" in + increase) + # sudo mineradm miners increase staking $miner_name $token_amount + if [ $# -eq 4 ] && [ $2 == "staking" ]; then + # check miner name is correct or not + is_match_regex "miner" $3 + # $token_amount must be a number + is_num $4 + local cmd=$(gen_miner_cmd $3 $miner_image) + if ! local res=$($cmd $1 $2 $4 $cfg_arg); then + log_err "$3: Increase Stake Failed" + exit 1 + else + log_info "$res" + if echo "$res" | grep -q -E "!!|XX"; then + log_err "Please make sure that the miner has enough TCESS in signatureAcc and the signatureAcc is the same as stakingAcc" + log_err "$3: Increase Stake Failed" + exit 1 + else + log_success "$3: $4 TCESS has been increased successfully" + exit 0 + fi + fi + # sudo mineradm miners increase staking $token_amount + elif [ $# -eq 3 ] && [ $2 == "staking" ]; then + is_num $3 + log_info "WARNING: This operation will increase all of the miners stake and cannot be reverted" + printf "Press \033[0;33mY\033[0m to continue: " + local y="" + read y + if [ x"$y" != x"Y" ]; then + exit 1 + fi + for i in "${!volumes_array[@]}"; do + local cmd="docker run --rm --network=host ${volumes_array[$i]} $miner_image" + if ! local res=$($cmd $1 $2 $3 $cfg_arg); then + log_err "${names_array[$i]}: Increase Stake Failed" + else + log_info "$res" + if echo "$res" | grep -q -E "!!|XX"; then + log_info "Please make sure that the miners have enough TCESS in signatureAcc and each signatureAcc is the same as its stakingAcc" + log_err "${names_array[$i]}: Increase Stake Failed" + else + log_success "${names_array[$i]}: $3 TCESS has been increased successfully" + fi + fi + echo + done + # sudo mineradm miners increase space $miner_name $space_amount(TB) + elif [ $# -eq 4 ] && [ $2 == "space" ]; then + # check miner name is correct or not + is_match_regex "miner" $3 + # $token_amount must be a number + is_num $4 + local cmd=$(gen_miner_cmd $3 $miner_image) + if ! local res=$($cmd $1 $2 $4 $cfg_arg); then + log_err "$3: Increase Declaration Space Failed" + log_err "Network exception or insufficient balance in stakingAcc" + exit 1 + else + log_info "$res" + if echo "$res" | grep -q -E "!!|XX"; then + log_err "Please make sure that miner:$3 has enough TCESS in stakingAcc" + log_err "$3: Increase Declaration Space Failed" + exit 1 + else + log_success "$3: Increase Declaration Space to $4 TiB Successfully" + exit 0 + fi + fi + # sudo mineradm miners increase space $space_amount (TB) + elif [ $# -eq 3 ] && [ $2 == "space" ]; then + is_num $3 + log_info "WARNING: This operation will increase the declaration space of all miners on the chain by $3 TiB and cannot be reverted" + printf "Press \033[0;33mY\033[0m to continue: " + local y="" + read y + if [ x"$y" != x"Y" ]; then + exit 1 + fi + for i in "${!volumes_array[@]}"; do + local cmd="docker run --rm --network=host ${volumes_array[$i]} $miner_image" + if ! local res=$($cmd $1 $2 $3 $cfg_arg); then + log_err "${names_array[$i]}: Increase Declaration Space Operation Failed" + log_err "Network exception or insufficient balance in stakingAcc" + else + log_info "$res" + if echo "$res" | grep -q -E "!!|XX"; then + log_err "Please make sure that the miner:${names_array[$i]} have enough TCESS in stakingAcc" + log_err "${names_array[$i]}: Increase Declaration Space Operation Failed" + else + log_success "${names_array[$i]}: Increase Declaration Space to $3 TiB Operation Success" + fi + fi + echo + done + else + log_err "Parameters Error" + miner_ops_help + exit 1 + fi + ;; + exit) + # sudo mineradm miners exit $miner_name + if [ $# -eq 2 ]; then + is_match_regex "miner" $2 + local cmd=$(gen_miner_cmd $2 $miner_image) + if ! local res=$($cmd $1 $cfg_arg); then + log_err "$2: Exit Operation Failed" + exit 1 + else + log_info "$res" + if echo "$res" | grep -q -E "!!|XX"; then + log_err "Stake less than 180 days or network exception" + log_err "$2: Exit Operation Failed" + exit 1 + else + log_success "$2: Exit Operation Success" + exit 0 + fi + fi + # sudo mineradm miners exit + elif [ $# -eq 1 ]; then + log_info "WARNING: This operation will make all of the miners exit from cess network and cannot be reverted" + log_info "Please make sure that the miner have staked for more than 180 days" + printf "Press \033[0;33mY\033[0m to continue: " + local y="" + read y + if [ x"$y" != x"Y" ]; then + exit 1 + fi + for i in "${!volumes_array[@]}"; do + local cmd="docker run --rm --network=host ${volumes_array[$i]} $miner_image" + if ! local res=$($cmd $1 $cfg_arg); then + log_err "${names_array[$i]}: Exit Operation Failed" + else + log_info "$res" + if echo "$res" | grep -q -E "!!|XX"; then + log_info "Stake less than 180 days or network exception" + log_err "${names_array[$i]}: Exit Operation Failed" + else + log_success "${names_array[$i]}: Exit Operation Success" + fi + fi + echo + done + else + log_err "Parameters Error" + miner_ops_help + exit 1 + fi + ;; + withdraw) + # sudo mineradm miners withdraw $miner_name + if [ $# -eq 2 ]; then + is_match_regex "miner" $2 + local cmd=$(gen_miner_cmd $2 $miner_image) + if ! local res=$($cmd $1 $cfg_arg); then + log_err "$2: Withdraw Operation Failed" + exit 1 + else + log_info "$res" + if echo "$res" | grep -q -E "!!|XX"; then + log_info "Please make sure that the miner has been staking for more than 180 days and the miner has already exited the cess network" + log_err "$2: Withdraw Operation Failed" + exit 1 + else + log_success "$2: Withdraw Operation Success" + exit 0 + fi + fi + # sudo mineradm miners withdraw + elif [ $# -eq 1 ]; then + for i in "${!volumes_array[@]}"; do + local cmd="docker run --rm --network=host ${volumes_array[$i]} $miner_image" + if ! local res=$($cmd $1 $cfg_arg); then + log_err "${names_array[$i]}: Withdraw Operation Failed" + else + log_info "$res" + if echo "$res" | grep -q -E "!!|XX"; then + log_info "Please make sure that the miners have been staking for more than 180 days and the miners have already exited the cess network" + log_err "${names_array[$i]}: Withdraw Operation Failed" + else + log_success "${names_array[$i]}: Withdraw Operation Success" + fi + fi + echo + done + else + log_err "Parameters Error" + miner_ops_help + exit 1 + fi + ;; + # sudo mineradm miners stat + stat) + for i in "${!volumes_array[@]}"; do + local cmd="docker run --rm --network=host ${volumes_array[$i]} $miner_image" + if ! local res=$($cmd $1 $cfg_arg); then + log_err "${names_array[$i]}: Some exceptions have occurred when request on chain" + else + log_success "-----------------------------------${names_array[$i]}-----------------------------------" + log_info "$res" + fi + echo + done + ;; + # sudo mineradm miners reward + reward) + for i in "${!volumes_array[@]}"; do + local cmd="docker run --rm --network=host ${volumes_array[$i]} $miner_image" + if ! $cmd $1 $cfg_arg; then + log_err "${names_array[$i]}: Reward Operation Failed" + else + log_success "${names_array[$i]}: Reward Operation Success" + fi + echo + done + ;; + claim) + # sudo mineradm miners claim $miner_name + if [ $# -eq 2 ]; then + is_match_regex "miner" $2 + local cmd=$(gen_miner_cmd $2 $miner_image) + if ! $cmd $1 $cfg_arg; then + log_err "$2: Claim Operation Failed" + exit 1 + else + log_success "$2: Claim Operation Success" + exit 0 + fi + # sudo mineradm miners claim + elif [ $# -eq 1 ]; then + for i in "${!volumes_array[@]}"; do + local cmd="docker run --rm --network=host ${volumes_array[$i]} $miner_image" + if ! $cmd $1 $cfg_arg; then + log_err "${names_array[$i]}: Claim Operation Failed" + else + log_success "${names_array[$i]}: Claim Operation Success" + fi + echo + done + else + log_err "Parameters Error" + miner_ops_help + exit 1 + fi + ;; + update) + # sudo mineradm miners update account $miner_name $earnings_account + if [ $# -eq 4 ]; then + is_str_equal $2 "account" + is_match_regex "miner" $3 + local cmd=$(gen_miner_cmd $3 $miner_image) + if ! local res=$($cmd $1 "earnings" $4 $cfg_arg); then + log_err "$3: Change To EarningsAcc:$4 Failed" + exit 1 + else + log_info "$res" + if echo "$res" | grep -q -E "!!|XX"; then + log_err "$3: Change To EarningsAcc:$4 Failed" + exit 1 + else + log_success "$3: Change To EarningsAcc:$4" + exit 0 + fi + fi + # sudo mineradm miners update account $earnings_account + elif [ $# -eq 3 ]; then + is_str_equal $2 "account" + log_info "WARNING: This operation will change all of miners earningsAcc to $3" + printf "Press \033[0;33mY\033[0m to continue: " + local y="" + read y + if [ x"$y" != x"Y" ]; then + exit 1 + fi + for i in "${!volumes_array[@]}"; do + local cmd="docker run --rm --network=host ${volumes_array[$i]} $miner_image" + if ! res=$($cmd $1 "earnings" $3 $cfg_arg); then + log_err "${names_array[$i]}: Change To EarningsAcc:$3 Failed" + else + log_info "$res" + if echo "$res" | grep -q -E "!!|XX"; then + log_err "${names_array[$i]}: Change To EarningsAcc:$3 Failed" + else + log_success "${names_array[$i]}: Change To EarningsAcc:$3" + fi + fi + echo + done + else + log_err "Parameters Error" + miner_ops_help + exit 1 + fi + ;; + *) + miner_ops_help + exit 0 + ;; + esac +} # --- Main Execution --- main() { - # Load profile from config file first. - load_profile - case "${1:-help}" in install) shift diff --git a/scripts/tools.sh b/scripts/tools.sh index 5ae248e..46adcfa 100644 --- a/scripts/tools.sh +++ b/scripts/tools.sh @@ -1,8 +1,7 @@ #!/bin/bash # # CESS mineradm tools script -# This script provides various tools for managing miners, such a -s viewing +# This script provides various tools for managing miners, such as viewing # disk space and adjusting configurations. # --- Strict Mode --- @@ -186,16 +185,17 @@ tools() { no-watch) shift set_no_watch_containers "$@" - ;;n set) + ;; + set) shift handle_set_command "$@" - ;;n help | *) + ;; + help | *) tools_help - ;;n esac + ;; + esac } -# Load profile and execute the main function -load_profile # The script is meant to be sourced by miner.sh, which calls the 'tools' function. # If run directly, show help. if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then diff --git a/scripts/utils.sh b/scripts/utils.sh index daf6ffc..6982648 100644 --- a/scripts/utils.sh +++ b/scripts/utils.sh @@ -18,31 +18,31 @@ mineradm_version="v0.2.1" network_version="testnet" # Paths -readonly base_dir="/opt/cess/mineradm" -readonly script_dir="$base_dir/scripts" -readonly config_path="$base_dir/config.yaml" -readonly build_dir="$base_dir/build" -readonly compose_yaml="$build_dir/docker-compose.yaml" +base_dir="/opt/cess/mineradm" +script_dir="$base_dir/scripts" +config_path="$base_dir/config.yaml" +build_dir="$base_dir/build" +compose_yaml="$build_dir/docker-compose.yaml" # Configuration Profile profile="testnet" # System Requirements -readonly kernel_ver_req="5.11" -readonly docker_ver_req="20.10" -readonly yq_ver_req="4.25" -readonly cpu_req=4 -readonly ram_req=8 # GB +kernel_ver_req="5.11" +docker_ver_req="20.10" +yq_ver_req="4.25" +cpu_req=4 +ram_req=8 # GB # Per-service Requirements -readonly each_miner_ram_req=4 # GB -readonly each_miner_cpu_req=1 # Cores -readonly each_rpcnode_ram_req=2 # GB -readonly each_rpcnode_cpu_req=1 # Cores +each_miner_ram_req=4 # GB +each_miner_cpu_req=1 # Cores +each_rpcnode_ram_req=2 # GB +each_rpcnode_cpu_req=1 # Cores # System Info -PM="" # Package Manager (apt, yum) -DISTRO="" # Linux Distribution (Ubuntu, CentOS) +PM="" # Package Manager (apt, yum) +DISTRO="" # Linux Distribution (Ubuntu, CentOS) ARCH="x86_64" # System Architecture # --- Logging Functions --- @@ -166,20 +166,20 @@ get_cur_ram() { local total_mb=0 # Process each line like "Size: 8 GB" or "Size: 4096 MB" while read -r size unit; do - if [[ "$size" =~ ^[0-9]+$ ]]; then - if [[ "$unit" == "GB" ]]; then - total_mb=$((total_mb + size * 1024)) - elif [[ "$unit" == "MB" ]]; then - total_mb=$((total_mb + size)) - fi + if [[ "$size" =~ ^[0-9]+$ ]]; then + if [[ "$unit" == "GB" ]]; then + total_mb=$((total_mb + size * 1024)) + elif [[ "$unit" == "MB" ]]; then + total_mb=$((total_mb + size)) fi + fi done < <(sudo dmidecode -t memory | grep -i "Size:" | grep -v "No Module Installed" | awk '{print $2, $3}') if [ "$total_mb" -gt 0 ]; then - # Round to the nearest GB. Add 512MB for rounding before integer division. - echo $(((total_mb + 512) / 1024)) + # Round to the nearest GB. Add 512MB for rounding before integer division. + echo $(((total_mb + 512) / 1024)) else - get_cur_ram_from_proc + get_cur_ram_from_proc fi else get_cur_ram_from_proc @@ -235,6 +235,49 @@ load_profile() { esac } +is_sminer_workpaths_valid() { + local disk_path=$(yq eval '.miners[].diskPath' $config_path | xargs) + local each_space=$(yq eval '.miners[].UseSpace' $config_path | xargs) + read -a path_arr <<<"$disk_path" + read -a space_arr <<<"$each_space" + for i in "${!path_arr[@]}"; do + if [ ! -d "${path_arr[$i]}" ]; then + log_err "Path does not exist: ${path_arr[$i]}" + exit 1 + fi + + local cur_avail=$(df -B1G "${path_arr[$i]}" | awk 'NR==2{print $2}') # Get available space in GB + + result=$(echo "$cur_avail < ${space_arr[$i]}" | bc) + if [ "$result" -eq 1 ]; then + log_info "This configuration can make your storage nodes be frozen after running" + log_err "Only $cur_avail GB available in ${path_arr[$i]}, but set UseSpace: ${space_arr[$i]} GB in: $config_path" + exit 1 + fi + done +} + +is_cacher_workpath_valid() { + local enableCacher + enableCacher=$(yq eval '.cacher.enable' "$config_path") + if [ "$enableCacher" != "true" ]; then + return + fi + local work_path + work_path=$(yq eval '.cacher.WorkSpace' "$config_path") + if [ ! -d "$work_path" ]; then + log_err "Cacher Work Path does not exist: $work_path" + exit 1 + fi + # Check available space greater than 16 GiB + local cur_avail + cur_avail=$(df -B1G "$work_path" | awk 'NR==2 {print $4}') + if [ "$cur_avail" -lt 16 ]; then + log_info "Please keep 16 GiB available storage space for cacher at least" + exit 1 + fi +} + # Sets a new profile in the config file. set_profile() { local to_set="$1" @@ -267,8 +310,8 @@ enable_docker_api() { log_info "Enabling Docker Remote API..." local docker_service_file="/lib/systemd/system/docker.service" if [ ! -f "$docker_service_file" ]; then - log_err "Docker service file not found at $docker_service_file" - return 1 + log_err "Docker service file not found at $docker_service_file" + return 1 fi local backup_file="/lib/systemd/system/docker.service.bak" @@ -324,7 +367,6 @@ mk_sminer_workdir() { done } -# Splits the main miners config into individual files for each miner. split_miners_config() { log_info "Splitting miner configurations..." local miners_num @@ -333,10 +375,14 @@ split_miners_config() { local disk_path disk_path=$(yq eval ".miners[$i].diskPath" "$config_path") local miner_config_path="$disk_path/miner/config.yaml" - - yq eval ".miners[$i]" "$config_path" > "$miner_config_path" - - log_success "Generated miner config: $miner_config_path" + + local miner_config="yq eval '.[$i]' $build_dir/miners/config.yaml" + if ! eval $miner_config >$miner_config_path; then + log_err "Fail to generate storage node config file: $miner_config_path" + exit 1 + else + log_success "Generated miner config: $miner_config_path" + fi done } @@ -394,9 +440,9 @@ rand() { local max=$2 # Use /dev/urandom for better randomness if available if [ -c /dev/urandom ]; then - head -c 4 /dev/urandom | od -An -tu4 | awk -v min="$min" -v max="$max" '{print ($1 % (max-min+1)) + min}' + head -c 4 /dev/urandom | od -An -tu4 | awk -v min="$min" -v max="$max" '{print ($1 % (max-min+1)) + min}' else - # Fallback to date - echo $(( ( $(date +%s%N) % (max-min+1) ) + min )) + # Fallback to date + echo $((($(date +%s%N) % (max - min + 1)) + min)) fi } \ No newline at end of file diff --git a/scripts/version.sh b/scripts/version.sh index 7e3c4d2..d6c5ce5 100644 --- a/scripts/version.sh +++ b/scripts/version.sh @@ -37,14 +37,14 @@ show_version() { version=$(docker run --rm $extra_docker_opts "$image_name:$image_tag" "$version_cmd" 2>/dev/null || echo "error getting version") fi - printf "%-20s %-30s %-20s\n" "$prog_name" "$version" "$image_id" + printf "%-20s %-40s %-40s\n" "$prog_name" "$version" "$image_id" } # Displays versions of all relevant Docker images. inner_docker_version() { echo "----------------------------------------------------------------" printf "Docker Images:\n" - printf "%-20s %-30s %-20s\n" "IMAGE" "VERSION" "IMAGE ID" + printf "%-20s %-40s %-40s\n" "IMAGE" "VERSION" "IMAGE ID" show_version "config-gen" "cesslab/config-gen" "version" show_version "chain" "cesslab/cess-chain" "--version" show_version "miner" "cesslab/cess-miner" "version" @@ -53,7 +53,7 @@ inner_docker_version() { # Main function to display all version information. version() { printf "CESS Mineradm Version Information\n" - printf "---------------------------------\n" + printf "%s\n" "---------------------------------" printf "%-20s: %s\n" "Network" "$network_version" printf "%-20s: %s\n" "Mineradm Version" "$mineradm_version" printf "%-20s: %s\n" "Mode" "$(yq eval ".node.mode" "$config_path")" @@ -68,9 +68,4 @@ version() { fi inner_docker_version -} - -# --- Main Execution --- -# Load the profile from config before running. -load_profile -version \ No newline at end of file +} \ No newline at end of file