Last active
April 20, 2019 23:45
-
-
Save denizssch/b346709b9300fb7dfb580ca9c8fd61eb to your computer and use it in GitHub Desktop.
CrossOver Patch
This file contains hidden or 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
[Desktop Entry] | |
Version=1.0 | |
Type=Application | |
Name=CrossOver | |
Comment= | |
Exec=/opt/cxoffice/bin/crossover | |
Icon= | |
Path= | |
Terminal=false | |
StartupNotify=false |
This file contains hidden or 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
#! /usr/bin/env python | |
# (c) Copyright 2009-2015. CodeWeavers, Inc. | |
#Filename: crossover | |
import os | |
# Portable which(1) implementation | |
def which(path, app): | |
"""Looks for an executable in the specified directory list. | |
path is an os.pathsep-separated list of directories and app is the | |
executable name. If app contains a path separator then path is ignored. | |
If the file is not found, then None is returned. | |
""" | |
if os.path.isabs(app): | |
if os.path.isfile(app) and os.access(app, os.X_OK): | |
return app | |
elif os.sep in app or (os.altsep and os.altsep in app): | |
app_path = os.path.join(os.getcwd(), app) | |
if os.path.isfile(app_path) and os.access(app_path, os.X_OK): | |
return app_path | |
else: | |
for directory in path.split(os.pathsep): | |
if directory == "": | |
continue | |
app_path = os.path.join(directory, app) | |
if os.path.isfile(app_path) and os.access(app_path, os.X_OK): | |
return app_path | |
return None | |
import sys | |
def locate_cx_root(): | |
"""Locate where CrossOver is installed. | |
We start by locating our own python script file and walking back up the | |
path, traversing symbolic links on the way. Then we verify what we have | |
found the right directory by checking for the presence of the cxmenu | |
script. | |
""" | |
# pylint: disable=I0011,W0601,W0603 | |
global CX_ROOT | |
if "CX_DEVELOP_ROOT" in os.environ: | |
CX_ROOT = os.environ["CX_DEVELOP_ROOT"] | |
return | |
# figure out argv0 | |
argv0 = which(os.environ["PATH"], sys.argv[0]) | |
if not argv0: | |
argv0 = sys.argv[0] | |
if not os.path.isabs(argv0): | |
argv0 = os.path.join(os.getcwd(), argv0) | |
# traverse the symbolic links | |
dir0 = os.path.dirname(argv0) | |
while True: | |
if dir0.endswith("/lib"): | |
bindir = dir0[0:-3] + "bin" | |
else: | |
bindir = dir0 | |
landmark = os.path.join(bindir, "cxmenu") | |
if os.path.isfile(landmark): | |
break | |
if not os.path.islink(argv0): | |
break | |
argv0 = os.readlink(argv0) | |
if not os.path.isabs(argv0): | |
argv0 = os.path.join(dir0, argv0) | |
dir0 = os.path.dirname(argv0) | |
# compute CX_ROOT | |
CX_ROOT = os.path.dirname(os.path.normpath(bindir)) | |
# check CX_ROOT | |
landmark = os.path.join(CX_ROOT, "bin", "cxmenu") | |
if not os.path.isfile(landmark) or not os.access(landmark, os.X_OK): | |
sys.stderr.write("%s:error: could not find CrossOver in '%s'\n" % (os.path.dirname(sys.argv[0]), CX_ROOT)) | |
sys.exit(1) | |
sys.path.append(os.path.join(CX_ROOT, "lib", "python")) | |
locate_cx_root() | |
import cxutils | |
cxutils.CX_ROOT = CX_ROOT | |
import cxopt | |
def main(): | |
# Popup a warn when the user run CrossOver for Deepin in other distro | |
result = os.popen("cat /etc/issue | grep Deepin").readlines() | |
if result: | |
# pylint: disable=W0601 | |
global GUI | |
import crossover_deepin | |
GUI = crossover_deepin.CrossOverDeepin() | |
import gtk | |
gtk.main() | |
return 0 | |
# Parse the command line before we do anything that assumes $DISPLAY is set | |
# so we can handle --help and issue usage errors normally. | |
opt_parser = cxopt.Parser(usage="%prog [--help]", | |
description="CrossOver's main starting point for installing Windows applications, running them or managing bottles.") | |
opt_parser.add_option("--restore", dest="restore", help="Restores the bottle contained in the specified archive") | |
opt_parser.add_option("--allow-root", action='store_true', dest="allow_root", help="Don't warn about running this tool as root") | |
(options, args) = opt_parser.parse_args() | |
if args: | |
opt_parser.error("unexpected argument '%s'" % args[0]) | |
# Check for GTK+ and $DISPLAY, but also basic dependencies we will need | |
# to make Wine work. | |
import checkreq | |
if not checkreq.fix_all_bases(): | |
return 1 | |
import cxguitools | |
cxguitools.set_default_icon() | |
if not options.allow_root: | |
cxguitools.warn_if_root() | |
# Call the GUI __main__.GUI so it can be accessed from the console | |
# pylint: disable=W0601 | |
import crossoverui | |
GUI = crossoverui.open_or_show(options.restore) | |
import gtk | |
gtk.main() | |
return 0 | |
if __name__ == "__main__": | |
sys.exit(main()) |
This file contains hidden or 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
#Parte installazione | |
wget "http://ubuntu.mirrorservice.org/sites/packages.linuxdeepin.com/deepin/pool/non-free/c/crossover-deepin/crossover-deepin_16.0.6-1_i386.deb" && sudo apt install libnss-mdns && sudo dpkg -i crossover-deepin_16.0.6-1_i386.deb | |
#Parte Patch | |
cd /opt/cxoffice/bin && sudo wget -O crossover https://gist.github.com/denizssch/b346709b9300fb7dfb580ca9c8fd61eb/raw/c74c8982b28592fdb03eb443978f4824f2f4a8fd/crossover.py && ./crossover |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Patch for CrossOver loaded with other distros ^_^