void-packages/srcpkgs/atom/patches/fixes.patch

185 lines
6.4 KiB
Diff

diff -Naurp0 a/atom.sh b/atom.sh
--- a/atom.sh 2019-11-08 22:04:23.210260827 +0300
+++ b/atom.sh 2019-11-08 22:08:36.721968851 +0300
@@ -2,25 +1,0 @@
-
-if [ "$(uname)" == 'Darwin' ]; then
- OS='Mac'
-elif [ "$(expr substr $(uname -s) 1 5)" == 'Linux' ]; then
- OS='Linux'
-else
- echo "Your platform ($(uname -a)) is not supported."
- exit 1
-fi
-
-case $(basename $0) in
- atom-beta)
- CHANNEL=beta
- ;;
- atom-nightly)
- CHANNEL=nightly
- ;;
- atom-dev)
- CHANNEL=dev
- ;;
- *)
- CHANNEL=stable
- ;;
-esac
-
@@ -91,0 +67 @@ mkdir -p "$ATOM_HOME"
+ATOM_PATH="/usr/libexec/atom/atom"
@@ -93,9 +69,5 @@ mkdir -p "$ATOM_HOME"
-if [ $OS == 'Mac' ]; then
- if [ -L "$0" ]; then
- SCRIPT="$(readlink "$0")"
- else
- SCRIPT="$0"
- fi
- ATOM_APP="$(dirname "$(dirname "$(dirname "$(dirname "$SCRIPT")")")")"
- if [ "$ATOM_APP" == . ]; then
- unset ATOM_APP
+if [ $EXPECT_OUTPUT ]; then
+ "$ATOM_PATH" --executed-from="$(pwd)" --pid=$$ "$@"
+ ATOM_EXIT=$?
+ if [ ${ATOM_EXIT} -eq 0 ] && [ -n "${EXIT_CODE_OVERRIDE}" ]; then
+ exit "${EXIT_CODE_OVERRIDE}"
@@ -103,2 +75 @@ if [ $OS == 'Mac' ]; then
- ATOM_PATH="$(dirname "$ATOM_APP")"
- ATOM_APP_NAME="$(basename "$ATOM_APP")"
+ exit ${ATOM_EXIT}
@@ -106,85 +77,6 @@ if [ $OS == 'Mac' ]; then
-
- if [ ! -z "${ATOM_APP_NAME}" ]; then
- # If ATOM_APP_NAME is known, use it as the executable name
- ATOM_EXECUTABLE_NAME="${ATOM_APP_NAME%.*}"
- else
- # Else choose it from the inferred channel name
- if [ "$CHANNEL" == 'beta' ]; then
- ATOM_EXECUTABLE_NAME="Atom Beta"
- elif [ "$CHANNEL" == 'nightly' ]; then
- ATOM_EXECUTABLE_NAME="Atom Nightly"
- elif [ "$CHANNEL" == 'dev' ]; then
- ATOM_EXECUTABLE_NAME="Atom Dev"
- else
- ATOM_EXECUTABLE_NAME="Atom"
- fi
- fi
-
- if [ -z "${ATOM_PATH}" ]; then
- # If ATOM_PATH isn't set, check /Applications and then ~/Applications for Atom.app
- if [ -x "/Applications/$ATOM_APP_NAME" ]; then
- ATOM_PATH="/Applications"
- elif [ -x "$HOME/Applications/$ATOM_APP_NAME" ]; then
- ATOM_PATH="$HOME/Applications"
- else
- # We haven't found an Atom.app, use spotlight to search for Atom
- ATOM_PATH="$(mdfind "kMDItemCFBundleIdentifier == 'com.github.atom'" | grep -v ShipIt | head -1 | xargs -0 dirname)"
-
- # Exit if Atom can't be found
- if [ ! -x "$ATOM_PATH/$ATOM_APP_NAME" ]; then
- echo "Cannot locate ${ATOM_APP_NAME}, it is usually located in /Applications. Set the ATOM_PATH environment variable to the directory containing ${ATOM_APP_NAME}."
- exit 1
- fi
- fi
- fi
-
- if [ $EXPECT_OUTPUT ]; then
- "$ATOM_PATH/$ATOM_APP_NAME/Contents/MacOS/$ATOM_EXECUTABLE_NAME" --executed-from="$(pwd)" --pid=$$ "$@"
- ATOM_EXIT=$?
- if [ ${ATOM_EXIT} -eq 0 ] && [ -n "${EXIT_CODE_OVERRIDE}" ]; then
- exit "${EXIT_CODE_OVERRIDE}"
- else
- exit ${ATOM_EXIT}
- fi
- else
- open -a "$ATOM_PATH/$ATOM_APP_NAME" -n --args --executed-from="$(pwd)" --pid=$$ --path-environment="$PATH" "$@"
- fi
-elif [ $OS == 'Linux' ]; then
- SCRIPT=$(readlink -f "$0")
- USR_DIRECTORY=$(readlink -f $(dirname $SCRIPT)/..)
-
- case $CHANNEL in
- beta)
- ATOM_PATH="$USR_DIRECTORY/share/atom-beta/atom"
- ;;
- nightly)
- ATOM_PATH="$USR_DIRECTORY/share/atom-nightly/atom"
- ;;
- dev)
- ATOM_PATH="$USR_DIRECTORY/share/atom-dev/atom"
- ;;
- *)
- ATOM_PATH="$USR_DIRECTORY/share/atom/atom"
- ;;
- esac
-
- : ${TMPDIR:=/tmp}
-
- [ -x "$ATOM_PATH" ] || ATOM_PATH="$TMPDIR/atom-build/Atom/atom"
-
- if [ $EXPECT_OUTPUT ]; then
- "$ATOM_PATH" --executed-from="$(pwd)" --pid=$$ "$@"
- ATOM_EXIT=$?
- if [ ${ATOM_EXIT} -eq 0 ] && [ -n "${EXIT_CODE_OVERRIDE}" ]; then
- exit "${EXIT_CODE_OVERRIDE}"
- else
- exit ${ATOM_EXIT}
- fi
- else
- (
- nohup "$ATOM_PATH" --executed-from="$(pwd)" --pid=$$ "$@" > "$ATOM_HOME/nohup.out" 2>&1
- if [ $? -ne 0 ]; then
- cat "$ATOM_HOME/nohup.out"
- exit $?
- fi
- ) &
+else
+ (
+ nohup "$ATOM_PATH" --executed-from="$(pwd)" --pid=$$ "$@" > "$ATOM_HOME/nohup.out" 2>&1
+ if [ $? -ne 0 ]; then
+ cat "$ATOM_HOME/nohup.out"
+ exit $?
@@ -191,0 +84 @@ elif [ $OS == 'Linux' ]; then
+ ) &
diff -Naurp0 a/resources/linux/atom.desktop.in b/resources/linux/atom.desktop.in
--- a/resources/linux/atom.desktop.in 2019-11-08 22:29:18.312985700 +0300
+++ b/resources/linux/atom.desktop.in 2019-11-08 22:31:30.748437296 +0300
@@ -2,2 +2,2 @@
-Name=<%= appName %>
-Comment=<%= description %>
+Name=Atom
+Comment=Chrome-based text editor from Github
@@ -5,2 +5,2 @@ GenericName=Text Editor
-Exec=env ATOM_DISABLE_SHELLING_OUT_FOR_ENVIRONMENT=false <%= installDir %>/bin/<%= appFileName %> %F
-Icon=<%= iconPath %>
+Exec=env ATOM_DISABLE_SHELLING_OUT_FOR_ENVIRONMENT=false /usr/bin/atom %F
+Icon=atom
diff -Naurp0 a/script/lib/install-application.js b/script/lib/install-application.js
--- a/script/lib/install-application.js 2019-11-08 22:32:22.593396868 +0300
+++ b/script/lib/install-application.js 2019-11-08 22:58:19.347068485 +0300
@@ -90 +90 @@ module.exports = function(packagedAppPat
- const shareDirPath = path.join(prefixDirPath, 'share');
+ const shareDirPath = path.join(prefixDirPath, 'libexec');
@@ -103 +103 @@ module.exports = function(packagedAppPat
- const baseIconThemeDirPath = findBaseIconThemeDirPath();
+ const baseIconThemeDirPath = path.join(prefixDirPath, 'share/icons/hicolor')
@@ -216 +216 @@ module.exports = function(packagedAppPat
- 'share',
+ 'libexec',
diff -Naurp0 a/src/main-process/atom-application.js b/src/main-process/atom-application.js
--- a/src/main-process/atom-application.js 2019-11-08 22:12:01.212764247 +0300
+++ b/src/main-process/atom-application.js 2019-11-08 22:16:34.637836128 +0300
@@ -719 +719 @@ module.exports = class AtomApplication e
- path.join(process.resourcesPath, 'LICENSE.md')
+ '/usr/share/licenses/atom/LICENSE.md'
@@ -2050 +2050 @@ module.exports = class AtomApplication e
- const args = [];
+ const args = ['/usr/lib/atom/atom'];
diff -Naurp0 a/src/workspace.js b/src/workspace.js
--- a/src/workspace.js 2019-11-08 22:14:27.324474946 +0300
+++ b/src/workspace.js 2019-11-08 22:15:49.853005612 +0300
@@ -1303 +1303 @@ module.exports = class Workspace extends
- return this.open(path.join(process.resourcesPath, 'LICENSE.md'));
+ return this.open('/usr/share/licenses/atom/LICENSE.md');