mirror of
https://github.com/zadam/trilium.git
synced 2025-10-20 23:29:02 +02:00
chore(sign): log architecture of sign tool
This commit is contained in:
parent
385182cd97
commit
9b2accb370
@ -1,12 +1,11 @@
|
|||||||
const child_process = require("child_process");
|
const child_process = require("child_process");
|
||||||
const { default: e } = require("express");
|
|
||||||
const fs = require("fs");
|
const fs = require("fs");
|
||||||
const path = require("path");
|
const path = require("path");
|
||||||
|
|
||||||
const LOG_LOCATION = "c:\\ev_signer_trilium\\ev_signer_trilium.err.log";
|
const LOG_LOCATION = "c:\\ev_signer_trilium\\ev_signer_trilium.err.log";
|
||||||
|
const { WINDOWS_SIGN_EXECUTABLE } = process.env;
|
||||||
|
|
||||||
module.exports = function (sourcePath) {
|
module.exports = function (sourcePath) {
|
||||||
const { WINDOWS_SIGN_EXECUTABLE } = process.env;
|
|
||||||
if (!WINDOWS_SIGN_EXECUTABLE) {
|
if (!WINDOWS_SIGN_EXECUTABLE) {
|
||||||
console.warn("[Sign] Skip signing due to missing environment variable.");
|
console.warn("[Sign] Skip signing due to missing environment variable.");
|
||||||
return;
|
return;
|
||||||
@ -32,10 +31,10 @@ module.exports = function (sourcePath) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function printSigningErrorLogs(sourcePath) {
|
function printSigningErrorLogs(sourcePath) {
|
||||||
const buffer = fs.readFileSync(sourcePath);
|
|
||||||
console.log("Platform: ", process.platform);
|
console.log("Platform: ", process.platform);
|
||||||
console.log("CPU archi:", process.arch);
|
console.log("CPU archi:", process.arch);
|
||||||
console.log("DLL archi: ", getDllArchitectureFromBuffer(buffer));
|
console.log("DLL archi: ", getDllArchitectureFromFile(sourcePath));
|
||||||
|
console.log("Signer archi: ", getDllArchitectureFromFile(WINDOWS_SIGN_EXECUTABLE));
|
||||||
|
|
||||||
if (!fs.existsSync(LOG_LOCATION)) {
|
if (!fs.existsSync(LOG_LOCATION)) {
|
||||||
console.warn("[Sign] No debug log file found.");
|
console.warn("[Sign] No debug log file found.");
|
||||||
@ -46,7 +45,9 @@ function printSigningErrorLogs(sourcePath) {
|
|||||||
console.error("[Sign] Debug log content:\n" + logContent);
|
console.error("[Sign] Debug log content:\n" + logContent);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getDllArchitectureFromBuffer(buffer) {
|
function getDllArchitectureFromFile(filePath) {
|
||||||
|
const buffer = fs.readFileSync(filePath);
|
||||||
|
|
||||||
// Check for MZ header
|
// Check for MZ header
|
||||||
if (buffer[0] !== 0x4D || buffer[1] !== 0x5A) {
|
if (buffer[0] !== 0x4D || buffer[1] !== 0x5A) {
|
||||||
return 'Not a PE file (missing MZ header)';
|
return 'Not a PE file (missing MZ header)';
|
||||||
|
Loading…
x
Reference in New Issue
Block a user