forked from desktop/desktop
-
Notifications
You must be signed in to change notification settings - Fork 529
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
move redhat packaging out to own step (#273)
- Loading branch information
Showing
9 changed files
with
153 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
import { promisify } from 'util' | ||
import { join } from 'path' | ||
|
||
import * as glob from 'glob' | ||
const globPromise = promisify(glob) | ||
|
||
import { rename } from 'fs-extra' | ||
|
||
import { getVersion } from '../app/package-info' | ||
import { getDistPath, getDistRoot } from './dist-info' | ||
|
||
const distRoot = getDistRoot() | ||
|
||
// best guess based on documentation | ||
type RedhatOptions = { | ||
// required | ||
src: string | ||
dest: string | ||
arch: 'x86_64' | ||
// optional | ||
description?: string | ||
productDescription?: string | ||
categories?: Array<string> | ||
icon?: any | ||
scripts?: { | ||
pre?: string | ||
post?: string | ||
preun?: string | ||
postun?: string | ||
} | ||
homepage?: string | ||
mimeType?: Array<string> | ||
requires?: Array<string> | ||
} | ||
|
||
const options: RedhatOptions = { | ||
src: getDistPath(), | ||
dest: distRoot, | ||
arch: 'x86_64', | ||
description: 'Simple collaboration from your desktop', | ||
productDescription: | ||
'This is the unofficial port of GitHub Desktop for Linux distributions', | ||
categories: ['GNOME', 'GTK', 'Development'], | ||
requires: [ | ||
// default Electron dependencies | ||
'libXScrnSaver', | ||
'libappindicator', | ||
'libX11-xcb', | ||
'alsa-lib', | ||
// dugite-native dependencies | ||
'libcurl', | ||
// keytar dependencies | ||
'libsecret', | ||
'gnome-keyring', | ||
], | ||
icon: { | ||
'256x256': 'app/static/logos/256x256.png', | ||
'512x512': 'app/static/logos/512x512.png', | ||
'1024x1024': 'app/static/logos/1024x1024.png', | ||
}, | ||
scripts: { | ||
post: 'script/resources/rpm/post.sh', | ||
preun: 'script/resources/rpm/preun.sh', | ||
}, | ||
homepage: 'https://github.com/shiftkey/desktop', | ||
mimeType: [ | ||
'x-scheme-handler/x-github-client', | ||
'x-scheme-handler/x-github-desktop-auth', | ||
// workaround for handling OAuth flow until we figure out what we're doing | ||
// with the development OAuth details | ||
// | ||
// see https://github.com/shiftkey/desktop/issues/72 for more details | ||
'x-scheme-handler/x-github-desktop-dev-auth', | ||
], | ||
} | ||
|
||
export async function packageRedhat(): Promise<string> { | ||
if (process.platform === 'win32') { | ||
return Promise.reject('Windows is not supported') | ||
} | ||
|
||
const installer = require('electron-installer-redhat') | ||
|
||
await installer(options) | ||
const installersPath = `${distRoot}/github-desktop*.rpm` | ||
|
||
const files = await globPromise(installersPath) | ||
|
||
if (files.length !== 1) { | ||
return Promise.reject( | ||
`Expected one file but instead found '${files.join(', ')}' - exiting...` | ||
) | ||
} | ||
|
||
const oldPath = files[0] | ||
|
||
const newFileName = `GitHubDesktop-linux-${getVersion()}.rpm` | ||
const newPath = join(distRoot, newFileName) | ||
await rename(oldPath, newPath) | ||
|
||
return Promise.resolve(newPath) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/bin/bash | ||
|
||
INSTALL_DIR="/usr/lib/github-desktop" | ||
CLI_DIR="$INSTALL_DIR/resources/app/static" | ||
|
||
# add executable permissions for CLI interface | ||
chmod +x "$CLI_DIR"/github || : | ||
|
||
# create symbolic links to /usr/bin directory | ||
ln -f -s "$CLI_DIR"/github /usr/bin || : | ||
|
||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/bin/bash | ||
|
||
BASE_FILE="/usr/bin/github" | ||
|
||
# remove symbolic links in /usr/bin directory | ||
test -f ${BASE_FILE} && unlink ${BASE_FILE} | ||
|
||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters