Skip to content
New issue

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

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

Already on GitHub? # to your account

Add support of AOSC OS and loongson architecture #3593

Open
wants to merge 60 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 43 commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
b564c27
Add support of AOSC OS and loongson architecture
4Darmygeometry Jan 4, 2025
1e796cc
Update README.md
4Darmygeometry Jan 4, 2025
27bc5e6
Add LoongArch64 build script
4Darmygeometry Jan 4, 2025
4eb12ca
Add LoongArch64 Library Support
4Darmygeometry Jan 4, 2025
34e0507
标记统一使用.NET 9.0使得龙芯新世界代码与主线一致
4Darmygeometry Jan 5, 2025
a98edcd
Update README.md
4Darmygeometry Jan 5, 2025
6a83db6
Update README.en.md
4Darmygeometry Jan 5, 2025
61ba400
Update README.md
4Darmygeometry Jan 5, 2025
193147f
Update README.md
4Darmygeometry Jan 6, 2025
ec5a1d3
Update open-source-library.md
4Darmygeometry Jan 6, 2025
9be4b56
Update open-source-library.md
4Darmygeometry Jan 6, 2025
bfb3223
Merge branch 'BeyondDimension:develop' into develop
4Darmygeometry Jan 6, 2025
158fbba
Update README.md
4Darmygeometry Jan 6, 2025
8765655
Update README.en.md
4Darmygeometry Jan 6, 2025
2aa866d
添加libpng前置依赖所需的loongarch64 c文件
4Darmygeometry Jan 6, 2025
f8ce1d6
✨ 发布工具支持 RiscV64、, LoongArch64 发布
Mossimos Jan 7, 2025
8a10c47
添加龙芯3A6000电脑原生运行截图
4Darmygeometry Jan 7, 2025
17fe8dc
Update README.md
4Darmygeometry Jan 7, 2025
8bf605d
添加龙芯3A6000电脑加速github截图
4Darmygeometry Jan 8, 2025
ff9494c
添加龙芯nuget源注意事项
4Darmygeometry Jan 8, 2025
501b180
删除次要截图
4Darmygeometry Jan 8, 2025
2707dda
删除次要截图
4Darmygeometry Jan 8, 2025
44295a9
Add English screenshots
4Darmygeometry Jan 8, 2025
a805e24
Update README.en.md
4Darmygeometry Jan 8, 2025
700cd73
Add English Support
4Darmygeometry Jan 8, 2025
72d4be1
Update online_install.sh
4Darmygeometry Jan 8, 2025
e52b012
支持AOSC OS
4Darmygeometry Jan 8, 2025
6119ffb
支持中文和其他语言的的桌面文件夹
4Darmygeometry Jan 8, 2025
847d400
更新 README.md
4Darmygeometry Jan 9, 2025
c9d1280
Merge branch 'BeyondDimension:develop' into develop
4Darmygeometry Jan 11, 2025
52e830f
更新判断发行版方式测试文件
4Darmygeometry Jan 12, 2025
2fde011
通过/etc/os-release形式判断发行版并支持slackware等发行版包格式
4Darmygeometry Jan 13, 2025
472f7b8
Update README.md
4Darmygeometry Jan 13, 2025
214af04
紧急修改sh错误
4Darmygeometry Jan 13, 2025
4cd8fc2
Update README.md
4Darmygeometry Jan 13, 2025
7b7fc4c
Add files via upload
4Darmygeometry Jan 13, 2025
03dfad9
Add files via upload
4Darmygeometry Jan 13, 2025
bad37b3
Delete loongson-build.md
4Darmygeometry Jan 13, 2025
152cea3
Update README.md
4Darmygeometry Jan 13, 2025
bf32fef
把AOSC OS放在前面
4Darmygeometry Jan 14, 2025
0538ae5
纠正中科方德安装包错误并支持勇豹系统
4Darmygeometry Jan 16, 2025
1a6441b
脚本已无需依赖pv,去掉pv安装选项
4Darmygeometry Jan 16, 2025
233da9f
Update README.md
4Darmygeometry Jan 16, 2025
2560cdf
恢复回原来的readme
4Darmygeometry Jan 17, 2025
923418c
Delete doc/loongson-build.md
4Darmygeometry Jan 17, 2025
6a15d6e
Delete res/screenshots/linux-3A6000-ASF-en.png
4Darmygeometry Jan 17, 2025
652401e
Delete res/screenshots/linux-3A6000-ASF.png
4Darmygeometry Jan 17, 2025
dd09b1d
Delete res/screenshots/linux-3A6000-accelerate-en.png
4Darmygeometry Jan 17, 2025
a1cb858
Delete res/screenshots/linux-3A6000-accelerate.png
4Darmygeometry Jan 17, 2025
3a1669f
Delete res/screenshots/linux-3A6000-settings-en.png
4Darmygeometry Jan 17, 2025
80bdae0
Delete res/screenshots/linux-3A6000-settings.png
4Darmygeometry Jan 17, 2025
aa712fb
Merge branch 'BeyondDimension:develop' into develop
4Darmygeometry Jan 23, 2025
1a0642b
尝试解决分支冲突
4Darmygeometry Jan 23, 2025
8590d5c
Merge branch 'develop' into develop
4Darmygeometry Jan 23, 2025
a2d834f
重新添加龙架构判断
4Darmygeometry Jan 23, 2025
e90a359
更新龙架构编译脚本
4Darmygeometry Jan 23, 2025
d21c5b7
更新龙架构构建脚本
4Darmygeometry Jan 24, 2025
e05a732
dotnet 9.0
4Darmygeometry Jan 24, 2025
9bca062
update mac script to dotnet 9.0
4Darmygeometry Jan 24, 2025
06b1156
Merge branch 'BeyondDimension:develop' into develop
4Darmygeometry Feb 14, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 49 additions & 3 deletions README.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ English | [简体中文](./README.md)
[![GitHub Fork](https://img.shields.io/github/forks/BeyondDimension/SteamTools?style=flat-square)](https://github.com/BeyondDimension/SteamTools/network/members)
![GitHub Repo size](https://img.shields.io/github/repo-size/BeyondDimension/SteamTools?style=flat-square&color=3cb371)
[![GitHub Repo Languages](https://img.shields.io/github/languages/top/BeyondDimension/SteamTools?style=flat-square)](https://github.com/BeyondDimension/SteamTools/search?l=c%23)
[![NET 7.0](https://img.shields.io/badge/dotnet-7.0-purple.svg?style=flat-square&color=512bd4)](https://learn.microsoft.com/en-us/dotnet/core/whats-new/dotnet-7)
[![C# 11](https://img.shields.io/badge/c%23-11-brightgreen.svg?style=flat-square&color=6da86a)](https://learn.microsoft.com/en-us/dotnet/csharp/whats-new/csharp-11)
[![NET 9.0](https://img.shields.io/badge/.NET-9.0-purple.svg?style=flat-square&color=512bd4)](https://learn.microsoft.com/zh-cn/dotnet/core/whats-new/dotnet-9/overview)
[![C# 13](https://img.shields.io/badge/C%23-13-brightgreen.svg?style=flat-square&color=6da86a)](https://learn.microsoft.com/zh-cn/dotnet/csharp/whats-new/csharp-13)

[![Kofi](https://img.shields.io/badge/Kofi-RMBGAME-orange.svg?style=flat-square&logo=kofi)](https://ko-fi.com/rmbgame)
[![Patreon](https://img.shields.io/badge/Patreon-RMBGAME-red.svg?style=flat-square&logo=patreon)](https://www.patreon.com/rmbgame)
Expand Down Expand Up @@ -50,7 +50,10 @@ See details [./doc/download-guide.en.md](./doc/download-guide.en.md)
5. Game Tools <img src="./res/brands/windows.svg" width="16" height="16" />
- Force game windows to use borderless windowing

## 🖥 Supported Operating Systems
## 🖥️ Supported Operating Systems
### The operating systems listed below are all x86-64 versions of the respective operating systems. Users of older Windows versions such as Windows 7, 8.1, or 32-bit operating systems are advised to download the older versions from the Release section for use.
### ARM Processor users, please download the stable version from the Release section or build it yourself.
### The LoongArch64 version is currently in the dev build stage, and stable software packages have not yet been built. Please wait. To run the LoongArch64 version of Watt Toolkit, you need to meet the requirements of Linux kernel>=6.6 and glibc>=2.40. Users of deepin 23 and loongnix 25 need to first run "sudo apt install libpng-dev" before being able to use the software normally.
- Windows 11
- Windows 10 version 1809(OS internal version 17763) or higher is required
- macOS 10.15 or higher is required
Expand All @@ -60,17 +63,35 @@ See details [./doc/download-guide.en.md](./doc/download-guide.en.md)
- Deepin(UOS) 20 or higher is required
- ~~iOS 11 or higher is required~~(In development…)
- Android 5.0(API 21) or higher is required
- AOSC OS 12(Localhost) or higher is required

## 🔲 Supported Processors
### X86 Processor
- An x86-64 CPU that meets or exceeds the minimum requirements for the installation of the aforementioned operating system
- For Zhaoxin processors, it is recommended to use KX-U6780A or above to ensure smooth program execution.
### ARM Processor
- CPUs supporting ARM V8 (aarch64) or above
- For Phytium processor, it is recommended to use the Phytium D2000 or above to ensure smooth program execution.
### Loongson Processor
- LoongArch64 CPUs with LSX extension instructions, such as 3A5000 and above. MIPS (LoongISA), LoongArch32, or CPUs without LSX extension instructions, such as 3A4000 and 2K0300, are not supported.

## 🧩 Screenshots
<img src="./res/screenshots/screenshot-windows-accelerator.webp" width="800" />
<br/>
<img src="./res/screenshots/linux-3A6000-accelerate-en.png" width="800" />
<br/>
<img src="./res/screenshots/linux-3A6000-ASF-en.png" width="800" />
<br/>
<img src="./res/screenshots/linux-3A6000-settings-en.png" width="800" />
<br/>
<br/>
<img src="./res/screenshots/screenshot-android-authenticator.png" width="800" />

## 🌏 Roadmap
Read what we [milestones](https://github.com/BeyondDimension/SteamTools/milestones), and feel free to ask questions.

## ⌨️ Development Environment
### Windows and Mac
[Visual Studio 2022](https://visualstudio.microsoft.com/vs)
[Visual Studio 2022 for Mac](https://visualstudio.microsoft.com/vs/mac)
[JetBrains Rider](https://www.jetbrains.com/rider)
Expand All @@ -79,6 +100,31 @@ Read what we [milestones](https://github.com/BeyondDimension/SteamTools/mileston
[Android Studio Electric Eel Or Higher](https://developer.android.com/studio)
[Xcode 14 Or Higher](https://developer.apple.com/xcode)

### Special Requirements for Building LoongArch64 Version
The LoongArch64 version of Watt Toolkit only supports building on LoongArch64 physical machines with LSX, such as Loongson 3A5000 and above; or using X86 Linux to cross compilated dotnet 9. The building principles follow the [Software Development and Build Convention for LoongArch™ Architectures](https://github.com/loongson/la-softdev-convention).
The LoongArch64 version only builds the New World version.
- System requirements
- [AOSC OS 12 or higher is required](https://aosc.io/download)
- loongnix 25 or higher is required
- [Deepin 25 or higher is required](https://www.deepin.org/zh/download/)
- Yongbao 2.9 or higher is required
- [Alpine Linux 3.21.0 or higher is required](https://alpinelinux.org/downloads/)
- [GXDE OS 15.14.2 or higher is required](https://www.gxde.top/)
- [Debian 13 or higher is required](https://www.debian.org/)
- Work load
- .NET version
- [.NET 9.0 and above](https://github.com/loongson-community/dotnet-unofficial-build)
- vscodium
- [vscodium 1.96.2.24355 and above](https://github.com/VSCodium/vscodium)
- Web and Cloud
- ASP.NET and Web Development
- Desktop applications
- .NET desktop development

### Due to the fact that the new world NuGet has not yet been fully upstreamed, the LoongArch64 version of this project uses the NuGet source provided by [Loongson Open Source Community](https://nuget.loongnix.cn) to provide SkiaSharp, HarfBuzzSharp, etc. This also allows compatibility with the three old world distributions: Loongnix 20, UOS 20, and Kylin.
### Users of the LoongArch64 in the old world can download the .NET 9 and later versions from the [Loongson Open Source Community](https://www.loongnix.cn/zh/api/dotnet/) to compile this project. For common issues, please refer to the [reference documentation](https://docs.loongnix.cn/dotnet/support/list/01.%E5%B8%B8%E8%A7%81%E9%97%AE%E9%A2%98-FAQ.html#%E9%BE%99%E8%8A%AFnuget%E6%BA%90%E7%9A%84%E9%85%8D%E7%BD%AE%E6%96%B9%E6%B3%95).
### When compiling this project for users of the new world architecture, there is a possibility of incorporating old world binary files. It is recommended to install the [liblol old world compatibility tool](https://liblol.aosc.io) to ensure normal compilation and operation. AOSC OS, Deepin 23, and Yongbao generally come with liblol preinstalled, so no additional installation is required.

## 🏗️ Project Structure
See details&nbsp;&nbsp;[./src/README.md](./src/README.md)

Expand Down
74 changes: 70 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
[![GitHub Fork](https://img.shields.io/github/forks/BeyondDimension/SteamTools?style=flat-square)](https://github.com/BeyondDimension/SteamTools/network/members)
![GitHub Repo size](https://img.shields.io/github/repo-size/BeyondDimension/SteamTools?style=flat-square&color=3cb371)
[![GitHub Repo Languages](https://img.shields.io/github/languages/top/BeyondDimension/SteamTools?style=flat-square)](https://github.com/BeyondDimension/SteamTools/search?l=c%23)
[![NET 7.0](https://img.shields.io/badge/dotnet-7.0-purple.svg?style=flat-square&color=512bd4)](https://learn.microsoft.com/zh-cn/dotnet/core/whats-new/dotnet-7)
[![C# 11](https://img.shields.io/badge/c%23-11-brightgreen.svg?style=flat-square&color=6da86a)](https://learn.microsoft.com/zh-cn/dotnet/csharp/whats-new/csharp-11)
[![NET 9.0](https://img.shields.io/badge/.NET-9.0-purple.svg?style=flat-square&color=512bd4)](https://learn.microsoft.com/zh-cn/dotnet/core/whats-new/dotnet-9/overview)
[![C# 13](https://img.shields.io/badge/C%23-13-brightgreen.svg?style=flat-square&color=6da86a)](https://learn.microsoft.com/zh-cn/dotnet/csharp/whats-new/csharp-13)

[![爱发电](https://img.shields.io/badge/爱发电-软妹币玩家-blue.svg?style=flat-square&color=ea4aaa&logo=github-sponsors)](https://afdian.com/@rmbgame)
[![Kofi](https://img.shields.io/badge/Kofi-RMBGAME-orange.svg?style=flat-square&logo=kofi)](https://ko-fi.com/rmbgame)
Expand Down Expand Up @@ -62,16 +62,72 @@
7. 游戏工具 <img src="./res/brands/windows.svg" width="16" height="16" />
- 强制游戏窗口使用无边框窗口化、更多功能待开发。

## 🖥 支持的操作系统
## 🖥️ 支持的操作系统
### 下面所列操作系统为该操作系统的x86-64版本。Windows 7、8.1等旧版Windows用户、Windows 10版本低于1809的用户或32位操作系统用户请在Release中下载旧版使用。
- Windows 11
- Windows 10 版本 1809(OS 内部版本 17763)或更高版本
- macOS 10.15 或更高版本
- Ubuntu 20.04 或更高版本
- Debian 11 或更高版本
- Fedora 37 或更高版本
- Deepin(UOS) 20 或更高版本
- ~~iOS 11 或更高版本~~(开发中…)
- AOSC OS 12(Localhost) 或更高版本
- 中科方德桌面版 5.0 或更高版本
### ARM PC用户请下载Release中的稳定版或自行构建,手机用户支持如下版本:
- Android 5.0(API 21) 或更高版本
- ~~iOS 11 或更高版本~~(开发中…)
- 使用鸿蒙系统的手机用户等后续适配。
### 龙芯用户请下载Release中的测试版。运行Watt Toolkit龙芯版需达到Linux内核>=6.6、glibc>=2.40的要求(deepin 23除外)。下列为龙芯版目前所适配的操作系统(均为新世界系统):
- [Deepin 23 或更高版本](https://www.deepin.org/zh/download/)
- [AOSC OS 12 或更高版本](https://aosc.io/download)
- Loongnix 25 或更高版本
- [Loongnix Server 23.1 或更高版本](http://pkg.loongnix.cn/loongnix-server/23.1/isos/)
- [Yongbao 2.10 或更高版本](https://mirrors.wsyu.edu.cn/fedora/linux/Yongbao/2.10/) 16K内核
### 常见问题
#### Deepin 23:
- error while loading shared libraries: unexpected reloc type 0x0e

原因:glibc版本过旧

解决办法:sudo apt update,再sudo apt dist-upgrade,将龙架构deepin 23升级至最新版
- certutil: function failed: SEC_ERROR_BAD_DATABASE: security library: bad database

原因:主文件夹中没有.pki文件夹或内容存在问题

解决方法:手动运行脚本中的environment_check.sh,重新生成文件夹
#### Yongbao(勇豹):
- error while loading shared libraries: cannot apply additional memory protection after relocation: Cannot allocate memory

原因:使用4K内核启动勇豹系统,目前加速功能仅能在16K LoongArch64内核下正常工作

解决方法:换16K内核启动,或者忽略警告,使用除加速功能外的其他功能
- Failed to load System.Private.CoreLib.dll (error code 0x8007000E)
Path: ./WattToolkit/dotnet/shared/Microsoft.NETCore.App/9.0.0/System.Private.CoreLib.dll
Error message: Out Of Memory
Failed to create CoreCLR, HRESULT: 0x8007000E

原因:使用64K内核启动勇豹系统,软件目前不支持该内核

解决方法:换16K内核启动
- pkexec must be setuid root

原因:pkexec未获得权限

解决方法:sudo chmod u+s $(which pkexec)
- StartProxyFail: BindPortError

原因:勇豹只支持System代理加速

解决方法:将host代理加速改成system代理加速
## 🔲 支持的处理器
### X86处理器
- 满足上述操作系统安装最低要求及以上的的x86-64 CPU
- 对于兆芯处理器,建议使用KX-U6780A及以上处理器以保障程序可以流畅运行。
### ARM处理器
- ARM V8(aarch64)及以上CPU
- 对于飞腾处理器,建议使用飞腾D2000及以上处理器以保障程序可以流畅运行。
### 龙芯
- 3A5000及以上含有LSX扩展指令的LoongArch64 CPU。MIPS(LoongISA)、LoongArch32或不含有LSX扩展指令的,如3A4000、2K0300,在此不受支持。

## 🧩 截图
<img src="./res/screenshots/screenshot-windows-accelerator.webp" width="800" />
Expand All @@ -80,6 +136,12 @@
<br/>
<img src="./res/screenshots/screenshot-windows-gamelist.webp" width="800" />
<br/>
<img src="./res/screenshots/linux-3A6000-accelerate.png" width="800" />
<br/>
<img src="./res/screenshots/linux-3A6000-ASF.png" width="800" />
<br/>
<img src="./res/screenshots/linux-3A6000-settings.png" width="800" />
<br/>
<br/>
<!--<img src="./res/screenshots/screenshot-android-authenticator.png" width="800" />-->

Expand All @@ -93,6 +155,7 @@
查看这个 [milestones](https://github.com/BeyondDimension/SteamTools/milestones) 来了解我们下一步的开发计划,并随时提出问题。

## ⌨️ 开发环境
### Windows与Mac环境构建要求
[Visual Studio 2022](https://visualstudio.microsoft.com/zh-hans/vs) 或 [Visual Studio 2022 for Mac](https://visualstudio.microsoft.com/zh-hans/vs/mac)
- 系统要求
- [Windows 11 版本 21H2 或更高版本:家庭版、专业版、专业教育版、专业工作站版、企业版和教育版](https://learn.microsoft.com/zh-cn/visualstudio/releases/2022/system-requirements)
Expand All @@ -116,6 +179,9 @@
[Android Studio Electric Eel 或更高版本](https://developer.android.google.cn/studio)
[Xcode 14 或更高版本](https://developer.apple.com/xcode)

### 龙芯版构建特殊要求
详见&nbsp;&nbsp;[./doc/loongson-build.md](./doc/loongson-build.md)

## 🏗️ [项目结构](./src/README.md)
详见&nbsp;&nbsp;[./src/README.md](./src/README.md)

Expand Down
24 changes: 22 additions & 2 deletions build/linux/Steam++.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,30 @@ export DOTNET_ROOT="$dotnet_path"
link_exec="$run_path/Steam++"
# 判断符号链接是否存在
if [ -L "$link_exec" ]; then
echo "符号链接 $link_exec 已存在"
case $LANG in
zh_CN.UTF-8)
echo "符号链接 $link_exec 已存在"
;;
en_US.UTF-8)
echo "Symbolic link $link_exec has been existed"
;;
*)
echo "Symbolic link $link_exec has been existed"
;;
esac
else
rm -rf "$link_exec" 2>/dev/null
echo "创建符号链接 $dotnet_exec 到 $link_exec"
case $LANG in
zh_CN.UTF-8)
echo "创建符号链接 $dotnet_exec 到 $link_exec"
;;
en_US.UTF-8)
echo "Create symbolic link $dotnet_exec to $link_exec"
;;
*)
echo "Create symbolic link $dotnet_exec to $link_exec"
;;
esac
ln -s "$dotnet_exec" "$link_exec"
chmod +x "$link_exec"
fi
Expand Down
127 changes: 108 additions & 19 deletions build/linux/environment_check.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,105 @@
#!/bin/bash
base_path="$HOME/WattToolkit"
export LC_ALL=en_US.UTF-8
Determine_distribution() {
# 判断发行版类型
# 由于Linux发行版包管理器可以混装,如Debian安装Arch Linux的pacman,此处采用/etc/os-release的形式进行一次判断。
# 读取 /etc/os-release 文件并提取 ID 字段,转换为小写
# $installprefix是该发行版包管理器安装软件前缀
# $nssvar是该发行版certutil包名称
os_id=$(grep "^ID=" /etc/os-release | cut -d'=' -f2 | tr -d '"' | tr '[:upper:]' '[:lower:]')
# 输出 ID
echo "OS ID: $os_id"

case "$os_id" in
"ubuntu" | "debian" | "kali" | "mx" | "devuan" | "pureos" | "parrot" | "trisquel" | "bunsenlabs" | "deepin" | "antix" | "uos" | "kylin" | "loongnix" | "gxde" | "nfsdesktop")
echo 默认包管理器:apt
sudo apt update
installprefix="sudo apt install -y"
nssvar="libnss3-tools"
;;
"fedora")
echo 默认包管理器:dnf
installprefix="sudo dnf install -y"
nssvar="nss-tools"
;;
"centos" | "rhel" | "rocky" | "alma" | "amzn" | "alt")
echo 默认包管理器:yum
installprefix="sudo yum install -y"
nssvar="nss-tools"
;;
"opensuse")
echo 默认包管理器:zypper
sudo zypper refresh
installprefix="sudo zypper install"
nssvar="mozilla-nss-tools"
;;
"arch" | "manjaro" | "artix" | "chakra" | "blackarch" | "frugalware")
echo 默认包管理器:pacman
installprefix="sudo pacman -S"
nssvar="nss"
;;
"mageia" | "pclinuxos" | "openmandriva" | "rosa" | "vectorlinux")
echo 默认包管理器:urpmi
sudo urpmi.update -a
installprefix="sudo urpmi"
nssvar="nss-tools"
;;
"slackware" | "salix" | "porteus" | "slacko")
echo 默认包管理器:slackpkg
sudo slackpkg update gpg
sudo slackpkg update
installprefix="sudo slackpkg install"
nssvar="nss"
;;
"aosc")
echo 默认包管理器:oma
installprefix="sudo oma install -y"
nssvar="nss"
;;
"gentoo")
echo 默认包管理器:emerge
sudo emerge --sync
installprefix="sudo emerge -av"
nssvar="nss"
;;
"solus")
echo 默认包管理器:eopkg
sudo eopkg update-repo
installprefix="sudo eopkg install"
nssvar="nss-tools"
;;
"clearlinux")
echo 默认包管理器:swupd
# 手动安装判断变量
manualins="1"
;;
"nixos")
echo 默认包管理器:nix
manualins="1"
;;
"void")
echo 默认包管理器:xbps
manualins="1"
;;
"puppy")
echo 默认包管理器:petget
manualins="1"
;;
"tinycore")
echo 默认包管理器:tce-load
manualins="1"
;;
"yongbao")
echo 无包管理器
manualins="1"
;;
*)
echo 未知发行版
manualins="1"
;;
esac
}
if [ "$1" = "-c" ]; then
# 只验证 certutil 是否可用
if command -v certutil &>/dev/null; then
Expand All @@ -11,32 +110,21 @@ if [ "$1" = "-c" ]; then
fi
else
Install_certutil() {
# 判断发行版类型
if command -v certutil &>/dev/null; then
echo "certutil 工具已安装。"
elif [ "$manualins" == "1" ]; then
echo "请手动安装 certutil 工具。"
else
echo "证书导入以及验证需要使用 certutil 工具。"
# 判断包管理器
if command -v apt &>/dev/null; then
# 使用 apt (Debian/Ubuntu)
$installprefix $nssvar
# Loongnix 25特殊情况
if [ "$os_id" == "loongnix" ]; then
sudo ln -s /usr/sbin/setcap /usr/bin/setcap
sudo apt update
sudo apt install -y libnss3-tools
elif command -v dnf &>/dev/null; then
# 使用 dnf (Fedora)
sudo dnf install -y nss-tools
elif command -v yum &>/dev/null; then
# 使用 yum (CentOS/Red Hat)
sudo yum install -y nss-tools
elif command -v pacman &>/dev/null; then
# 使用 pacman (Arch Linux)
# sudo pacman -S nss
echo "请手动安装 certutil 工具。"
exit 1
# sudo apt dist-upgrade
else
echo "请手动安装 certutil 工具。"
exit 1
echo "certutil 工具已安装。"
fi
echo "certutil 工具已安装。"
fi
}
certutil_Init() {
Expand All @@ -52,6 +140,7 @@ else
echo "certutil nssdb 正常"
fi
}
Determine_distribution
Install_certutil
certutil_Init
exit 0
Expand Down
Loading