Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sign ooniprobe.exe during build #336

Merged
merged 1 commit into from
Mar 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 14 additions & 6 deletions scripts/download-probe-cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,7 @@ const dstDir = path.join(appRoot, 'build', 'probe-cli')

const download = () => {
ensureDirSync(dstDir)
const osarchs = [
'darwin-amd64',
'linux-amd64',
'windows-amd64',
]
const osarchs = ['darwin-amd64', 'linux-amd64', 'windows-amd64']
var osarch
for (osarch of osarchs) {
const extension = osarch.includes('windows') ? '.exe' : ''
Expand All @@ -30,7 +26,19 @@ const download = () => {
}
osarch = osarch.replace('-', '_')
ensureDirSync(`${dstDir}/${osarch}`)
execSync(`cp ${dstDir}/${versionedFilename} ${dstDir}/${osarch}/ooniprobe${extension}`)
if (osarch === 'windows_amd64') {
execSync(
`cp ${dstDir}/${versionedFilename} ${dstDir}/${osarch}/ooniprobe${extension}-unsigned`
)
execSync(
`osslsigncode sign -pkcs12 ${process.env.WIN_CSC_LINK} -pass ${process.env.WIN_CSC_KEY_PASSWORD} -n "OONI Probe CLI" -i https://ooni.org/ -in ${dstDir}/${osarch}/ooniprobe${extension}-unsigned -out ${dstDir}/${osarch}/ooniprobe${extension}`
)
execSync(`rm -rf ${dstDir}/${osarch}/ooniprobe${extension}-unsigned`)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe add an assert that dstDir and osarch are longer than some length to prevent unintended rm -rf

} else {
execSync(
`cp ${dstDir}/${versionedFilename} ${dstDir}/${osarch}/ooniprobe${extension}`
)
}
execSync(`chmod +x ${dstDir}/${osarch}/ooniprobe${extension}`)
}
}
Expand Down
Loading