mirror of
				https://github.com/balena-io/etcher.git
				synced 2025-11-03 23:48:31 +00:00 
			
		
		
		
	Compare commits
	
		
			43 Commits
		
	
	
		
			v1.12.0
			...
			aethernet/
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						 | 
					aa30b34916 | ||
| 
						 | 
					8cd6da1260 | ||
| 
						 | 
					82dd4fc1d1 | ||
| 
						 | 
					33fe4b2c1a | ||
| 
						 | 
					b1c1188107 | ||
| 
						 | 
					63b45aefae | ||
| 
						 | 
					f79cb0fac5 | ||
| 
						 | 
					ec42892c7c | ||
| 
						 | 
					371716fe6a | ||
| 
						 | 
					d5fb6bec15 | ||
| 
						 | 
					c5e7bf26d7 | ||
| 
						 | 
					e3072ac416 | ||
| 
						 | 
					dfaf06e4cf | ||
| 
						 | 
					6e24d25576 | ||
| 
						 | 
					b59b171e43 | ||
| 
						 | 
					28726584c2 | ||
| 
						 | 
					00b151311a | ||
| 
						 | 
					36c813714b | ||
| 
						 | 
					2ae6764dd9 | ||
| 
						 | 
					debefc9652 | ||
| 
						 | 
					b068b847c7 | ||
| 
						 | 
					6c410c07ce | ||
| 
						 | 
					c01206c1f3 | ||
| 
						 | 
					2e85fb45de | ||
| 
						 | 
					67513e384d | ||
| 
						 | 
					828dafa493 | ||
| 
						 | 
					5c5a761222 | ||
| 
						 | 
					fab10e5fc5 | ||
| 
						 | 
					797345fc1c | ||
| 
						 | 
					a0388a43c3 | ||
| 
						 | 
					f5b0a3023b | ||
| 
						 | 
					dc1d7bd1fd | ||
| 
						 | 
					9d674321b6 | ||
| 
						 | 
					f9c8378d6a | ||
| 
						 | 
					65da751a52 | ||
| 
						 | 
					72142be0de | ||
| 
						 | 
					11cea7c926 | ||
| 
						 | 
					8d46ee4c22 | ||
| 
						 | 
					d63c09e2c2 | ||
| 
						 | 
					c9e9d7d109 | ||
| 
						 | 
					2412d20eb4 | ||
| 
						 | 
					7f90d23a12 | ||
| 
						 | 
					b9a82be29b | 
							
								
								
									
										28
									
								
								.github/actions/publish/action.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										28
									
								
								.github/actions/publish/action.yml
									
									
									
									
										vendored
									
									
								
							@@ -72,32 +72,6 @@ runs:
 | 
			
		||||
            chmod +x "$(dirname "$(which node)")/resinci-deploy" && which resinci-deploy
 | 
			
		||||
        fi
 | 
			
		||||
 | 
			
		||||
    # FIXME: store sentry workflow is not documented
 | 
			
		||||
    # https://github.com/product-os/resinci-deploy/blob/master/lib/sentry.ts
 | 
			
		||||
    # https://github.com/getsentry/sentry-cli
 | 
			
		||||
    # https://docs.sentry.io/api/projects/create-a-new-client-key/
 | 
			
		||||
    - name: Generate Sentry DSN
 | 
			
		||||
      id: sentry
 | 
			
		||||
      shell: bash --noprofile --norc -eo pipefail -x {0}
 | 
			
		||||
      run: |
 | 
			
		||||
        set -ea
 | 
			
		||||
 | 
			
		||||
        [[ '${{ inputs.VERBOSE }}' =~ on|On|Yes|yes|true|True ]] && set -x
 | 
			
		||||
 | 
			
		||||
        branch="$(echo '${{ github.event.pull_request.head.ref }}' | sed 's/[^[:alnum:]]/-/g')"
 | 
			
		||||
 | 
			
		||||
        stdout="$(resinci-deploy store sentry \
 | 
			
		||||
          --branch="${branch}" \
 | 
			
		||||
          --name="$(jq -r '.name' package.json)" \
 | 
			
		||||
          --team="$(yq e '.sentry.team' repo.yml)" \
 | 
			
		||||
          --org="$(yq e '.sentry.org' repo.yml)" \
 | 
			
		||||
          --type="$(yq e '.sentry.type' repo.yml)")"
 | 
			
		||||
 | 
			
		||||
        echo "dsn=$(echo "${stdout}" | tail -n 1)" >> $GITHUB_OUTPUT
 | 
			
		||||
 | 
			
		||||
      env:
 | 
			
		||||
        SENTRY_TOKEN: ${{ fromJSON(inputs.secrets).SENTRY_AUTH_TOKEN }}
 | 
			
		||||
 | 
			
		||||
    # https://www.electron.build/code-signing.html
 | 
			
		||||
    # https://github.com/Apple-Actions/import-codesign-certs
 | 
			
		||||
    - name: Import Apple code signing certificate
 | 
			
		||||
