在ACE中安装会汇报主机的信息,在ACE中安装商店会忽略要求直接安装

This commit is contained in:
shenmo 2025-06-12 00:56:54 +08:00
parent ef4b21fb8c
commit c5b5b6d3ba
3 changed files with 22 additions and 21 deletions

View File

@ -8,6 +8,8 @@
#include <QSettings> #include <QSettings>
#include <QProcess> #include <QProcess>
#include <QDebug> #include <QDebug>
#include <QFile>
#include <QTextStream>
DataCollectorAndUploader::DataCollectorAndUploader(QObject *parent) : QObject(parent) DataCollectorAndUploader::DataCollectorAndUploader(QObject *parent) : QObject(parent)
{ {
@ -23,25 +25,26 @@ void DataCollectorAndUploader::collectData()
QString distributor_id; QString distributor_id;
QString release; QString release;
QString architecture; QString architecture;
QSettings config(QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation) + "/config.ini", QSettings::IniFormat); QSettings config(QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation) + "/config.ini", QSettings::IniFormat);
QString version = config.value("build/version").toString(); QString version = config.value("build/version").toString();
QString uuid = config.value("info/uuid").toString(); QString uuid = config.value("info/uuid").toString();
// Read /etc/os-release file
// Execute lsb_release --all and capture the output QFile osReleaseFile("/etc/os-release");
QProcess lsbProcess; if (osReleaseFile.open(QIODevice::ReadOnly | QIODevice::Text)) {
lsbProcess.start("lsb_release", QStringList() << "--all"); QTextStream in(&osReleaseFile);
lsbProcess.waitForFinished(); while (!in.atEnd()) {
QString lsbOutput = lsbProcess.readAllStandardOutput(); QString line = in.readLine();
if (line.startsWith("ID=")) {
QStringList lines = lsbOutput.split('\n'); distributor_id = line.mid(3).remove('"').trimmed();
for (const QString &line : lines) { } else if (line.startsWith("VERSION_ID=")) {
if (line.contains("Distributor ID:")) { release = line.mid(11).remove('"').trimmed();
distributor_id = line.split(":").last().trimmed(); }
} else if (line.contains("Release:")) {
release = line.split(":").last().trimmed();
} }
osReleaseFile.close();
} else {
qWarning() << "Could not open /etc/os-release file";
} }
// Execute uname -m to get the architecture // Execute uname -m to get the architecture
@ -58,8 +61,6 @@ void DataCollectorAndUploader::collectData()
json.insert("Store_Version", version); json.insert("Store_Version", version);
json.insert("UUID", uuid); json.insert("UUID", uuid);
// Convert to byte array // Convert to byte array
QJsonDocument doc(json); QJsonDocument doc(json);
QByteArray jsonData = doc.toJson(); QByteArray jsonData = doc.toJson();

View File

@ -66,7 +66,7 @@ case $(arch) in
esac esac
# 帮助函数 # 帮助函数
function show_help() { function show_help() {
echo "Spark Store Audit script. 星火商店审核脚本" echo "Spark Store Anstall script. 星火商店审核脚本"
echo "用法: $0 [选项] <deb路径>" echo "用法: $0 [选项] <deb路径>"
echo "选项:" echo "选项:"
echo " -h, --help 显示帮助信息" echo " -h, --help 显示帮助信息"
@ -448,7 +448,7 @@ function main_install() {
package_name=$(dpkg-deb -f "$DEBPATH" Package) package_name=$(dpkg-deb -f "$DEBPATH" Package)
local install_success=1 local install_success=1
if [ "$FORCE_NATIVE" -eq 1 ]; then if [ "$FORCE_NATIVE" -eq 1 ] || [ "$IS_ACE_ENV" = "1" ]; then
# 优先使用主机安装忽略所有ACE参数 # 优先使用主机安装忽略所有ACE参数
echo "忽略ACE使用主机安装 $package_name" echo "忽略ACE使用主机安装 $package_name"
install_in_host "$DEBPATH" install_in_host "$DEBPATH"
@ -458,7 +458,7 @@ function main_install() {
create_desktop_file create_desktop_file
fi fi
elif [ ${#ACE_PARAMS[@]} -gt 0 ]; then elif [ ${#ACE_PARAMS[@]} -gt 0 ] && [ "$IS_ACE_ENV" != "" ]; then
# 用户指定了一个或多个ACE环境且未要求原生安装 # 用户指定了一个或多个ACE环境且未要求原生安装
echo "使用ACE环境安装已指定环境: ${ACE_PARAMS[*]}" echo "使用ACE环境安装已指定环境: ${ACE_PARAMS[*]}"

View File

@ -460,7 +460,7 @@ function main_install() {
package_name=$(dpkg-deb -f "$DEBPATH" Package) package_name=$(dpkg-deb -f "$DEBPATH" Package)
local install_success=1 local install_success=1
if [ "$FORCE_NATIVE" -eq 1 ]; then if [ "$FORCE_NATIVE" -eq 1 ] || [ "$IS_ACE_ENV" = "1" ]; then
# 优先使用主机安装忽略所有ACE参数 # 优先使用主机安装忽略所有ACE参数
echo "忽略ACE使用主机安装 $package_name" echo "忽略ACE使用主机安装 $package_name"
install_in_host "$DEBPATH" install_in_host "$DEBPATH"
@ -470,7 +470,7 @@ function main_install() {
create_desktop_file create_desktop_file
fi fi
elif [ ${#ACE_PARAMS[@]} -gt 0 ]; then elif [ ${#ACE_PARAMS[@]} -gt 0 ] && [ "$IS_ACE_ENV" != "" ]; then
# 用户指定了一个或多个ACE环境且未要求原生安装 # 用户指定了一个或多个ACE环境且未要求原生安装
echo "使用ACE环境安装已指定环境: ${ACE_PARAMS[*]}" echo "使用ACE环境安装已指定环境: ${ACE_PARAMS[*]}"