diff --git a/Quili.sh b/Quili.sh index f5f258e..2d920e5 100644 --- a/Quili.sh +++ b/Quili.sh @@ -114,102 +114,74 @@ echo ====================================== 安装完成 ======================= } - # 节点安装功能 -function install_node_service() { - -# 检查是否以root用户执行脚本 -if [ "$(id -u)" != "0" ]; then - echo "该脚本必须以root权限运行" 1>&2 - exit 1 +function install_node_mac() { +# 安装 Homebrew 包管理器(如果尚未安装) +if ! command -v brew &> /dev/null; then + echo "Homebrew 未安装。正在安装 Homebrew..." + /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" fi -# 增加swap空间 -sudo mkdir /swap -sudo fallocate -l 24G /swap/swapfile -sudo chmod 600 /swap/swapfile -sudo mkswap /swap/swapfile -sudo swapon /swap/swapfile -echo '/swap/swapfile swap swap defaults 0 0' >> /etc/fstab +# 更新 Homebrew 并安装必要的软件包 +brew update +brew install wget git screen bison gcc make -# 向/etc/sysctl.conf文件追加内容 -echo -e "\n# 自定义最大接收和发送缓冲区大小" >> /etc/sysctl.conf -echo "net.core.rmem_max=600000000" >> /etc/sysctl.conf -echo "net.core.wmem_max=600000000" >> /etc/sysctl.conf - -echo "配置已添加到/etc/sysctl.conf" - -# 重新加载sysctl配置以应用更改 -sysctl -p - -echo "sysctl配置已重新加载" - -# 更新并升级Ubuntu软件包 -sudo apt update && sudo apt -y upgrade - -# 安装wget、screen和git等组件 -sudo apt install git ufw bison screen binutils gcc make bsdmainutils -y - -# 安装GVM +# 安装 gvm bash < <(curl -s -S -L https://raw.githubusercontent.com/moovweb/gvm/master/binscripts/gvm-installer) -source /root/.gvm/scripts/gvm +source $HOME/.gvm/scripts/gvm +# 获取系统架构 +ARCH=$(uname -m) + +# 安装并使用 go1.4 作为 bootstrap gvm install go1.4 -B gvm use go1.4 export GOROOT_BOOTSTRAP=$GOROOT -gvm install go1.17.13 -gvm use go1.17.13 -export GOROOT_BOOTSTRAP=$GOROOT -gvm install go1.20.2 -gvm use go1.20.2 + +# 根据系统架构安装相应的 Go 版本 +if [ "$ARCH" = "x86_64" ]; then + gvm install go1.17.13 + gvm use go1.17.13 + export GOROOT_BOOTSTRAP=$GOROOT + + gvm install go1.20.2 + gvm use go1.20.2 +elif [ "$ARCH" = "arm64" ] || [ "$ARCH" = "aarch64" ]; then + gvm install go1.17.13 -B + gvm use go1.17.13 + export GOROOT_BOOTSTRAP=$GOROOT + + gvm install go1.20.2 -B + gvm use go1.20.2 +else + echo "无法支持的版本: $ARCH" + exit 1 +fi # 克隆仓库 git clone https://github.com/quilibriumnetwork/ceremonyclient -# 进入ceremonyclient/node目录 -cd ceremonyclient/node -# 构建服务 -GOEXPERIMENT=arenas go install ./... +# 构建 Qclient +cd ceremonyclient/client +GOEXPERIMENT=arenas go build -o qclient main.go +sudo cp $HOME/ceremonyclient/client/qclient /usr/local/bin -# 写入服务 -sudo tee /lib/systemd/system/ceremonyclient.service > /dev/null <