Skip to content

Commit

Permalink
Sprinkle some JS salt on probe-cli download script
Browse files Browse the repository at this point in the history
  • Loading branch information
sarathms committed Nov 24, 2021
1 parent 5302fdf commit f4b05fb
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions scripts/download-bin.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,21 @@ const dstDir = path.join(appRoot, 'build', 'probe-cli')
const download = () => {
ensureDirSync(dstDir)
const osarchs = [
"darwin-amd64",
"linux-amd64",
"windows-amd64",
'darwin-amd64',
'linux-amd64',
'windows-amd64',
]
for (let i = 0; i < osarchs.length; i += 1) {
const extension = (osarchs[i] === "windows-amd64") ? ".exe" : ""
const filename = "ooniprobe-" + osarchs[i] + extension
var osarch
for (osarch of osarchs) {
const extension = osarch.includes('windows') ? '.exe' : ''
const filename = `ooniprobe-${osarch}${extension}`
const fileURL = `${baseURL}/${filename}`
const versionedFilename = probeVersion + "__" + filename
const versionedFilename = `${probeVersion}__${filename}`
if (existsSync(`${dstDir}/${versionedFilename}`) === false) {
console.log(`download ${versionedFilename}`)
execSync(`curl -#f -L -o ${dstDir}/${versionedFilename} ${fileURL}`)
}
const osarch = osarchs[i].replace("-", "_")
osarch = osarch.replace('-', '_')
ensureDirSync(`${dstDir}/${osarch}`)
execSync(`cp ${dstDir}/${versionedFilename} ${dstDir}/${osarch}/ooniprobe${extension}`)
execSync(`chmod +x ${dstDir}/${osarch}/ooniprobe${extension}`)
Expand Down

0 comments on commit f4b05fb

Please sign in to comment.