mirror of
https://github.com/balena-io/etcher.git
synced 2025-07-21 10:16:32 +00:00
Merge pull request #3945 from balena-io/update-sdk-for-cm4
Patch: update etcher-sdk version to fix CM4 issues
This commit is contained in:
commit
d5fb6bec15
1020
package-lock.json
generated
1020
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
10
package.json
10
package.json
@ -74,14 +74,14 @@
|
|||||||
"css-loader": "5.2.7",
|
"css-loader": "5.2.7",
|
||||||
"d3": "4.13.0",
|
"d3": "4.13.0",
|
||||||
"debug": "4.3.4",
|
"debug": "4.3.4",
|
||||||
"electron": "12.2.3",
|
"electron": "^13.5.0",
|
||||||
"electron-builder": "22.14.13",
|
"electron-builder": "^23.0.9",
|
||||||
"electron-mocha": "9.3.3",
|
"electron-mocha": "9.3.3",
|
||||||
"electron-notarize": "1.2.2",
|
"electron-notarize": "1.2.2",
|
||||||
"electron-rebuild": "3.2.9",
|
"electron-rebuild": "3.2.9",
|
||||||
"electron-updater": "4.6.5",
|
"electron-updater": "5.3.0",
|
||||||
"esbuild-loader": "2.20.0",
|
"esbuild-loader": "2.20.0",
|
||||||
"etcher-sdk": "7.4.0",
|
"etcher-sdk": "7.4.4",
|
||||||
"file-loader": "6.2.0",
|
"file-loader": "6.2.0",
|
||||||
"husky": "4.3.8",
|
"husky": "4.3.8",
|
||||||
"i18next": "21.10.0",
|
"i18next": "21.10.0",
|
||||||
@ -106,7 +106,7 @@
|
|||||||
"semver": "7.3.8",
|
"semver": "7.3.8",
|
||||||
"simple-progress-webpack-plugin": "1.1.2",
|
"simple-progress-webpack-plugin": "1.1.2",
|
||||||
"sinon": "9.2.4",
|
"sinon": "9.2.4",
|
||||||
"spectron": "14.0.0",
|
"spectron": "15.0.0",
|
||||||
"string-replace-loader": "3.1.0",
|
"string-replace-loader": "3.1.0",
|
||||||
"style-loader": "2.0.0",
|
"style-loader": "2.0.0",
|
||||||
"styled-components": "5.3.6",
|
"styled-components": "5.3.6",
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import * as CopyPlugin from 'copy-webpack-plugin';
|
import * as CopyPlugin from 'copy-webpack-plugin';
|
||||||
import { readdirSync } from 'fs';
|
import { readdirSync, existsSync } from 'fs';
|
||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
import * as os from 'os';
|
import * as os from 'os';
|
||||||
import outdent from 'outdent';
|
import outdent from 'outdent';
|
||||||
@ -77,25 +77,45 @@ function renameNodeModules(resourcePath: string) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function findExt2fsFolder(): string {
|
||||||
|
const ext2fs = 'node_modules/ext2fs';
|
||||||
|
const biFsExt2fs = 'node_modules/balena-image-fs/node_modules/ext2fs';
|
||||||
|
|
||||||
|
if (existsSync(ext2fs)) {
|
||||||
|
return ext2fs;
|
||||||
|
} else if (existsSync(biFsExt2fs)) {
|
||||||
|
return biFsExt2fs;
|
||||||
|
} else {
|
||||||
|
throw Error('ext2fs not found');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function makeExt2FsRegex(): RegExp {
|
||||||
|
const folder = findExt2fsFolder();
|
||||||
|
const libpath = '/lib/libext2fs\\.js$';
|
||||||
|
|
||||||
|
return new RegExp(folder.concat(libpath));
|
||||||
|
}
|
||||||
|
|
||||||
function findUsbPrebuild(): string[] {
|
function findUsbPrebuild(): string[] {
|
||||||
const usbPrebuildsFolder = path.join('node_modules', 'usb', 'prebuilds')
|
const usbPrebuildsFolder = path.join('node_modules', 'usb', 'prebuilds');
|
||||||
const prebuildFolders = readdirSync(usbPrebuildsFolder);
|
const prebuildFolders = readdirSync(usbPrebuildsFolder);
|
||||||
let bindingFile: string | undefined = 'node.napi.node';
|
let bindingFile: string | undefined = 'node.napi.node';
|
||||||
const platformFolder = prebuildFolders.find(
|
const platformFolder = prebuildFolders.find(
|
||||||
(f) =>
|
(f) => f.startsWith(os.platform()) && f.indexOf(os.arch()) > -1,
|
||||||
f.startsWith(os.platform()) &&
|
|
||||||
f.indexOf(os.arch()) > -1,
|
|
||||||
);
|
);
|
||||||
if (platformFolder === undefined) {
|
if (platformFolder === undefined) {
|
||||||
throw new Error('Could not find usb prebuild. Should try fallback to node-gyp and use /build/Release instead of /prebuilds');
|
throw new Error(
|
||||||
|
'Could not find usb prebuild. Should try fallback to node-gyp and use /build/Release instead of /prebuilds',
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const bindingFiles = readdirSync(
|
const bindingFiles = readdirSync(
|
||||||
path.join(usbPrebuildsFolder, platformFolder)
|
path.join(usbPrebuildsFolder, platformFolder),
|
||||||
)
|
);
|
||||||
|
|
||||||
if (!bindingFiles.length) {
|
if (!bindingFiles.length) {
|
||||||
throw new Error('Could not find usb prebuild for platform')
|
throw new Error('Could not find usb prebuild for platform');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bindingFiles.length === 1) {
|
if (bindingFiles.length === 1) {
|
||||||
@ -107,25 +127,22 @@ function findUsbPrebuild(): string[] {
|
|||||||
if (bindingFiles.length > 1) {
|
if (bindingFiles.length > 1) {
|
||||||
bindingFile = bindingFiles.find((file) => {
|
bindingFile = bindingFiles.find((file) => {
|
||||||
if (bindingFiles.indexOf('arm') > -1) {
|
if (bindingFiles.indexOf('arm') > -1) {
|
||||||
const process = require('process')
|
const process = require('process');
|
||||||
return file.indexOf(process.config.variables.arm_version) > -1
|
return file.indexOf(process.config.variables.arm_version) > -1;
|
||||||
} else {
|
} else {
|
||||||
return file.indexOf('glibc') > -1
|
return file.indexOf('glibc') > -1;
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bindingFile === undefined) {
|
if (bindingFile === undefined) {
|
||||||
throw new Error('Could not find usb prebuild for platform')
|
throw new Error('Could not find usb prebuild for platform');
|
||||||
}
|
}
|
||||||
|
|
||||||
return [platformFolder, bindingFile];
|
return [platformFolder, bindingFile];
|
||||||
}
|
}
|
||||||
|
|
||||||
const [
|
const [USB_BINDINGS_FOLDER, USB_BINDINGS_FILE] = findUsbPrebuild();
|
||||||
USB_BINDINGS_FOLDER,
|
|
||||||
USB_BINDINGS_FILE,
|
|
||||||
] = findUsbPrebuild();
|
|
||||||
|
|
||||||
function findLzmaNativeBindingsFolder(): string {
|
function findLzmaNativeBindingsFolder(): string {
|
||||||
const files = readdirSync(
|
const files = readdirSync(
|
||||||
@ -325,8 +342,8 @@ const commonConfig = {
|
|||||||
// Use the libext2fs.wasm file in the generated folder
|
// Use the libext2fs.wasm file in the generated folder
|
||||||
// The way to find the app directory depends on whether we run in the renderer or in the child-writer
|
// The way to find the app directory depends on whether we run in the renderer or in the child-writer
|
||||||
// We use __dirname in the child-writer and electron.remote.app.getAppPath() in the renderer
|
// We use __dirname in the child-writer and electron.remote.app.getAppPath() in the renderer
|
||||||
replace(/node_modules\/ext2fs\/lib\/libext2fs\.js$/, {
|
replace(makeExt2FsRegex(), {
|
||||||
search: 'scriptDirectory=__dirname+"/"',
|
search: 'scriptDirectory = __dirname + "/";',
|
||||||
replace: fetchWasm('ext2fs', 'lib'),
|
replace: fetchWasm('ext2fs', 'lib'),
|
||||||
}),
|
}),
|
||||||
// Same for node-crc-utils
|
// Same for node-crc-utils
|
||||||
@ -388,7 +405,7 @@ const guiConfigCopyPatterns = [
|
|||||||
to: 'modules/node-raspberrypi-usbboot/blobs',
|
to: 'modules/node-raspberrypi-usbboot/blobs',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
from: 'node_modules/ext2fs/lib/libext2fs.wasm',
|
from: `${findExt2fsFolder()}/lib/libext2fs.wasm`,
|
||||||
to: 'modules/ext2fs/lib/libext2fs.wasm',
|
to: 'modules/ext2fs/lib/libext2fs.wasm',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user