-
Notifications
You must be signed in to change notification settings - Fork 592
CLI Compatibility for Linux #231
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
Changes from all commits
e64d729
0022f55
4948c5b
2f87032
1de65a4
2f1b16f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| #!/bin/sh | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Currently this file does not have the executable bit set after install: Should we just
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ah, good catch! I might have done that without thinking or assumed it was done on the folder level on installation; yes, we'd want to make it executable |
||
|
|
||
| if [ ! -L "$0" ]; then | ||
| # if path is not a symlink, find relatively | ||
| GITHUB_PATH=$(dirname "$(dirname "$(dirname "$(dirname "$0")")")") | ||
| else | ||
| if command -v readlink >/dev/null; then | ||
| # if readlink exists, follow the symlink and then find relatively | ||
| SYMLINK=$(readlink -f "$0") | ||
| GITHUB_PATH=$(dirname "$(dirname "$(dirname "$(dirname "$SYMLINK")")")") | ||
| else | ||
| # else use the standard install location | ||
| GITHUB_PATH="/opt/GitHub Desktop" | ||
| fi | ||
| fi | ||
| # check if this is a dev install or standard | ||
| if [ -f "$GITHUB_PATH/github-desktop-dev" ]; then | ||
| BINARY_NAME="github-desktop-dev" | ||
| else | ||
| BINARY_NAME="github-desktop" | ||
| fi | ||
|
|
||
| ELECTRON="$GITHUB_PATH/$BINARY_NAME" | ||
| CLI="$GITHUB_PATH/resources/app/cli.js" | ||
|
|
||
| ELECTRON_RUN_AS_NODE=1 "$ELECTRON" "$CLI" "$@" | ||
|
|
||
| exit $? | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,13 +4,21 @@ set -e | |
|
|
||
| PROFILE_D_FILE="/etc/profile.d/github-desktop.sh" | ||
| INSTALL_DIR="/opt/${productFilename}" | ||
| SCRIPT=$"#!/bin/sh | ||
| export PATH=\"$INSTALL_DIR:\$PATH\"" | ||
| CLI_DIR="$INSTALL_DIR/resources/app/static" | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Because we have full control over how the app is built for packaging, I think we can make the
I'm going to leave this here for now because it's working, but if I have any better ideas I'll let you know.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. AH that would certainly make it easier; then we just can create a symbolic link in the /usr/bin directory |
||
|
|
||
| case "$1" in | ||
| configure) | ||
| echo "$SCRIPT" > "${PROFILE_D_FILE}"; | ||
| . "${PROFILE_D_FILE}"; | ||
| # add executable permissions for CLI interface | ||
| chmod +x "$CLI_DIR"/github || : | ||
| # check if this is a dev install or standard | ||
| if [ -f "$INSTALL_DIR/github-desktop-dev" ]; then | ||
| BINARY_NAME="github-desktop-dev" | ||
| else | ||
| BINARY_NAME="github-desktop" | ||
| fi | ||
| # create symbolic links to /usr/bin directory | ||
| ln -f -s "$INSTALL_DIR"/$BINARY_NAME /usr/bin || : | ||
| ln -f -s "$CLI_DIR"/github /usr/bin || : | ||
| ;; | ||
|
|
||
| abort-upgrade|abort-remove|abort-deconfigure) | ||
|
|
@@ -22,4 +30,4 @@ case "$1" in | |
| ;; | ||
| esac | ||
|
|
||
| exit 0 | ||
| exit 0 | ||
Uh oh!
There was an error while loading. Please reload this page.