Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

install.sh #536

Open
supperthomas opened this issue Aug 26, 2024 · 2 comments
Open

install.sh #536

supperthomas opened this issue Aug 26, 2024 · 2 comments

Comments

@supperthomas
Copy link
Owner

在根目录下添加install.sh 后面跟toolchain参数

@supperthomas
Copy link
Owner Author

在不同的 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 下载工具。

@supperthomas
Copy link
Owner Author

supperthomas commented Aug 26, 2024

#!/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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant