Update Nimble.sh

This commit is contained in:
smeb y 2024-03-31 17:19:17 +08:00 committed by GitHub
parent dac9141ff5
commit 65fb057488
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,7 +1,6 @@
#!/bin/bash #!/bin/bash
# 检查是否以root用户运行脚本 # 检查是否以root用户运行脚本
# Check if the script is run as root
if [ "$(id -u)" != "0" ]; then if [ "$(id -u)" != "0" ]; then
echo "此脚本需要以root用户权限运行。/This script needs to be run with root user privileges." echo "此脚本需要以root用户权限运行。/This script needs to be run with root user privileges."
echo "请尝试使用 'sudo -i' 命令切换到root用户然后再次运行此脚本。/Please try to switch to root user with 'sudo -i' command, then run this script again." echo "请尝试使用 'sudo -i' 命令切换到root用户然后再次运行此脚本。/Please try to switch to root user with 'sudo -i' command, then run this script again."
@ -9,9 +8,7 @@ if [ "$(id -u)" != "0" ]; then
fi fi
# 导入Socks5代理 # 导入Socks5代理
# Import Socks5 proxy
read -p "请输入Socks5代理地址 (格式为 host:port),如不需要代理请留空: /Please enter the Socks5 proxy address (format host:port), leave blank if no proxy is needed: " proxy read -p "请输入Socks5代理地址 (格式为 host:port),如不需要代理请留空: /Please enter the Socks5 proxy address (format host:port), leave blank if no proxy is needed: " proxy
if [ ! -z "$proxy" ]; then if [ ! -z "$proxy" ]; then
export http_proxy=socks5://$proxy export http_proxy=socks5://$proxy
export https_proxy=socks5://$proxy export https_proxy=socks5://$proxy
@ -21,79 +18,57 @@ else
fi fi
# 节点安装功能 # 节点安装功能
# Node installation function
function install_node() { function install_node() {
# 更新系统包列表
# Update system package list
apt update apt update
apt install -y git python3-venv bison screen binutils gcc make bsdmainutils python3-pip
# 检查 Git 等是否已安装
# Check if Git and others are already installed
apt install git python3-venv bison screen binutils gcc make bsdmainutils python3-pip -y
# 安装GO # 安装GO
# Install GO
rm -rf /usr/local/go rm -rf /usr/local/go
cd $HOME wget https://go.dev/dl/go1.22.1.linux-amd64.tar.gz -P /tmp/
wget https://go.dev/dl/go1.22.1.linux-amd64.tar.gz tar -C /usr/local -xzf /tmp/go1.22.1.linux-amd64.tar.gz
tar -C /usr/local -xzf go1.22.1.linux-amd64.tar.gz
echo "export PATH=$PATH:/usr/local/go/bin:$HOME/go/bin" >> ~/.bashrc echo "export PATH=$PATH:/usr/local/go/bin:$HOME/go/bin" >> ~/.bashrc
source ~/.bashrc source ~/.bashrc
go version go version
# 克隆官方仓库并安装
# 克隆官方仓库 mkdir -p $HOME/nimble && cd $HOME/nimble
# Clone the official repository
cd $HOME
mkdir $HOME/nimble && cd $HOME/nimble
git clone https://github.com/nimble-technology/wallet-public.git git clone https://github.com/nimble-technology/wallet-public.git
export PATH=$PATH:/usr/local/go/bin:$HOME/go/bin
cd wallet-public cd wallet-public
make install make install
# 创建钱包 # 创建钱包
read -p "请输入你想要创建的钱包数量,首次创建需要生成两个钱包,一个做主钱包,一个作为挖矿钱包,需要提交官方审核/Enter the number of wallets you want to create: " wallet_count echo "首次创建需要生成两个钱包,一个作为主钱包,一个作为挖矿钱包,需要提交官方审核。"
read -p "请输入你想要创建的钱包数量/Enter the number of wallets you want to create: " wallet_count
for i in $(seq 1 $wallet_count); do for i in $(seq 1 $wallet_count); do
wallet_name="wallet$i" wallet_name="wallet$i"
nimble-networkd keys add $wallet_name nimble-networkd keys add $wallet_name
echo "钱包 $wallet_name 已创建/Wallet $wallet_name has been created." echo "钱包 $wallet_name 已创建/Wallet $wallet_name has been created."
done done
echo "=============================备份好钱包和助记词,下方需要使用===================================" echo "=============================备份好钱包和助记词下方需要使用==================================="
echo "=============================Make sure to backup your wallet and mnemonic phrase, it will be needed below===================================" echo "=============================Make sure to backup your wallet and mnemonic phrase, it will be needed below==================================="
# 确认备份
read -p "是否已经备份好助记词? Have you backed up the mnemonic phrase? (y/n) " backup_confirmed read -p "是否已经备份好助记词? Have you backed up the mnemonic phrase? (y/n) " backup_confirmed
# 如果用户没有确认备份,则退出脚本
# If the user did not confirm the backup, then exit the script
if [ "$backup_confirmed" != "y" ]; then if [ "$backup_confirmed" != "y" ]; then
echo "请先备份好助记词,然后再继续执行脚本。/Please backup the mnemonic phrase first, then continue running the script." echo "请先备份好助记词,然后再继续执行脚本。/Please backup the mnemonic phrase first, then continue running the script."
exit 1 exit 1
fi fi
# 启动挖矿 # 启动挖矿
# Start mining read -p "请输入挖矿钱包地址: Please enter your mining wallet address: " wallet_addr
read -p "请输入挖矿钱包地址: Please enter your wallet address: " wallet_addr
export wallet_addr export wallet_addr
cd $HOME/nimble cd $HOME/nimble
git clone https://github.com/nimble-technology/nimble-miner-public.git git clone https://github.com/nimble-technology/nimble-miner-public.git
cd nimble-miner-public cd nimble-miner-public
make install make install
cd $HOME
cd $HOME/nimble/nimble-miner-public
source ./nimenv_localminers/bin/activate source ./nimenv_localminers/bin/activate
screen -dmS nim bash -c 'make run addr=$wallet_addr' screen -dmS nim bash -c "make run addr=$wallet_addr"
echo "安装完成请输入命令screen -r nim 查看运行状态"
echo "安装完成,请输入命令 'screen -r nim' 查看运行状态。/Installation complete, enter 'screen -r nim' to view the running status."
} }
# 主菜单 # 主菜单
# Main menu
function main_menu() { function main_menu() {
clear clear
echo "请选择要执行的操作: /Please select an operation to execute:" echo "请选择要执行的操作: /Please select an operation to execute:"
@ -106,6 +81,4 @@ function main_menu() {
esac esac
} }
# 显示主菜单
# Show the main menu
main_menu main_menu