From 7de111726b655935371170bdeccad3cd5b6eeabb Mon Sep 17 00:00:00 2001 From: Ben Reaves Date: Mon, 11 May 2020 19:30:19 -0500 Subject: [PATCH] - Fixes install issue of kinto xkeysnail implementation on manjaro. Adds gcc check, closes #168. --- setup.py | 76 ++++++++++++++++++++++------------------- system-config/unipkg.sh | 6 ++-- xkeysnail_service.sh | 4 +-- 3 files changed, 45 insertions(+), 41 deletions(-) diff --git a/setup.py b/setup.py index 020eb45..aeb13a2 100755 --- a/setup.py +++ b/setup.py @@ -289,52 +289,54 @@ def Uninstall(): if dename == "kde" or dename == "xfce": print("Please log off and back on for your original DE hotkeys to take effect.") -check_xbind = cmdline("which xbindkeys 2>/dev/null").strip() -check_xdotool = cmdline("which xdotool 2>/dev/null").strip() -check_ibus = cmdline("which ibus-setup 2>/dev/null").strip() +def kintoImpOne(): -pkgm = cmdline("which apt-get 2>/dev/null").strip() + check_xbind = cmdline("which xbindkeys 2>/dev/null").strip() + check_xdotool = cmdline("which xdotool 2>/dev/null").strip() + check_ibus = cmdline("which ibus-setup 2>/dev/null").strip() -if len(pkgm) == 0: - pkgm = cmdline("which dnf 2>/dev/null").strip() - if len(pkgm) > 0: - pkgm += " check-update;sudo dnf install -y " -else: - pkgm += " install -y " - pkgm += " update; sudo apt-get install -y " + pkgm = cmdline("which apt-get 2>/dev/null").strip() -if len(pkgm) == 0: - pkgm = cmdline("which pacman 2>/dev/null").strip() - if len(pkgm) > 0: - pkgm += " -Syy; sudo pacman -S " + if len(pkgm) == 0: + pkgm = cmdline("which dnf 2>/dev/null").strip() + if len(pkgm) > 0: + pkgm += " check-update;sudo dnf install -y " + else: + pkgm += " install -y " + pkgm += " update; sudo apt-get install -y " + + if len(pkgm) == 0: + pkgm = cmdline("which pacman 2>/dev/null").strip() + if len(pkgm) > 0: + pkgm += " -Syy; sudo pacman -S " -if len(pkgm) == 0: - print("No supported package manager found. Exiting...") - sys.exit() + if len(pkgm) == 0: + print("No supported package manager found. Exiting...") + sys.exit() -runpkg = 0 -run_pkg = "" + runpkg = 0 + run_pkg = "" -if len(check_xbind) > 0 and len(check_xdotool) > 0 and len(check_ibus) > 0: - print("Xbindkeys, xdotool and IBus requirement is installed.") -if len(check_xbind) == 0: - run_pkg = "xbindkeys" - runpkg = 1 -if len(check_xdotool) == 0: - run_pkg += " xdotool" - runpkg = 1 -if len(check_ibus) == 0: - # may differ with distro, but for now - run_pkg += " ibus" - runpkg = 1 + if len(check_xbind) > 0 and len(check_xdotool) > 0 and len(check_ibus) > 0: + print("Xbindkeys, xdotool and IBus requirement is installed.") + if len(check_xbind) == 0: + run_pkg = "xbindkeys" + runpkg = 1 + if len(check_xdotool) == 0: + run_pkg += " xdotool" + runpkg = 1 + if len(check_ibus) == 0: + # may differ with distro, but for now + run_pkg += " ibus" + runpkg = 1 -if runpkg != 0: - requirements(pkgm) + if runpkg != 0: + requirements(pkgm) -if not os.path.exists(homedir + '/.config/ibus/bus') and cmdline("ls ~/.config/ibus/bus -1rt") == "": - install_ibus() + if not os.path.exists(homedir + '/.config/ibus/bus') and cmdline("ls ~/.config/ibus/bus -1rt") == "": + install_ibus() try: f = open("defaults.json") @@ -390,6 +392,8 @@ if(kintotype == 4): Uninstall() exit() +kintoImpOne() + for index, item in enumerate(data['defaulttypes']): ossym = "" if item == "windows": diff --git a/system-config/unipkg.sh b/system-config/unipkg.sh index a425d78..b161804 100755 --- a/system-config/unipkg.sh +++ b/system-config/unipkg.sh @@ -3,13 +3,13 @@ if pkgmgr="$( which apt-get )" 2> /dev/null; then echo "Debian" $pkgmgr update - $pkgmgr --yes --force-yes install "$1" + $pkgmgr --yes --force-yes install $1 elif pkgmgr="$( which dnf )" 2> /dev/null; then echo "dnf" - $pkgmgr check-update; $pkgmgr install -y "$1" + $pkgmgr check-update; $pkgmgr install -y $1 elif pkgmgr="$( which pacman )" 2> /dev/null; then echo "Arch-based" - $pkgmgr -Syy;yes | $pkgmgr -S "$1" + $pkgmgr -Syy;yes | $pkgmgr -S $1 else echo "Package manager not found, please install $1" >&2 exit 1 diff --git a/xkeysnail_service.sh b/xkeysnail_service.sh index d477c92..9a657a5 100755 --- a/xkeysnail_service.sh +++ b/xkeysnail_service.sh @@ -120,9 +120,9 @@ if [[ $1 == "1" || $1 == "2" || $1 == "3" || $1 == "winmac" || $1 == "mac" || $1 sudo ./system-config/unipkg.sh "$pydev" fi fi - if ! [ -x "$(command -v xhost)" ]; then + if ! [ -x "$(command -v xhost)" ] || ! [ -x "$(command -v gcc)" ]; then if [ "$distro" == "\"manjaro linux\"" ]; then - sudo ./system-config/unipkg.sh xorg-xhost + sudo ./system-config/unipkg.sh "xorg-xhost gcc" fi fi # echo "Transferring files..."