Update Nimble.sh

This commit is contained in:
smeb y 2024-03-31 14:41:05 +08:00 committed by GitHub
parent d409900b1d
commit c123b702cb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,26 +1,32 @@
#!/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用户权限运行。" echo "此脚本需要以root用户权限运行。/This script needs to be run with root user privileges."
echo "请尝试使用 'sudo -i' 命令切换到root用户然后再次运行此脚本。" echo "请尝试使用 'sudo -i' 命令切换到root用户然后再次运行此脚本。/Please try to switch to root user with 'sudo -i' command, then run this script again."
exit 1 exit 1
fi fi
# 节点安装功能 # 节点安装功能
# Node installation function
function install_node() { function install_node() {
# 更新系统包列表 # 更新系统包列表
# Update system package list
apt update apt update
# 检查 Git 等是否已安装 # 检查 Git 等是否已安装
# Check if Git and others are already installed
apt install git python3-venv bison screen binutils gcc make bsdmainutils python3-pip -y apt install git python3-venv bison screen binutils gcc make bsdmainutils python3-pip -y
# 安装numpy # 安装numpy
# Install numpy
pip install numpy==1.24.4 pip install numpy==1.24.4
# 安装GO # 安装GO
# Install GO
rm -rf /usr/local/go rm -rf /usr/local/go
cd /usr/local cd /usr/local
wget https://go.dev/dl/go1.22.1.linux-amd64.tar.gz wget https://go.dev/dl/go1.22.1.linux-amd64.tar.gz
@ -30,21 +36,32 @@ source .bash_profile
go version go version
# 克隆官方仓库 # 克隆官方仓库
# Clone the official repository
mkdir $HOME/nimble && cd $HOME/nimble 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
cd wallet-public cd wallet-public
make install make install
# 创建钱包 # 创建钱包
# Create a wallet
nimble-networkd keys add ilovenimble nimble-networkd keys add ilovenimble
echo "=============================备份好钱包和助记词,下方需要使用===================================" echo "=============================备份好钱包和助记词,下方需要使用==================================="
echo "=============================Make sure to backup your wallet and mnemonic phrase, it will be needed below==================================="
sleep 30 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
echo "请先备份好助记词,然后再继续执行脚本。/Please backup the mnemonic phrase first, then continue running the script."
exit 1
fi
# 启动挖矿 # 启动挖矿
read -p "请输入钱包地址: " wallet_addr # Start mining
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
@ -59,17 +76,19 @@ screen -dmS nim bash -c 'make run addr=$wallet_addr'
} }
# 主菜单 # 主菜单
# Main menu
function main_menu() { function main_menu() {
clear clear
echo "请选择要执行的操作:" echo "请选择要执行的操作: /Please select an operation to execute:"
echo "1. 安装常规节点" echo "1. 安装常规节点 /Install a regular node"
read -p "请输入选项1: " OPTION read -p "请输入选项1: Please enter your choice (1): " OPTION
case $OPTION in case $OPTION in
1) install_node ;; 1) install_node ;;
*) echo "无效选项。" ;; *) echo "无效选项。/Invalid option." ;;
esac esac
} }
# 显示主菜单 # 显示主菜单
# Show the main menu
main_menu main_menu