-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
go-openbmclapi-depend.sh
56 lines (50 loc) · 1.18 KB
/
go-openbmclapi-depend.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
#!/bin/bash
# 检测系统发行版类型并安装相应的前置包
# 检测系统发行版
detect_linux_distro() {
if [ -f /etc/os-release ]; then
. /etc/os-release
if [ -n "$ID" ]; then
echo "$ID"
return
fi
elif [ -f /etc/redhat-release ]; then
echo "Red Hat"
return
elif [ -f /etc/debian_version ]; then
echo "Debian"
return
fi
echo "Unknown"
}
# 安装前置包
install_dependencies() {
distro="$1"
case "$distro" in
"ubuntu" | "debian")
sudo apt update
sudo apt install -y rclone fuse3
;;
"fedora" | "centos" | "rhel")
sudo yum update
sudo yum install -y rclone fuse3
;;
"arch" | "manjaro")
sudo pacman -Syu
sudo pacman -S --noconfirm rclone fuse3
;;
*)
echo "不支持的发行版类型: $distro"
exit 1
;;
esac
}
# 主程序
main() {
distro=$(detect_linux_distro)
echo "检测到的发行版类型: $distro"
install_dependencies "$distro"
echo "前置包安装完成."
}
# 执行主程序
main