Skip to content

Commit

Permalink
Update install.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
gooaclok819 authored Oct 24, 2024
1 parent b763eca commit 0d0299d
Showing 1 changed file with 2 additions and 66 deletions.
68 changes: 2 additions & 66 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,69 +52,5 @@ echo "服务已启动并已设置为开机启动"
echo "默认账号admin密码123456 端口8000"
echo "安装完成已经启动输入sudo sublink可以呼出菜单"

#!/bin/bash

# 创建sublink.sh脚本内容并写入到 /usr/bin/sublink
echo '#!/bin/bash
function Select {
# 获取最新的发行版标签
latest_release=$(curl --silent "https://api.github.com/repos/gooaclok819/sublinkX/releases/latest" | grep '\"tag_name\":' | sed -E 's/.*\"([^\"]+)\".*/\1/')
# 获取服务状态
status=$(systemctl is-active sublink)
echo "最新版本:$latest_release"
echo "当前版本: 1.6"
# 判断服务状态并打印
if [ "$status" = "active" ]; then
echo "当前运行状态: 已运行"
else
echo "当前运行状态: 未运行"
fi
echo "1. 启动服务"
echo "2. 停止服务"
echo "3. 卸载安装"
echo "4. 查看服务状态"
echo "5. 查看运行目录"
echo "0. 退出"
echo -n "请选择一个选项: "
read option
case $option in
1)
systemctl start sublink
systemctl daemon-reload
;;
2)
systemctl stop sublink
systemctl daemon-reload
;;
3)
systemctl stop sublink
systemctl disable sublink
rm /etc/systemd/system/sublink.service
systemctl daemon-reload
rm /usr/bin/sublink
;;
4)
systemctl status sublink
;;
5)
echo "运行目录: /usr/local/bin/sublink"
echo "需要备份的目录为db,template目录为模版文件可备份可不备份"
cd /usr/local/bin/sublink
echo "已经切换到运行目录"
;;
0)
exit 0
;;
*)
echo "无效的选项,请重新选择"
Select
;;
esac
}
Select
' | sudo tee /usr/bin/sublink

# 将sublink脚本移动到 /usr/bin 并赋予执行权限
sudo chmod 755 /usr/bin/sublink
sudo curl -o /usr/bin/sublink/menu.sh https://raw.githubusercontent.com/gooaclok819/sublinkX/main/menu.sh
sudo chmod 755 /usr/bin/sublink/menu.sh

0 comments on commit 0d0299d

Please sign in to comment.