@@ -171,7 +145,7 @@ runs:
 | 
			
		||||
 | 
			
		||||
        for target in ${TARGETS}; do
 | 
			
		||||
            electron-builder ${ELECTRON_BUILDER_OS} ${target} ${ARCHITECTURE_FLAGS} \
 | 
			
		||||
              --c.extraMetadata.analytics.sentry.token='${{ steps.sentry.outputs.dsn }}' \
 | 
			
		||||
              --c.extraMetadata.analytics.sentry.token='https://739bbcfc0ba4481481138d3fc831136d@o95242.ingest.sentry.io/4504451487301632' \
 | 
			
		||||
              --c.extraMetadata.analytics.mixpanel.token='balena-etcher' \
 | 
			
		||||
              --c.extraMetadata.packageType="${target}"
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										13
									
								
								.github/workflows/winget.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								.github/workflows/winget.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,13 @@
 | 
			
		||||
name: Publish to WinGet
 | 
			
		||||
on:
 | 
			
		||||
  release:
 | 
			
		||||
    types: [released]
 | 
			
		||||
jobs:
 | 
			
		||||
  publish:
 | 
			
		||||
    runs-on: windows-latest # action can only be run on windows
 | 
			
		||||
    steps:
 | 
			
		||||
      - uses: vedantmgoyal2009/winget-releaser@v1
 | 
			
		||||
        with:
 | 
			
		||||
          identifier: Balena.Etcher
 | 
			
		||||
          installers-regex: 'balenaEtcher-Setup.*.exe$'
 | 
			
		||||
          token: ${{ secrets.WINGET_PAT }}
 | 
			
		||||
@@ -1,3 +1,144 @@
 | 
			
		||||
- commits:
 | 
			
		||||
    - subject: "patch: fixed winget parameter name"
 | 
			
		||||
      hash: 33fe4b2c1abcb7f71f42a4b682f174422cb72a00
 | 
			
		||||
      body: ""
 | 
			
		||||
      footer: {}
 | 
			
		||||
      author: mcraa
 | 
			
		||||
      nested: []
 | 
			
		||||
  version: 1.13.2
 | 
			
		||||
  title: ""
 | 
			
		||||
  date: 2023-01-02T20:55:58.179Z
 | 
			
		||||
- commits:
 | 
			
		||||
    - subject: "patch: updated sdk to fix bz2 issue"
 | 
			
		||||
      hash: f79cb0fac56f6ec86f3a6f9be7035fbf59102253
 | 
			
		||||
      body: ""
 | 
			
		||||
      footer: {}
 | 
			
		||||
      author: Peter Makra
 | 
			
		||||
      nested: []
 | 
			
		||||
    - subject: "patch: update copyright in electron-builder"
 | 
			
		||||
      hash: ec42892c7cf1d22f4bb2968733ba9dc85e3552c6
 | 
			
		||||
      body: ""
 | 
			
		||||
      footer: {}
 | 
			
		||||
      author: JOASSART Edwin
 | 
			
		||||
      nested: []
 | 
			
		||||
  version: 1.13.1
 | 
			
		||||
  title: ""
 | 
			
		||||
  date: 2023-01-02T17:26:55.602Z
 | 
			
		||||
