Skip to content

Commit 7f6cb9a

Browse files
Detect Alpine linux and download specific binary
1 parent d238484 commit 7f6cb9a

File tree

1 file changed

+22
-4
lines changed

1 file changed

+22
-4
lines changed

lib/LocalBinary.js

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ var https = require('https'),
33
fs = require('fs'),
44
path = require('path'),
55
os = require('os'),
6+
childProcess = require('child_process'),
67
HttpsProxyAgent = require('https-proxy-agent'),
78
LocalError = require('./LocalError');
89

@@ -16,12 +17,29 @@ function LocalBinary(){
1617
this.windows = true;
1718
this.httpPath = 'https://s3.amazonaws.com/bstack-local-prod/BrowserStackLocal.exe';
1819
} else {
19-
if(this.is64bits)
20-
this.httpPath = 'https://s3.amazonaws.com/bstack-local-prod/BrowserStackLocal-linux-x64';
21-
else
22-
this.httpPath = 'https://s3.amazonaws.com/bstack-local-prod/BrowserStackLocal-linux-ia32';
20+
if(this.isAlpine()) {
21+
this.httpPath = 'https://s3.amazonaws.com/bstack-local-prod/BrowserStackLocal-alpine';
22+
} else {
23+
if(this.is64bits)
24+
this.httpPath = 'https://s3.amazonaws.com/bstack-local-prod/BrowserStackLocal-linux-x64';
25+
else
26+
this.httpPath = 'https://s3.amazonaws.com/bstack-local-prod/BrowserStackLocal-linux-ia32';
27+
}
2328
}
2429

30+
this.isAlpine = function() {
31+
try {
32+
const stdout = childProcess.execSync('grep -w "NAME" /etc/os-release');
33+
if (/Alpine/.test(stdout)) {
34+
return true;
35+
} else {
36+
return false;
37+
}
38+
} catch(e) {
39+
return false;
40+
}
41+
};
42+
2543
this.retryBinaryDownload = function(conf, destParentDir, callback, retries, binaryPath) {
2644
var that = this;
2745
if(retries > 0) {

0 commit comments

Comments
 (0)