Open supperthomas opened 2 weeks ago
在不同的 Linux 系统中,软件包管理命令有所不同。以下是几个主流 Linux 系统的软件包安装命令示例:
Ubuntu/Debian:
SUSE(openSUSE 和 SUSE Linux Enterprise):
Fedora/CentOS/RHEL:
#!/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
在根目录下添加install.sh 后面跟toolchain参数