- commits:
 | 
			
		||||
    - subject: "minor: electron version bump"
 | 
			
		||||
      hash: e3072ac416470cd161309935c2622cc5a3d8d242
 | 
			
		||||
      body: ""
 | 
			
		||||
      footer: {}
 | 
			
		||||
      author: Peter Makra
 | 
			
		||||
      nested: []
 | 
			
		||||
    - subject: "patch: handle ext2fs with webpack"
 | 
			
		||||
      hash: b59b171e43a170c0ccf84d36ab4ba2db403e25c5
 | 
			
		||||
      body: ""
 | 
			
		||||
      footer: {}
 | 
			
		||||
      author: Peter Makra
 | 
			
		||||
      nested: []
 | 
			
		||||
    - subject: "Patch: update etcher-sdk version to fix CM4 issues"
 | 
			
		||||
      hash: 36c813714b3ce60e5e85f1889c9bc7eeadb524b4
 | 
			
		||||
      body: ""
 | 
			
		||||
      footer:
 | 
			
		||||
        Change-type: patch
 | 
			
		||||
        change-type: patch
 | 
			
		||||
      author: builder555
 | 
			
		||||
      nested: []
 | 
			
		||||
  version: 1.13.0
 | 
			
		||||
  title: ""
 | 
			
		||||
  date: 2022-12-28T16:48:12.506Z
 | 
			
		||||
- commits:
 | 
			
		||||
    - subject: Update dependency i18next to 21.10.0
 | 
			
		||||
      hash: b068b847c7ae6456ebd16a5d641ff61d8d074015
 | 
			
		||||
      body: |
 | 
			
		||||
        Update i18next to 21.10.0
 | 
			
		||||
 | 
			
		||||
        Update i18next from 21.8.14 to 21.10.0
 | 
			
		||||
      footer:
 | 
			
		||||
        Change-type: patch
 | 
			
		||||
        change-type: patch
 | 
			
		||||
      author: Renovate Bot
 | 
			
		||||
      nested: []
 | 
			
		||||
  version: 1.12.7
 | 
			
		||||
  title: ""
 | 
			
		||||
  date: 2022-12-20T19:35:11.219Z
 | 
			
		||||
- commits:
 | 
			
		||||
    - subject: Update dependency react-i18next to 11.18.6
 | 
			
		||||
      hash: 2e85fb45de3a52e9bf0605e474a550e1af2bb980
 | 
			
		||||
      body: |
 | 
			
		||||
        Update react-i18next to 11.18.6
 | 
			
		||||
 | 
			
		||||
        Update react-i18next from 11.18.1 to 11.18.6
 | 
			
		||||
      footer:
 | 
			
		||||
        Change-type: patch
 | 
			
		||||
        change-type: patch
 | 
			
		||||
      author: Renovate Bot
 | 
			
		||||
      nested: []
 | 
			
		||||
  version: 1.12.6
 | 
			
		||||
  title: ""
 | 
			
		||||
  date: 2022-12-20T18:00:03.165Z
 | 
			
		||||
- commits:
 | 
			
		||||
    - subject: "Patch: made trim setting more readable"
 | 
			
		||||
      hash: 5c5a7612220b011e6942ac10b7026b7d6513e54f
 | 
			
		||||
      body: ""
 | 
			
		||||
      footer:
 | 
			
		||||
        Change-type: patch
 | 
			
		||||
        change-type: patch
 | 
			
		||||
      author: builder555
 | 
			
		||||
      nested: []
 | 
			
		||||
  version: 1.12.5
 | 
			
		||||
  title: ""
 | 
			
		||||
  date: 2022-12-20T12:27:33.706Z
 | 
			
		||||
