Skip to content

Commit

Permalink
Merge pull request #370 from mysteriumnetwork/universal-fix
Browse files Browse the repository at this point in the history
Fix binary paths/permissions
  • Loading branch information
tadaskay authored Jul 19, 2022
2 parents 3d2bcf9 + a3944ae commit b6b9e85
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 10 deletions.
6 changes: 3 additions & 3 deletions build/nsis/customize.nsi
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
RequestExecutionLevel admin

!macro customInstall
File "/oname=$INSTDIR\resources\static\bin\wintun.dll" "${BUILD_RESOURCES_DIR}\nsis\wintun.dll"
File "/oname=$INSTDIR\resources\app.asar.unpacked\node_modules\@mysteriumnetwork\node\bin\windows\x64\wintun.dll" "${BUILD_RESOURCES_DIR}\nsis\wintun.dll"

DetailPrint "Installing Supervisor service..."
nsExec::ExecToStack '"$INSTDIR\resources\static\bin\myst_supervisor.exe" --install --uid "0"'
nsExec::ExecToStack '"$INSTDIR\resources\app.asar.unpacked\node_modules\@mysteriumnetwork\node\bin\windows\x64\myst_supervisor.exe" --install --uid "0"'
Pop $0
Pop $1
${ifNot} $0 == 0
Expand All @@ -15,7 +15,7 @@ RequestExecutionLevel admin
!macro customRemoveFiles

DetailPrint "Uninstalling supervisor service..."
nsExec::ExecToStack '"$INSTDIR\resources\static\bin\myst_supervisor.exe" --uninstall'
nsExec::ExecToStack '"$INSTDIR\resources\app.asar.unpacked\node_modules\@mysteriumnetwork\node\bin\win32\x64\myst_supervisor.exe" --uninstall'
Pop $0
Pop $1
${ifNot} $0 == 0
Expand Down
28 changes: 28 additions & 0 deletions ci/afterPack.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/**
* Copyright (c) 2022 BlockDev AG
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
/* eslint-disable @typescript-eslint/no-var-requires */
const path = require("path")

const chmodr = require("chmodr")
const { Arch } = require("electron-builder")

exports.default = async function afterPack(context) {
const { electronPlatformName, appOutDir, packager, arch } = context
if (electronPlatformName === "darwin" && arch === Arch.universal) {
// Some files lose their attributes after app.asar merge (for macOS universal binary),
// thus we need to set +x for the binaries
const nodeBinDir = path.join(
packager.getResourcesDir(appOutDir),
"app.asar.unpacked",
"node_modules",
"@mysteriumnetwork",
"node",
"bin",
)
chmodr.sync(nodeBinDir, 0o755)
}
}
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"@fortawesome/free-brands-svg-icons": "^5.15.3",
"@fortawesome/free-solid-svg-icons": "^5.15.3",
"@fortawesome/react-fontawesome": "^0.1.14",
"@mysteriumnetwork/node": "1.9.5-p3",
"@mysteriumnetwork/node": "1.9.6",
"@mysteriumnetwork/terms": "0.0.41",
"@sentry/electron": "^3.0.7",
"@use-it/interval": "^1.0.0",
Expand Down Expand Up @@ -84,6 +84,7 @@
"@types/webpack-env": "^1.16.3",
"@typescript-eslint/eslint-plugin": "^5.23.0",
"@typescript-eslint/parser": "^5.23.0",
"chmodr": "^1.2.0",
"electron": "^19.0.8",
"electron-builder": "^23.1.0",
"electron-devtools-installer": "^3.2.0",
Expand Down Expand Up @@ -126,7 +127,7 @@
},
"files": [
"!**/node_modules/@mysteriumnetwork/node/bin/**",
"**/node_modules/@mysteriumnetwork/node/bin/${platform}/${arch}/**"
"**/node_modules/@mysteriumnetwork/node/bin/${os}/${arch}/**"
],
"mac": {
"target": {
Expand Down Expand Up @@ -193,6 +194,7 @@
"runAfterFinish": true,
"include": "build/nsis/customize.nsi"
},
"afterPack": "ci/afterPack.js",
"afterSign": "ci/notarize.js",
"publish": {
"provider": "github",
Expand Down
14 changes: 9 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1033,14 +1033,13 @@
lodash "^4.17.15"
tmp-promise "^3.0.2"

"@mysteriumnetwork/[email protected].5-p3":
version "1.9.5-p3"
resolved "https://registry.yarnpkg.com/@mysteriumnetwork/node/-/node-1.9.5-p3.tgz#679677d68933f6a966da040365f49ba125d1b8d2"
integrity sha512-VJwxA1Btukjz1hEHyMbmChoYZoFOGjvQ/cGpvxOmEoRMfvV4txBBlQiVZ5UYhyE4TC+euRf41kJhMg1FDRHsHw==
"@mysteriumnetwork/[email protected].6":
version "1.9.6"
resolved "https://registry.yarnpkg.com/@mysteriumnetwork/node/-/node-1.9.6.tgz#b3f1132908d9fa2c4bfba684759a8851f03a8f03"
integrity sha512-7xGv9wEA8IXkC5kOMjGz3Yxz4ItXEElTONzbJDEvQ1Yy37J4rKzlFXu7HZGIeLqq92/Ri6HKAarGZwrwPkM0kQ==
dependencies:
extract-zip "^2.0.0"
node-fetch "^2.6.7"
progress "^2.0.3"
semver "^7.3.7"
targz "^1.0.1"

Expand Down Expand Up @@ -2710,6 +2709,11 @@ character-reference-invalid@^1.0.0:
resolved "https://registry.yarnpkg.com/character-reference-invalid/-/character-reference-invalid-1.1.4.tgz#083329cda0eae272ab3dbbf37e9a382c13af1560"
integrity sha512-mKKUkUbhPpQlCOfIuZkvSEgktjPFIsZKRRbC6KWVEMvlzblj3i3asQv5ODsrwt0N3pHAEvjP8KTQPHkp0+6jOg==

chmodr@^1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/chmodr/-/chmodr-1.2.0.tgz#720e96caa09b7f1cdbb01529b7d0ab6bc5e118b9"
integrity sha512-Y5uI7Iq/Az6HgJEL6pdw7THVd7jbVOTPwsmcPOBjQL8e3N+pz872kzK5QxYGEy21iRys+iHWV0UZQXDFJo1hyA==

chokidar@^2.1.8:
version "2.1.8"
resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-2.1.8.tgz#804b3a7b6a99358c3c5c61e71d8728f041cff917"
Expand Down

0 comments on commit b6b9e85

Please sign in to comment.