Skip to content

Commit

Permalink
fix debian builds
Browse files Browse the repository at this point in the history
Regression from #2430
  • Loading branch information
PalmerAL committed Aug 31, 2024
1 parent 2ac7641 commit f83db40
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 22 deletions.
4 changes: 1 addition & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,8 @@
"buildMacIntel": "npm run build && node ./scripts/buildMac.js --platform=x86",
"buildMacArm": "npm run build && node ./scripts/buildMac.js --platform=arm64",
"buildDebian": "npm run build && node ./scripts/buildDebian.js --platform=amd64",
"buildRaspi": "npm run build && node ./scripts/buildDebian.js --platform=armhf",
"buildLinuxArm64": "npm run build && node ./scripts/buildDebian.js --platform=arm64",
"buildRedhat": "npm run build && node ./scripts/buildRedhat.js",
"buildAll": "npm run buildWindows && npm run buildMacIntel && npm run buildMacArm && npm run buildDebian && npm run buildRedhat && npm run buildRaspi && npm run buildLinuxArm64 && npm run buildAppImage",
"buildAll": "npm run buildWindows && npm run buildMacIntel && npm run buildMacArm && npm run buildDebian && npm run buildRedhat && npm run buildAppImage",
"buildAppImage": "npm run build && node ./scripts/buildAppImage.js",
"updateFilters": "node ./ext/filterLists/updateEasylist.js",
"updateHttpsList": "node ./ext/httpsUpgrade/updateHttpsList.js",
Expand Down
32 changes: 13 additions & 19 deletions scripts/buildDebian.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,10 @@
const packageFile = require('./../package.json')
const version = packageFile.version
const platform = process.argv.find(arg => arg.match('platform')).split('=')[1]
const builder = require('electron-builder')
const Platform = builder.Platform
const Arch = builder.Arch

function toArch (platform) {
switch (platform) {
case 'amd64':
return Arch.x64
case 'armhf':
return Arch.armv7l
case 'arm64':
return Arch.arm64
default:
return Arch.universal
}
}
const createPackage = require('./createPackage.js')

require('./createPackage.js')('linux', { arch: toArch(platform) }).then(function (path) {
async function afterPackageBuilt (path, arch) {
var installerOptions = {
artifactName: 'min-${version}-${arch}.deb',
packageName: 'min',
Expand Down Expand Up @@ -62,14 +48,22 @@ require('./createPackage.js')('linux', { arch: toArch(platform) }).then(function
publish: null
}

builder.build({
await builder.build({
prepackaged: path,
targets: Platform.LINUX.createTarget(['deb'], toArch(platform)),
targets: Platform.LINUX.createTarget(['deb'], arch),
config: options
})
.then(() => console.log('Successfully created package.'))
.catch(err => {
console.error(err, err.stack)
process.exit(1)
})
})
}

const arches = [Arch.x64, Arch.armv7l, Arch.arm64];

(async () => {
for (const arch of arches) {
await createPackage('linux', { arch: arch }).then(path => afterPackageBuilt(path, arch))
}
})()

0 comments on commit f83db40

Please sign in to comment.