- commits:
 | 
			
		||||
    - subject: "patch: publish to winget with gh action"
 | 
			
		||||
      hash: f9c8378d6a96e1c44d0bced0d3227a9930b9fd14
 | 
			
		||||
      body: ""
 | 
			
		||||
      footer: {}
 | 
			
		||||
      author: Begula
 | 
			
		||||
      nested: []
 | 
			
		||||
  version: 1.12.4
 | 
			
		||||
  title: ""
 | 
			
		||||
  date: 2022-12-19T19:41:59.151Z
 | 
			
		||||
- commits:
 | 
			
		||||
    - subject: "Patch: replaced plain text with i18n in settings"
 | 
			
		||||
      hash: 11cea7c926be1bac27df8ab583cbb4b8752a49c5
 | 
			
		||||
      body: ""
 | 
			
		||||
      footer:
 | 
			
		||||
        Change-type: patch
 | 
			
		||||
        change-type: patch
 | 
			
		||||
      author: builder555
 | 
			
		||||
      nested: []
 | 
			
		||||
  version: 1.12.3
 | 
			
		||||
  title: ""
 | 
			
		||||
  date: 2022-12-19T09:51:52.545Z
 | 
			
		||||
- commits:
 | 
			
		||||
    - subject: Update dependency webpack-dev-server to 4.11.1
 | 
			
		||||
      hash: c9e9d7d109ee103402acea1c7be4bac2f674168a
 | 
			
		||||
      body: |
 | 
			
		||||
        Update webpack-dev-server to 4.11.1
 | 
			
		||||
 | 
			
		||||
        Update webpack-dev-server from 4.5.0 to 4.11.1
 | 
			
		||||
      footer:
 | 
			
		||||
        Change-type: patch
 | 
			
		||||
        change-type: patch
 | 
			
		||||
      author: Renovate Bot
 | 
			
		||||
      nested: []
 | 
			
		||||
  version: 1.12.2
 | 
			
		||||
  title: ""
 | 
			
		||||
  date: 2022-12-16T16:59:03.254Z
 | 
			
		||||
- commits:
 | 
			
		||||
    - subject: "Patch: expose trim ext{2,3,4} setting"
 | 
			
		||||
      hash: b9a82be29bee61a41f6f6a5ca6043dd8a7bee547
 | 
			
		||||
      body: ""
 | 
			
		||||
      footer:
 | 
			
		||||
        Change-type: patch
 | 
			
		||||
        change-type: patch
 | 
			
		||||
      author: builder555
 | 
			
		||||
      nested: []
 | 
			
		||||
  version: 1.12.1
 | 
			
		||||
  title: ""
 | 
			
		||||
  date: 2022-12-16T15:02:34.104Z
 | 
			
		||||
- commits:
 | 
			
		||||
    - subject: i18n support and Chinese translation
 | 
			
		||||
      hash: 8fc574f0596f256382523c3b269e647a9aed5747
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										53
									
								
								CHANGELOG.md
									
									
									
									
									
								
							
							
						
						
									
										53
									
								
								CHANGELOG.md
									
									
									
									
									
								
							@@ -3,6 +3,59 @@
 | 
			
		||||
All notable changes to this project will be documented in this file.
 | 
			
		||||
