commit c970f8b948494bfc56f7e9209b676cb7bb39b30c Author: smeb y <48400087+a3165458@users.noreply.github.com> Date: Fri Mar 22 15:15:15 2024 +0800 Create Nimble.sh diff --git a/Nimble.sh b/Nimble.sh new file mode 100644 index 0000000..ac7cd48 --- /dev/null +++ b/Nimble.sh @@ -0,0 +1,65 @@ +#!/bin/bash + +# 检查是否以root用户运行脚本 +if [ "$(id -u)" != "0" ]; then + echo "此脚本需要以root用户权限运行。" + echo "请尝试使用 'sudo -i' 命令切换到root用户,然后再次运行此脚本。" + exit 1 +fi + +# 节点安装功能 +function install_node() { + +# 更新系统包列表 +sudo apt update + +# 检查 Git 等是否已安装 +sudo apt install git python3-venv bison screen binutils gcc make bsdmainutils -y + +# 安装GO +sudo rm -rf /usr/local/go +curl -L https://go.dev/dl/go1.21.6.linux-amd64.tar.gz | sudo tar -xzf - -C /usr/local +echo 'export PATH=$PATH:/usr/local/go/bin:$HOME/go/bin' >> $HOME/.bash_profile +source .bash_profile + +# 克隆官方仓库 +mkdir $HOME/nimble && cd $HOME/nimble +git clone https://github.com/nimble-technology/wallet-public.git +cd wallet-public +make install + +# 创建钱包 +nimble-networkd keys add ilovenimble + +echo:备份好钱包和助记词,下方需要使用 + +sleep 30 + + +# 启动挖矿 +read -p "请输入钱包地址: " wallet_addr +cd $HOME/nimble +git clone https://github.com/nimble-technology/nimble-miner-public.git +cd nimble-miner-public +make install +source ./nimenv_localminers/bin/activate +screen -dmS Quili bash -c 'make run addr=$wallet_addr' + + +} + +# 主菜单 +function main_menu() { + clear + echo "请选择要执行的操作:" + echo "1. 安装常规节点" + read -p "请输入选项(1-3): " OPTION + + case $OPTION in + 1) install_node ;; + *) echo "无效选项。" ;; + esac +} + +# 显示主菜单 +main_menu