Skip to content

Commit 57b3d47

Browse files
committed
allow for packaging parameters to be derived from process.arch (#774)
1 parent 03c6cea commit 57b3d47

File tree

3 files changed

+37
-4
lines changed

3 files changed

+37
-4
lines changed

script/package-debian.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,17 @@ import { rename } from 'fs-extra'
99
import { getVersion } from '../app/package-info'
1010
import { getDistPath, getDistRoot } from './dist-info'
1111

12+
function getArchitecture() {
13+
switch (process.arch) {
14+
case 'arm64':
15+
return 'arm64'
16+
case 'arm':
17+
return 'armhf'
18+
default:
19+
return 'amd64'
20+
}
21+
}
22+
1223
const distRoot = getDistRoot()
1324

1425
// best guess based on documentation
@@ -39,7 +50,7 @@ type DebianOptions = {
3950
const options: DebianOptions = {
4051
src: getDistPath(),
4152
dest: distRoot,
42-
arch: 'amd64',
53+
arch: getArchitecture(),
4354
description: 'Simple collaboration from your desktop',
4455
productDescription:
4556
'This is the unofficial port of GitHub Desktop for Linux distributions',

script/package-electron-builder.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,17 @@ const globPromise = promisify(glob)
99

1010
import { getDistPath, getDistRoot } from './dist-info'
1111

12+
function getArchitecture() {
13+
switch (process.arch) {
14+
case 'arm64':
15+
return '--arm64'
16+
case 'arm':
17+
return '--armv7l'
18+
default:
19+
return '--x64'
20+
}
21+
}
22+
1223
export async function packageElectronBuilder(): Promise<Array<string>> {
1324
const distPath = getDistPath()
1425
const distRoot = getDistRoot()
@@ -27,7 +38,7 @@ export async function packageElectronBuilder(): Promise<Array<string>> {
2738
'build',
2839
'--prepackaged',
2940
distPath,
30-
'--x64',
41+
getArchitecture(),
3142
'--config',
3243
configPath,
3344
]

script/package-redhat.ts

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,25 @@ import { rename } from 'fs-extra'
99
import { getVersion } from '../app/package-info'
1010
import { getDistPath, getDistRoot } from './dist-info'
1111

12+
function getArchitecture() {
13+
switch (process.arch) {
14+
case 'arm64':
15+
return 'aarch64'
16+
case 'arm':
17+
return 'armv7l'
18+
default:
19+
return 'x86_64'
20+
}
21+
}
22+
1223
const distRoot = getDistRoot()
1324

1425
// best guess based on documentation
1526
type RedhatOptions = {
1627
// required
1728
src: string
1829
dest: string
19-
arch: 'x86_64'
30+
arch: string
2031
// optional
2132
description?: string
2233
productDescription?: string
@@ -36,7 +47,7 @@ type RedhatOptions = {
3647
const options: RedhatOptions = {
3748
src: getDistPath(),
3849
dest: distRoot,
39-
arch: 'x86_64',
50+
arch: getArchitecture(),
4051
description: 'Simple collaboration from your desktop',
4152
productDescription:
4253
'This is the unofficial port of GitHub Desktop for Linux distributions',

0 commit comments

Comments
 (0)