From b59616c369c7921c29be6b0e370b70deb92704a5 Mon Sep 17 00:00:00 2001 From: Lawrence Date: Sun, 4 Feb 2018 16:55:50 -0500 Subject: [PATCH] install libc6 or glibc onto host --- installer.js | 10 +++++++++- package.json | 11 ++++++++--- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/installer.js b/installer.js index b6d9eb6..85ef71f 100644 --- a/installer.js +++ b/installer.js @@ -163,7 +163,15 @@ function platformUnpacker(source, destination){ const extract = decompress(source, destination); extract.on('file', (name) => { if ( whattocopy.indexOf(path.basename(name)) > 0) console.log(name); }); extract.on('error', (error) => { return reject(error); }); - extract.on('end', () => { resolve('linux'); }); + extract.on('end', () => { + const system_installer = require('system-install'); + const cmd = system_installer().split(" ")[0]; + const args = [ system_installer().split(" ")[1] ]; + const distro = args.concat(['install','-y']).concat(((system_installer().split(" ")[1] == 'yum') || (system_installer().split(" ")[1] == 'dnf')) ? ['glibc.i686'] : ['libc6-i386']); + console.log(cmd + ' ' + distro); + spawn.sync(cmd, distro, { stdio: 'pipe' }); + resolve('linux'); + }); } }); } diff --git a/package.json b/package.json index e1e61d3..5c74e9d 100644 --- a/package.json +++ b/package.json @@ -6,8 +6,8 @@ "scripts": { "coverage": "istanbul cover node_modules/mocha/bin/_mocha --dir .tmp/coverage", "coveralls": "npm install coveralls && cat .tmp/coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js", - "prepack": "node binarybuilder", - "install": "node installer" + "prepack": "node binarybuilder.js", + "install": "node installer.js" }, "repository": { "type": "git", @@ -57,10 +57,15 @@ "xar": "^1.1.1", "unpack-all": "github:techno-express/node-unpack-all", "macos-release": "^1.1.0", - "retrying-promise": "^0.0.4" + "retrying-promise": "^0.0.4", + "system-install": "^1.0.4", + "unpack-all": "github:techno-express/node-unpack-all", + "when": "^3.7.8", + "xar": "^1.1.1" }, "devDependencies": { "chai": "^3.5.0", + "fs-extra": "^5.0.0", "istanbul": "^0.4.5", "mocha": "^3.2.0" }