mirror of
https://github.com/whyour/qinglong.git
synced 2025-05-23 23:06:06 +08:00
修复系统安装依赖提示
This commit is contained in:
parent
939e18fbe3
commit
d1aeaa6754
|
@ -601,6 +601,8 @@ export async function detectOS(): Promise<
|
||||||
Logger.error(`Unknown Linux Distribution: ${osReleaseInfo}`);
|
Logger.error(`Unknown Linux Distribution: ${osReleaseInfo}`);
|
||||||
console.error(`Unknown Linux Distribution: ${osReleaseInfo}`);
|
console.error(`Unknown Linux Distribution: ${osReleaseInfo}`);
|
||||||
}
|
}
|
||||||
|
} else if (platform === 'darwin') {
|
||||||
|
osType = undefined;
|
||||||
} else {
|
} else {
|
||||||
Logger.error(`Unsupported platform: ${platform}`);
|
Logger.error(`Unsupported platform: ${platform}`);
|
||||||
console.error(`Unsupported platform: ${platform}`);
|
console.error(`Unsupported platform: ${platform}`);
|
||||||
|
|
|
@ -234,6 +234,12 @@ export default class DependenceService {
|
||||||
if (taskLimit.firstDependencyId !== dependency.id) {
|
if (taskLimit.firstDependencyId !== dependency.id) {
|
||||||
return resolve(null);
|
return resolve(null);
|
||||||
}
|
}
|
||||||
|
const depIds = [dependency.id!];
|
||||||
|
let depName = dependency.name.trim();
|
||||||
|
const actionText = isInstall ? '安装' : '删除';
|
||||||
|
const socketMessageType = isInstall
|
||||||
|
? 'installDependence'
|
||||||
|
: 'uninstallDependence';
|
||||||
const isNodeDependence = dependency.type === DependenceTypes.nodejs;
|
const isNodeDependence = dependency.type === DependenceTypes.nodejs;
|
||||||
const isLinuxDependence = dependency.type === DependenceTypes.linux;
|
const isLinuxDependence = dependency.type === DependenceTypes.linux;
|
||||||
const isPythonDependence = dependency.type === DependenceTypes.python3;
|
const isPythonDependence = dependency.type === DependenceTypes.python3;
|
||||||
|
@ -242,21 +248,32 @@ export default class DependenceService {
|
||||||
taskLimit.removeQueuedDependency(dependency);
|
taskLimit.removeQueuedDependency(dependency);
|
||||||
if (isLinuxDependence) {
|
if (isLinuxDependence) {
|
||||||
if (!osType) {
|
if (!osType) {
|
||||||
|
await DependenceModel.update(
|
||||||
|
{ status: DependenceStatus.installFailed },
|
||||||
|
{ where: { id: depIds } },
|
||||||
|
);
|
||||||
|
const startTime = dayjs();
|
||||||
|
const message = `开始${actionText}依赖 ${depName},开始时间 ${startTime.format(
|
||||||
|
'YYYY-MM-DD HH:mm:ss',
|
||||||
|
)}\n\n当前系统不支持\n\n依赖${actionText}失败,结束时间 ${startTime.format(
|
||||||
|
'YYYY-MM-DD HH:mm:ss',
|
||||||
|
)},耗时 ${startTime.diff(startTime, 'second')} 秒`;
|
||||||
|
this.sockService.sendMessage({
|
||||||
|
type: socketMessageType,
|
||||||
|
message,
|
||||||
|
references: depIds,
|
||||||
|
});
|
||||||
|
this.updateLog(depIds, message);
|
||||||
return resolve(null);
|
return resolve(null);
|
||||||
}
|
}
|
||||||
linuxCommand = LINUX_DEPENDENCE_COMMAND[osType];
|
linuxCommand = LINUX_DEPENDENCE_COMMAND[osType];
|
||||||
}
|
}
|
||||||
|
|
||||||
const depIds = [dependency.id!];
|
|
||||||
const status = isInstall
|
const status = isInstall
|
||||||
? DependenceStatus.installing
|
? DependenceStatus.installing
|
||||||
: DependenceStatus.removing;
|
: DependenceStatus.removing;
|
||||||
await DependenceModel.update({ status }, { where: { id: depIds } });
|
await DependenceModel.update({ status }, { where: { id: depIds } });
|
||||||
|
|
||||||
const socketMessageType = isInstall
|
|
||||||
? 'installDependence'
|
|
||||||
: 'uninstallDependence';
|
|
||||||
let depName = dependency.name.trim();
|
|
||||||
let depRunCommand = isInstall
|
let depRunCommand = isInstall
|
||||||
? getInstallCommand(dependency.type, depName)
|
? getInstallCommand(dependency.type, depName)
|
||||||
: getUninstallCommand(dependency.type, depName);
|
: getUninstallCommand(dependency.type, depName);
|
||||||
|
@ -265,7 +282,6 @@ export default class DependenceService {
|
||||||
? linuxCommand.install
|
? linuxCommand.install
|
||||||
: linuxCommand.uninstall;
|
: linuxCommand.uninstall;
|
||||||
}
|
}
|
||||||
const actionText = isInstall ? '安装' : '删除';
|
|
||||||
const startTime = dayjs();
|
const startTime = dayjs();
|
||||||
|
|
||||||
const message = `开始${actionText}依赖 ${depName},开始时间 ${startTime.format(
|
const message = `开始${actionText}依赖 ${depName},开始时间 ${startTime.format(
|
||||||
|
|
Loading…
Reference in New Issue
Block a user