This project adheres to [Semantic Versioning](http://semver.org/).
 | 
			
		||||
 | 
			
		||||
# v1.13.2
 | 
			
		||||
## (2023-01-02)
 | 
			
		||||
 | 
			
		||||
* patch: fixed winget parameter name [mcraa]
 | 
			
		||||
 | 
			
		||||
# v1.13.1
 | 
			
		||||
## (2023-01-02)
 | 
			
		||||
 | 
			
		||||
* patch: updated sdk to fix bz2 issue [Peter Makra]
 | 
			
		||||
* patch: update copyright in electron-builder [JOASSART Edwin]
 | 
			
		||||
 | 
			
		||||
# v1.13.0
 | 
			
		||||
## (2022-12-28)
 | 
			
		||||
 | 
			
		||||
* minor: electron version bump [Peter Makra]
 | 
			
		||||
* patch: handle ext2fs with webpack [Peter Makra]
 | 
			
		||||
* Patch: update etcher-sdk version to fix CM4 issues [builder555]
 | 
			
		||||
 | 
			
		||||
# v1.12.7
 | 
			
		||||
## (2022-12-20)
 | 
			
		||||
 | 
			
		||||
* Update dependency i18next to 21.10.0 [Renovate Bot]
 | 
			
		||||
 | 
			
		||||
# v1.12.6
 | 
			
		||||
## (2022-12-20)
 | 
			
		||||
 | 
			
		||||
* Update dependency react-i18next to 11.18.6 [Renovate Bot]
 | 
			
		||||
 | 
			
		||||
# v1.12.5
 | 
			
		||||
## (2022-12-20)
 | 
			
		||||
 | 
			
		||||
* Patch: made trim setting more readable [builder555]
 | 
			
		||||
 | 
			
		||||
# v1.12.4
 | 
			
		||||
## (2022-12-19)
 | 
			
		||||
 | 
			
		||||
* patch: publish to winget with gh action [Begula]
 | 
			
		||||
 | 
			
		||||
# v1.12.3
 | 
			
		||||
## (2022-12-19)
 | 
			
		||||
 | 
			
		||||
* Patch: replaced plain text with i18n in settings [builder555]
 | 
			
		||||
 | 
			
		||||
# v1.12.2
 | 
			
		||||
## (2022-12-16)
 | 
			
		||||
 | 
			
		||||
* Update dependency webpack-dev-server to 4.11.1 [Renovate Bot]
 | 
			
		||||
 | 
			
		||||
# v1.12.1
 | 
			
		||||
## (2022-12-16)
 | 
			
		||||
 | 
			
		||||
* Patch: expose trim ext{2,3,4} setting [builder555]
 | 
			
		||||
 | 
			
		||||
# v1.12.0
 | 
			
		||||
## (2022-12-14)
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
# https://www.electron.build/configuration/configuration
 | 
			
		||||
appId: io.balena.etcher
 | 
			
		||||
copyright: Copyright 2016-2021 Balena Ltd
 | 
			
		||||
copyright: Copyright 2016-2023 Balena Ltd
 | 
			
		||||
productName: balenaEtcher
 | 
			
		||||
afterPack: ./afterPack.js
 | 
			
		||||
afterSign: ./afterSignHook.js
 | 
			
		||||
 
 | 
			
		||||
@@ -37,6 +37,10 @@ async function getSettingsList(): Promise<Setting[]> {
 | 
			
		||||
			name: 'errorReporting',
 | 
			
		||||
			label: i18next.t('settings.errorReporting'),
 | 
			
		||||
		},
 | 
			
		||||
		{
 | 
			
		||||
			name: 'autoBlockmapping',
 | 
			
		||||
			label: i18next.t('settings.trimExtPartitions'),
 | 
			
		||||
		},
 | 
			
		||||
	];
 | 
			
		||||
	if (['appimage', 'nsis', 'dmg'].includes(packageType)) {
 | 
			
		||||
		list.push({
 | 
			
		||||
 
 | 
			
		||||
@@ -138,6 +138,7 @@ const translation = {
 | 
			
		||||
			autoUpdate: 'Auto-updates enabled',
 | 
			
		||||
			settings: 'Settings',
 | 
			
		||||
			systemInformation: 'System Information',
 | 
			
		||||
			trimExtPartitions: 'Trim unallocated space on raw images (in ext-type partitions)',
 | 
			
		||||
		},
 | 
			
		||||
		menu: {
 | 
			
		||||
			edit: 'Edit',
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										1661
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										1661
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										20
									
								
								package.json
									
									
									
									
									
								
							
							
						
						
									
										20
									
								
								package.json
									
									
									
									
									
								
							@@ -2,7 +2,7 @@
 | 
			
		||||
  "name": "balena-etcher",
 | 
			
		||||
  "private": true,
 | 
			
		||||
  "displayName": "balenaEtcher",
 | 
			
		||||
  "version": "1.12.0",
 | 
			
		||||
  "version": "1.13.2",
 | 
			
		||||
  "packageType": "local",
 | 
			
		||||
  "main": "generated/etcher.js",
 | 
			
		||||
  "description": "Flash OS images to SD cards and USB drives, safely and easily.",
 | 
			
		||||
@@ -74,17 +74,17 @@
 | 
			
		||||
    "css-loader": "5.2.7",
 | 
			
		||||
    "d3": "4.13.0",
 | 
			
		||||
    "debug": "4.3.4",
 | 
			
		||||
    "electron": "12.2.3",
 | 
			
		||||
    "electron-builder": "22.14.13",
 | 
			
		||||
    "electron": "^13.5.0",
 | 
			
		||||
    "electron-builder": "^23.0.9",
 | 
			
		||||
    "electron-mocha": "9.3.3",
 | 
			
		||||
    "electron-notarize": "1.2.2",
 | 
			
		||||
    "electron-rebuild": "3.2.9",
 | 
			
		||||
    "electron-updater": "4.6.5",
 | 
			
		||||
    "electron-updater": "5.3.0",
 | 
			
		||||
    "esbuild-loader": "2.20.0",
 | 
			
		||||
    "etcher-sdk": "7.4.0",
 | 
			
		||||
    "etcher-sdk": "^7.4.6",
 | 
			
		||||
    "file-loader": "6.2.0",
 | 
			
		||||
    "husky": "4.3.8",
 | 
			
		||||
    "i18next": "21.8.14",
 | 
			
		||||
    "i18next": "21.10.0",
 | 
			
		||||
    "immutable": "3.8.2",
 | 
			
		||||
    "lint-staged": "10.5.4",
 | 
			
		||||
    "lodash": "4.17.21",
 | 
			
		||||
@@ -99,14 +99,14 @@
 | 
			
		||||
    "pretty-bytes": "5.6.0",
 | 
			
		||||
    "react": "16.8.5",
 | 
			
		||||
    "react-dom": "16.8.5",
 | 
			
		||||
    "react-i18next": "11.18.1",
 | 
			
		||||
    "react-i18next": "11.18.6",
 | 
			
		||||
    "redux": "4.2.0",
 | 
			
		||||
    "rendition": "19.3.2",
 | 
			
		||||
    "resin-corvus": "2.0.5",
 | 
			
		||||
    "semver": "7.3.8",
 | 
			
		||||
    "simple-progress-webpack-plugin": "1.1.2",
 | 
			
		||||
    "sinon": "9.2.4",
 | 
			
		||||
    "spectron": "14.0.0",
 | 
			
		||||
    "spectron": "15.0.0",
 | 
			
		||||
    "string-replace-loader": "3.1.0",
 | 
			
		||||
    "style-loader": "2.0.0",
 | 
			
		||||
    "styled-components": "5.3.6",
 | 
			
		||||
@@ -120,12 +120,12 @@
 | 
			
		||||
    "uuid": "8.3.2",
 | 
			
		||||
    "webpack": "5.75.0",
 | 
			
		||||
    "webpack-cli": "4.10.0",
 | 
			
		||||
    "webpack-dev-server": "4.5.0"
 | 
			
		||||
    "webpack-dev-server": "4.11.1"
 | 
			
		||||
  },
 | 
			
		||||
  "engines": {
 | 
			
		||||
    "node": ">=14 < 16"
 | 
			
		||||
  },
 | 
			
		||||
  "versionist": {
 | 
			
		||||
    "publishedAt": "2022-12-14T16:17:31.796Z"
 | 
			
		||||
    "publishedAt": "2023-01-02T20:55:58.804Z"
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -15,7 +15,7 @@
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
import * as CopyPlugin from 'copy-webpack-plugin';
 | 
			
		||||
import { readdirSync } from 'fs';
 | 
			
		||||
import { readdirSync, existsSync } from 'fs';
 | 
			
		||||
import * as _ from 'lodash';
 | 
			
		||||
import * as os from 'os';
 | 
			
		||||
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[] {
 | 
			
		||||
	const usbPrebuildsFolder = path.join('node_modules', 'usb', 'prebuilds')
 | 
			
		||||
	const usbPrebuildsFolder = path.join('node_modules', 'usb', 'prebuilds');
 | 
			
		||||
	const prebuildFolders = readdirSync(usbPrebuildsFolder);
 | 
			
		||||
	let bindingFile: string | undefined = 'node.napi.node';
 | 
			
		||||
	const platformFolder = prebuildFolders.find(
 | 
			
		||||
		(f) =>
 | 
			
		||||
			f.startsWith(os.platform()) &&
 | 
			
		||||
			f.indexOf(os.arch()) > -1,
 | 
			
		||||
		(f) => f.startsWith(os.platform()) && f.indexOf(os.arch()) > -1,
 | 
			
		||||
	);
 | 
			
		||||
	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(
 | 
			
		||||
		path.join(usbPrebuildsFolder, platformFolder)
 | 
			
		||||
	)
 | 
			
		||||
		path.join(usbPrebuildsFolder, platformFolder),
 | 
			
		||||
	);
 | 
			
		||||
 | 
			
		||||
	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) {
 | 
			
		||||
@@ -107,25 +127,22 @@ function findUsbPrebuild(): string[] {
 | 
			
		||||
	if (bindingFiles.length > 1) {
 | 
			
		||||
		bindingFile = bindingFiles.find((file) => {
 | 
			
		||||
			if (bindingFiles.indexOf('arm') > -1) {
 | 
			
		||||
				const process = require('process')
 | 
			
		||||
				return file.indexOf(process.config.variables.arm_version) > -1
 | 
			
		||||
				const process = require('process');
 | 
			
		||||
				return file.indexOf(process.config.variables.arm_version) > -1;
 | 
			
		||||
			} else {
 | 
			
		||||
				return file.indexOf('glibc') > -1
 | 
			
		||||
				return file.indexOf('glibc') > -1;
 | 
			
		||||
			}
 | 
			
		||||
		})
 | 
			
		||||
		});
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	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];
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
const [
 | 
			
		||||
	USB_BINDINGS_FOLDER,
 | 
			
		||||
	USB_BINDINGS_FILE,
 | 
			
		||||
] = findUsbPrebuild();
 | 
			
		||||
const [USB_BINDINGS_FOLDER, USB_BINDINGS_FILE] = findUsbPrebuild();
 | 
			
		||||
 | 
			
		||||
function findLzmaNativeBindingsFolder(): string {
 | 
			
		||||
	const files = readdirSync(
 | 
			
		||||
@@ -325,8 +342,8 @@ const commonConfig = {
 | 
			
		||||
			// 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
 | 
			
		||||
			// We use __dirname in the child-writer and electron.remote.app.getAppPath() in the renderer
 | 
			
		||||
			replace(/node_modules\/ext2fs\/lib\/libext2fs\.js$/, {
 | 
			
		||||
				search: 'scriptDirectory=__dirname+"/"',
 | 
			
		||||
			replace(makeExt2FsRegex(), {
 | 
			
		||||
				search: 'scriptDirectory = __dirname + "/";',
 | 
			
		||||
				replace: fetchWasm('ext2fs', 'lib'),
 | 
			
		||||
			}),
 | 
			
		||||
			// Same for node-crc-utils
 | 
			
		||||
@@ -388,7 +405,7 @@ const guiConfigCopyPatterns = [
 | 
			
		||||
		to: 'modules/node-raspberrypi-usbboot/blobs',
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		from: 'node_modules/ext2fs/lib/libext2fs.wasm',
 | 
			
		||||
		from: `${findExt2fsFolder()}/lib/libext2fs.wasm`,
 | 
			
		||||
		to: 'modules/ext2fs/lib/libext2fs.wasm',
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user