-
Notifications
You must be signed in to change notification settings - Fork 30
/
install-autMan.sh
90 lines (73 loc) · 2.27 KB
/
install-autMan.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#!/bin/bash
# 获取系统信息
os=$(awk -F= '/^NAME/{print $2}' /etc/os-release)
os=${os//\"/}
# 判断系统类型并执行相应的安装命令
if [[ $os == *"Debian"* ]] || [[ $os == *"Ubuntu"* ]]; then
# Debian 安装命令
echo "Installing Python 3 and pip on Debian..."
sudo apt update
sudo apt install -y python3 python3-pip
pip3 install requests
echo "Installing Node.js on Debian..."
curl -fsSL https://deb.nodesource.com/setup_16.x | sudo -E bash -
sudo apt install -y nodejs
sudo npm install axios
echo "Installing PHP on Debian..."
sudo apt install -y php
elif [[ $os == *"CentOS"* ]] || [[ $os==*"Oracle"* ]]; then
# CentOS 安装命令
echo "Installing Python 3 and pip on CentOS..."
sudo yum install -y epel-release
sudo yum install -y python3 python3-pip
pip3 install requests
echo "Installing Node.js on CentOS..."
curl -sL https://rpm.nodesource.com/setup_16.x | sudo bash -
sudo yum install -y nodejs
npm install axios
echo "Installing PHP on CentOS..."
sudo yum install -y php
elif [[ $os == *"OpenWrt"* ]]; then
# OpenWrt 安装命令
echo "Installing Python 3 and pip on OpenWrt..."
opkg update
opkg install python3 python3-pip
pip3 install requests
echo "Installing Node.js on OpenWrt..."
opkg install node
npm install axios
echo "Installing PHP on OpenWrt..."
opkg install php7
else
echo "Unsupported operating system: $os"
exit 1
fi
echo "Installation completed."
# GitHub
repo_owner="hdbjlizhe"
repo_name="fanli"
# 发送 API 请求获取最新发布信息
response=$(curl -s "https://api.github.com/repos/$repo_owner/$repo_name/releases/latest")
# 解析 JSON 响应,提取最新版本号
latest_version=$(echo "$response" | grep -oP '"tag_name": "\K.*?(?=")')
# 输出最新版本号
echo "Latest version of $repo_owner/$repo_name: $latest_version"
if [ ! "$latest_version" ];then
exit;
fi;
s=autMan;
a=arm64;
if [[ $(uname -a | grep "x86_64") != "" ]];then
a=amd64;
fi;
echo "创建文件夹$s"
if [ ! -d $s ];then
mkdir $s;
fi;
cd $s;
wget https://github.com/hdbjlizhe/fanli/releases/download/$latest_version/autMan_$a.tar.gz;
tar -zxvf autMan_$a.tar.gz;
rm -rf autMan_$a.tar.gz;
chmod 777 $s;
pkill -9 $s;
$(pwd)/$s -t;