Nimble/Nimble.sh

66 lines
1.6 KiB
Bash
Raw Normal View History

2024-03-22 07:15:15 +00:00
#!/bin/bash
# 检查是否以root用户运行脚本
if [ "$(id -u)" != "0" ]; then
echo "此脚本需要以root用户权限运行。"
echo "请尝试使用 'sudo -i' 命令切换到root用户然后再次运行此脚本。"
exit 1
fi
# 节点安装功能
function install_node() {
# 更新系统包列表
2024-03-22 07:23:45 +00:00
apt update
2024-03-22 07:15:15 +00:00
# 检查 Git 等是否已安装
2024-03-22 07:23:45 +00:00
apt install git python3-venv bison screen binutils gcc make bsdmainutils -y
2024-03-22 07:15:15 +00:00
# 安装GO
2024-03-22 07:23:45 +00:00
rm -rf /usr/local/go
2024-03-22 07:31:55 +00:00
curl -L https://go.dev/dl/go1.21.6.linux-amd64.tar.gz | tar -xzf - -C /usr/local
2024-03-22 07:15:15 +00:00
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
2024-03-22 11:29:12 +00:00
echo "=============================备份好钱包和助记词,下方需要使用==================================="
2024-03-22 07:15:15 +00:00
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
2024-03-22 09:40:24 +00:00
cd $HOME
2024-03-22 10:01:55 +00:00
screen -dmS nim bash -c 'cd $HOME/nimble; cd nimble-miner-public; source /root/.bashrc; make run addr=$wallet_addr'
2024-03-22 07:15:15 +00:00
}
# 主菜单
function main_menu() {
clear
echo "请选择要执行的操作:"
echo "1. 安装常规节点"
2024-03-22 08:35:35 +00:00
read -p "请输入选项1: " OPTION
2024-03-22 07:15:15 +00:00
case $OPTION in
1) install_node ;;
*) echo "无效选项。" ;;
esac
}
# 显示主菜单
main_menu