Update Artela.sh

This commit is contained in:
smeb y 2024-03-26 16:56:52 +08:00 committed by GitHub
parent 13b4e9180e
commit f48c2c7f75
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -121,7 +121,8 @@ sudo apt install snapd -y
sudo snap install lz4 sudo snap install lz4
# 下载并解压快照 # 下载并解压快照
curl https://testnet-files.itrocket.net/artela/snap_artela.tar.lz4 | lz4 -dc - | tar -xf - -C $HOME/.artelad SNAP_NAME=$(curl -s https://ss-t.artela.nodestake.org/ | egrep -o ">20.*\.tar.lz4" | tr -d ">")
curl -o - -L https://ss-t.artela.nodestake.org/${SNAP_NAME} | lz4 -c -d - | tar -x -C $HOME/.artelad
# 重新加载和启动服务 # 重新加载和启动服务
sudo systemctl daemon-reload sudo systemctl daemon-reload
@ -131,6 +132,7 @@ sudo systemctl restart artelad && sudo journalctl -u artelad -f
# 完成设置 # 完成设置
echo '====================== 安装完成 ===========================' echo '====================== 安装完成 ==========================='
echo '安装完成请重新连接VPS以启用对应快捷键功能'
} }
@ -168,58 +170,60 @@ function view_logs() {
} }
# 卸载脚本功能 # 卸载脚本功能
function uninstall_script() { function uninstall_node() {
local alias_name="babylondf" echo "你确定要卸载Artela 节点程序吗?这将会删除所有相关的数据。[Y/N]"
local shell_rc_files=("$HOME/.bashrc" "$HOME/.zshrc") read -r -p "请确认: " response
for shell_rc in "${shell_rc_files[@]}"; do case "$response" in
if [ -f "$shell_rc" ]; then [yY][eE][sS]|[yY])
# 移除快捷键 echo "开始卸载节点程序..."
sed -i "/alias $alias_name='bash $SCRIPT_PATH'/d" "$shell_rc" sudo systemctl stop artelad && sudo systemctl disable artelad && sudo rm /etc/systemd/system/artelad.service && sudo systemctl daemon-reload && rm -rf $HOME/.artelad && rm -rf artela && sudo rm -rf $(which artelad)
fi
done
echo "快捷键 '$alias_name' 已从shell配置文件中移除。" echo "节点程序卸载完成。"
read -p "是否删除脚本文件本身?(y/n): " delete_script ;;
if [[ "$delete_script" == "y" ]]; then *)
rm -f "$SCRIPT_PATH" echo "取消卸载操作。"
echo "脚本文件已删除。" ;;
else esac
echo "脚本文件未删除。"
fi
} }
# 主菜单 # 主菜单
function main_menu() { function main_menu() {
clear while true; do
echo "脚本以及教程由推特用户大赌哥 @y95277777 编写,免费开源,请勿相信收费" clear
echo "================================================================" echo "脚本以及教程由推特用户大赌哥 @y95277777 编写,免费开源,请勿相信收费"
echo "节点社区 Telegram 群组:https://t.me/niuwuriji" echo "================================================================"
echo "节点社区 Telegram 频道:https://t.me/niuwuriji" echo "节点社区 Telegram 群组:https://t.me/niuwuriji"
echo "请选择要执行的操作:" echo "节点社区 Telegram 频道:https://t.me/niuwuriji"
echo "1. 安装节点" echo "退出脚本请按键盘ctrl c退出即可"
echo "2. 创建钱包" echo "请选择要执行的操作:"
echo "3. 导入钱包" echo "1. 安装节点"
echo "4. 查看钱包地址余额" echo "2. 创建钱包"
echo "5. 查看节点同步状态" echo "3. 导入钱包"
echo "6. 查看当前服务状态" echo "4. 查看钱包地址余额"
echo "7. 运行日志查询" echo "5. 查看节点同步状态"
echo "8. 卸载脚本" echo "6. 查看当前服务状态"
echo "9. 设置快捷键" echo "7. 运行日志查询"
read -p "请输入选项1-9: " OPTION echo "8. 卸载节点"
echo "9. 设置快捷键"
read -p "请输入选项0-9: " OPTION
case $OPTION in case $OPTION in
1) install_node ;; 1) install_node ;;
2) add_wallet ;; 2) add_wallet ;;
3) import_wallet ;; 3) import_wallet ;;
4) check_balances ;; 4) check_balances ;;
5) check_sync_status ;; 5) check_sync_status ;;
6) check_service_status ;; 6) check_service_status ;;
7) view_logs ;; 7) view_logs ;;
8) uninstall_script ;; 8) uninstall_node ;;
9) check_and_set_alias ;; 9) check_and_set_alias ;;
*) echo "无效选项。" ;; *) echo "无效选项。" ;;
esac esac
echo "按任意键返回主菜单..."
read -n 1
done
} }
# 显示主菜单 # 显示主菜单