diff --git a/lib/appdmg.js b/lib/appdmg.js index 77748bf..238ad68 100644 --- a/lib/appdmg.js +++ b/lib/appdmg.js @@ -69,6 +69,8 @@ module.exports = exports = function (options) { const global = parseOptions(options) const resolvePath = (to) => path.resolve(global.resolveBase, to) + let isRosetta = false; + const pipeline = new Pipeline() /** @@ -391,6 +393,27 @@ module.exports = exports = function (options) { ds.write(path.join(global.temporaryMountPath, '.DS_Store'), (err) => next(err)) }) + /** + ** + **/ + + pipeline.addStep('Checking if running under Rosetta', function (next) { + util.sh( + 'sysctl', + ['-ni', 'sysctl.proc_translated'], + (error, result) => { + if ( + error == null && + result.errno === 0 && + result.stdout !== '' + ) { + isRosetta = true; + } + + next(); + }); + }); + /** ** **/ @@ -402,7 +425,7 @@ module.exports = exports = function (options) { '--folder', global.temporaryMountPath ] - if (os.arch() !== 'arm64') { + if (!isRosetta && os.arch() !== 'arm64') { args.push('--openfolder', global.temporaryMountPath) }