Skip to content

Commit

Permalink
allow for packaging parameters to be derived from process.arch (#774)
Browse files Browse the repository at this point in the history
  • Loading branch information
shiftkey committed Jan 29, 2023
1 parent abd50a7 commit a567784
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 4 deletions.
13 changes: 12 additions & 1 deletion script/package-debian.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,17 @@ import { rename } from 'fs-extra'
import { getVersion } from '../app/package-info'
import { getDistPath, getDistRoot } from './dist-info'

function getArchitecture() {
switch (process.arch) {
case 'arm64':
return 'arm64'
case 'arm':
return 'armhf'
default:
return 'amd64'
}
}

const distRoot = getDistRoot()

// best guess based on documentation
Expand Down Expand Up @@ -39,7 +50,7 @@ type DebianOptions = {
const options: DebianOptions = {
src: getDistPath(),
dest: distRoot,
arch: 'amd64',
arch: getArchitecture(),
description: 'Simple collaboration from your desktop',
productDescription:
'This is the unofficial port of GitHub Desktop for Linux distributions',
Expand Down
13 changes: 12 additions & 1 deletion script/package-electron-builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,17 @@ const globPromise = promisify(glob)

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

function getArchitecture() {
switch (process.arch) {
case 'arm64':
return '--arm64'
case 'arm':
return '--armv7l'
default:
return '--x64'
}
}

export async function packageElectronBuilder(): Promise<Array<string>> {
const distPath = getDistPath()
const distRoot = getDistRoot()
Expand All @@ -27,7 +38,7 @@ export async function packageElectronBuilder(): Promise<Array<string>> {
'build',
'--prepackaged',
distPath,
'--x64',
getArchitecture(),
'--config',
configPath,
]
Expand Down
15 changes: 13 additions & 2 deletions script/package-redhat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,25 @@ import { rename } from 'fs-extra'
import { getVersion } from '../app/package-info'
import { getDistPath, getDistRoot } from './dist-info'

function getArchitecture() {
switch (process.arch) {
case 'arm64':
return 'aarch64'
case 'arm':
return 'armv7l'
default:
return 'x86_64'
}
}

const distRoot = getDistRoot()

// best guess based on documentation
type RedhatOptions = {
// required
src: string
dest: string
arch: 'x86_64'
arch: string
// optional
description?: string
productDescription?: string
Expand All @@ -36,7 +47,7 @@ type RedhatOptions = {
const options: RedhatOptions = {
src: getDistPath(),
dest: distRoot,
arch: 'x86_64',
arch: getArchitecture(),
description: 'Simple collaboration from your desktop',
productDescription:
'This is the unofficial port of GitHub Desktop for Linux distributions',
Expand Down

0 comments on commit a567784

Please sign in to comment.