bluetoothlover_doc
bluetoothlover_doc copied to clipboard
install.sh
在根目录下添加install.sh 后面跟toolchain参数
在不同的 Linux 系统中,软件包管理命令有所不同。以下是几个主流 Linux 系统的软件包安装命令示例:
Ubuntu/Debian:
- apt-get install <package_name> :用于安装软件包。例如, apt-get install vim 安装 Vim 文本编辑器。
- apt install <package_name> :功能与 apt-get install 类似。
SUSE(openSUSE 和 SUSE Linux Enterprise):
- zypper install <package_name> :安装软件包。例如, zypper install firefox 安装 Firefox 浏览器。
Fedora/CentOS/RHEL:
- 在 Fedora 和基于 RPM 的系统中,常用 dnf install <package_name> 或 yum install <package_name> (较旧版本)来安装软件包。例如, dnf install wget 安装 Wget 下载工具。
#!/bin/bash
os_type=""
uname_result=$(uname -a)
if [[ $uname_result =~.*Linux.* ]]; then
if grep -q "SUSE" <<< "$uname_result"; then
os_type="suse"
else
os_type="ubuntu"
fi
elif [[ $uname_result =~.*Darwin.* ]]; then
os_type="macos"
elif [[ $uname_result =~.*CYGWIN.* || $uname_result =~.*MSYS.* || $uname_result =~.*Windows.* ]]; then
os_type="windows"
else
echo "Unsupported operating system."
exit 1
fi
case $os_type in
"suse")
# SUSE 安装逻辑
zypper install -y <package_name_for_suse>
;;
"ubuntu")
# Ubuntu 安装逻辑
apt-get update
apt-get install -y <package_name_for_ubuntu>
;;
"macos")
# macOS 安装逻辑
brew install <package_name_for_macos>
;;
"windows")
# Windows 安装逻辑
# 假设下载链接为 https://example.com/windows_installer.exe,安装程序名称为 installer.exe
(New-Object Net.WebClient).DownloadFile('https://example.com/windows_installer.exe', 'installer.exe')
Start-Process -Wait installer.exe
;;
esac