mirror of
https://github.com/rbreaves/kinto.git
synced 2025-08-02 00:56:39 +02:00
Adding support for sysvinit for mxlinux w/ xfce
This commit is contained in:
@@ -54,7 +54,15 @@ class MyWindow(Gtk.Window):
|
||||
openWin = False
|
||||
|
||||
global child_pid
|
||||
kinto_status = Popen("while :; do clear; systemctl is-active xkeysnail; sleep 2; done", stdout=PIPE, shell=True)
|
||||
global sysv
|
||||
try:
|
||||
sysv = int(Popen("pidof systemd >/dev/null 2>&1 && echo '0' || echo '1'", stdout=PIPE, shell=True).communicate()[0].strip().decode('UTF-8'))
|
||||
except:
|
||||
sysv = 2
|
||||
if sysv:
|
||||
kinto_status = Popen("while :; do clear; pgrep 'xkeysnail' && echo 'active'; sleep 2; done", stdout=PIPE, shell=True)
|
||||
else:
|
||||
kinto_status = Popen("while :; do clear; systemctl is-active xkeysnail; sleep 2; done", stdout=PIPE, shell=True)
|
||||
child_pid = kinto_status.pid
|
||||
|
||||
winkb = Gtk.RadioMenuItem(label='Windows')
|
||||
@@ -114,9 +122,15 @@ class MyWindow(Gtk.Window):
|
||||
None,
|
||||
)
|
||||
if self.args.debug:
|
||||
self.command = 'sudo systemctl stop xkeysnail && sudo pkill -f bin/xkeysnail && sudo xkeysnail ~/.config/kinto/kinto.py\n'
|
||||
if sysv:
|
||||
self.command = 'sudo /etc/init.d/kinto stop && sudo pkill -f bin/xkeysnail && sudo xkeysnail ~/.config/kinto/kinto.py\n'
|
||||
else:
|
||||
self.command = 'sudo systemctl stop xkeysnail && sudo pkill -f bin/xkeysnail && sudo xkeysnail ~/.config/kinto/kinto.py\n'
|
||||
else:
|
||||
self.command = "journalctl -f --unit=xkeysnail.service -b\n"
|
||||
if sysv:
|
||||
self.command = "tail -f /tmp/kinto.log\n"
|
||||
else:
|
||||
self.command = "journalctl -f --unit=xkeysnail.service -b\n"
|
||||
|
||||
self.InputToTerm(self.command)
|
||||
|
||||
@@ -343,7 +357,6 @@ class MyWindow(Gtk.Window):
|
||||
self.menuitem_systray.signal_id = self.menuitem_systray.connect('activate',self.checkTray,False)
|
||||
|
||||
restartsvc = True
|
||||
|
||||
|
||||
def initSetup(self):
|
||||
global win,openWin,restartsvc
|
||||
@@ -456,7 +469,7 @@ class MyWindow(Gtk.Window):
|
||||
def image2pixbuf(self,im):
|
||||
data = im.tobytes()
|
||||
w, h = im.size
|
||||
print(im.size)
|
||||
# print(im.size)
|
||||
data = GLib.Bytes.new(data)
|
||||
pix = GdkPixbuf.Pixbuf.new_from_bytes(data, GdkPixbuf.Colorspace.RGB,True, 8, w, h, w * 4)
|
||||
return pix
|
||||
@@ -517,7 +530,10 @@ class MyWindow(Gtk.Window):
|
||||
return
|
||||
|
||||
def runDebug(self,button):
|
||||
command = 'send \003 sudo systemctl stop xkeysnail && sudo pkill -f bin/xkeysnail && sudo xkeysnail ~/.config/kinto/kinto.py\n'
|
||||
if sysv:
|
||||
command = 'send \003 sudo /etc/init.d/kinto stop && sudo pkill -f bin/xkeysnail && sudo xkeysnail ~/.config/kinto/kinto.py\n'
|
||||
else:
|
||||
command = 'send \003 sudo systemctl stop xkeysnail && sudo pkill -f bin/xkeysnail && sudo xkeysnail ~/.config/kinto/kinto.py\n'
|
||||
self.InputToTerm(command)
|
||||
|
||||
def openSupport(self,button):
|
||||
@@ -610,7 +626,10 @@ class MyWindow(Gtk.Window):
|
||||
self.queryConfig(killspawn)
|
||||
time.sleep(1)
|
||||
global child_pid
|
||||
self.kinto_status = Popen("while :; do clear; systemctl is-active xkeysnail; sleep 2; done", stdout=PIPE, shell=True)
|
||||
if sysv:
|
||||
self.kinto_status = Popen("while :; do clear; pgrep 'xkeysnail'; sleep 2; done", stdout=PIPE, shell=True)
|
||||
else:
|
||||
self.kinto_status = Popen("while :; do clear; systemctl is-active xkeysnail; sleep 2; done", stdout=PIPE, shell=True)
|
||||
child_pid = self.kinto_status.pid
|
||||
self.menuitem_systray.disconnect(self.menuitem_systray.signal_id)
|
||||
self.menuitem_systray.set_active(False)
|
||||
@@ -618,6 +637,7 @@ class MyWindow(Gtk.Window):
|
||||
return
|
||||
|
||||
def setKB(self,button,kbtype):
|
||||
global sysv
|
||||
try:
|
||||
if kbtype == "win":
|
||||
setkb = 's/^(\s{3})(\s{1}#)(.*# WinMac.*)|^(?!\s{4}#)(\s{3})(\s{1})(.*)( # )(Mac.*)|^(?!\s{4}#)(\s{3})(\s{1})(.*)( # )(IBM.*)|^(?!\s{4}#)(\s{3})(\s{1})(.*)( # )(Chromebook.*)|^(\s{3})(\s{1}# )(-)( Default Win)|^(\s{3})(\s{1}# )(-)(- Default Mac*)/ $3$7$6$7$8$12$11$12$13$17$16$17$18$20$21$21$22$24$26/g'
|
||||
@@ -654,7 +674,10 @@ class MyWindow(Gtk.Window):
|
||||
elif kbtype == "ibm":
|
||||
setkb ='s/^(\s{3})(\s{1}#)(.*# IBM.*)|^(?!\s{4}#)(\s{3})(\s{1})(.*)( # )(WinMac.*)|^(?!\s{4}#)(\s{3})(\s{1})(.*)( # )(Mac.*)|^(?!\s{4}#)(\s{3})(\s{1})(.*)( # )(Chromebook.*)|^(\s{3})(\s{1}# )(-)(- Default (Win|Mac.*))/ $3$7$6$7$8$12$11$12$13$17$16$17$18$20$22/g'
|
||||
|
||||
restart = ['sudo', 'systemctl','restart','xkeysnail']
|
||||
if sysv:
|
||||
restart = ['sudo', '-E','/etc/init.d/kinto','restart']
|
||||
else:
|
||||
restart = ['sudo', 'systemctl','restart','xkeysnail']
|
||||
cmds = ['perl','-pi','-e',setkb,self.kconfig]
|
||||
|
||||
cmdsTerm = Popen(cmds)
|
||||
@@ -746,11 +769,14 @@ class MyWindow(Gtk.Window):
|
||||
}
|
||||
|
||||
def on_delete_event(event, self, widget):
|
||||
global restartsvc, openWin
|
||||
global restartsvc, openWin, sysv
|
||||
|
||||
if restartsvc == True:
|
||||
try:
|
||||
restartcmd = ['sudo', 'systemctl','restart','xkeysnail']
|
||||
if sysv:
|
||||
restartcmd = ['sudo', '-E','/etc/init.d/kinto','restart']
|
||||
else:
|
||||
restartcmd = ['sudo', 'systemctl','restart','xkeysnail']
|
||||
Popen(restartcmd)
|
||||
restartsvc = False
|
||||
|
||||
@@ -870,8 +896,12 @@ class MyWindow(Gtk.Window):
|
||||
return
|
||||
|
||||
def runRestart(self,button):
|
||||
global sysv
|
||||
try:
|
||||
stop = Popen(['sudo', 'systemctl','stop','xkeysnail'])
|
||||
if sysv:
|
||||
stop = Popen(['sudo', '-E','/etc/init.d/kinto','stop'])
|
||||
else:
|
||||
stop = Popen(['sudo', 'systemctl','stop','xkeysnail'])
|
||||
stop.wait()
|
||||
time.sleep(1)
|
||||
res = Popen(['pgrep','xkeysnail'])
|
||||
@@ -880,15 +910,23 @@ class MyWindow(Gtk.Window):
|
||||
if res.returncode == 0:
|
||||
pkillxkey = Popen(['sudo', 'pkill','-f','bin/xkeysnail'])
|
||||
pkillxkey.wait()
|
||||
Popen(['sudo', 'systemctl','start','xkeysnail'])
|
||||
self.command = "send \003 journalctl -f --unit=xkeysnail.service -b\n"
|
||||
if sysv:
|
||||
Popen(['sudo','-E','/etc/init.d/kinto','start'])
|
||||
self.command = "send \003 tail -f /tmp/kinto.log\n"
|
||||
else:
|
||||
Popen(['sudo','systemctl','start','xkeysnail'])
|
||||
self.command = "send \003 journalctl -f --unit=xkeysnail.service -b\n"
|
||||
self.InputToTerm(self.command)
|
||||
except:
|
||||
Popen(['notify-send','Kinto: Errror restarting Kinto!'])
|
||||
|
||||
def runStop(self,button):
|
||||
global sysv
|
||||
try:
|
||||
stop = Popen(['sudo', 'systemctl','stop','xkeysnail'])
|
||||
if sysv:
|
||||
stop = Popen(['sudo', '-E','/etc/init.d/kinto','stop'])
|
||||
else:
|
||||
stop = Popen(['sudo', 'systemctl','stop','xkeysnail'])
|
||||
stop.wait()
|
||||
time.sleep(1)
|
||||
res = Popen(['pgrep','xkeysnail'])
|
||||
@@ -1077,7 +1115,7 @@ class MyWindow(Gtk.Window):
|
||||
except:
|
||||
pass
|
||||
|
||||
print(Vte.get_minor_version())
|
||||
# print(Vte.get_minor_version())
|
||||
|
||||
# def on_menu_auto(self, widget):
|
||||
# print("add file open dialog")
|
||||
|
57
linux/kinto-service.sh
Executable file
57
linux/kinto-service.sh
Executable file
@@ -0,0 +1,57 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# chkconfig: 35 90 12
|
||||
# description: Kinto service
|
||||
#
|
||||
|
||||
# Get function from functions library
|
||||
# . /etc/init.d/functions
|
||||
|
||||
# Start the service
|
||||
start() {
|
||||
echo -n "Starting Kinto (xkeynsail)" | logger
|
||||
xkeycount=$(pgrep 'xkeysnail' | wc -l)
|
||||
|
||||
if [[ $xkeycount -eq 0 ]]; then
|
||||
/usr/bin/xhost +SI:localuser:root && script -q -c "xkeysnail --quiet --watch `echo $HOME`/.config/kinto/kinto.py" /dev/null | tee -a /tmp/kinto.log &
|
||||
### Create the lock file ###
|
||||
touch /var/lock/subsys/kinto
|
||||
success $"Kinto (xkeynsail) started"
|
||||
else
|
||||
echo "Kinto (xkeynsail) service is already running."
|
||||
fi
|
||||
|
||||
echo
|
||||
}
|
||||
|
||||
# Restart the service
|
||||
stop() {
|
||||
echo -n "Stopping Kinto (xkeynsail)" | logger
|
||||
pgrep 'xkeysnail' | xargs -r -n1 sudo kill
|
||||
### Now, delete the lock file ###
|
||||
rm -f /var/lock/subsys/kinto
|
||||
echo
|
||||
}
|
||||
|
||||
### main logic ###
|
||||
case "$1" in
|
||||
start)
|
||||
start
|
||||
;;
|
||||
stop)
|
||||
stop
|
||||
;;
|
||||
status)
|
||||
status
|
||||
;;
|
||||
restart|reload|condrestart)
|
||||
stop
|
||||
sleep 2
|
||||
start
|
||||
;;
|
||||
*)
|
||||
echo $"Usage: $0 {start|stop|restart|reload|status}"
|
||||
exit 1
|
||||
esac
|
||||
|
||||
exit 0
|
@@ -1,4 +1,7 @@
|
||||
# /etc/sudoers.d/limitedadmins
|
||||
Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/X11/bin"
|
||||
Defaults!/etc/init.d/kinto setenv,env_reset,env_delete+=PATH,env_delete+=LD_PRELOAD,env_delete+=LD_LIBRARY_PATH,env_delete+=SSH_AUTH_SOCK,env_delete+=PYTHONPATH,env_delete+=PERL5LIB
|
||||
%{username} ALL=NOPASSWD: /etc/init.d/kinto *
|
||||
%{username} ALL=NOPASSWD: {systemctl} restart xkeysnail
|
||||
%{username} ALL=NOPASSWD: {systemctl} start xkeysnail
|
||||
%{username} ALL=NOPASSWD: {systemctl} stop xkeysnail
|
||||
@@ -6,5 +9,5 @@
|
||||
%{username} ALL=(root) NOPASSWD: /usr/local/bin/logoff.sh
|
||||
%{username} ALL=NOPASSWD: {pkill} -f logoff
|
||||
%{username} ALL=NOPASSWD: {pkill} -f bin/xkeysnail
|
||||
%{username} ALL=NOPASSWD: {xkeysnail} /home/{username}/.config/kinto/kinto.py
|
||||
%{username} ALL=NOPASSWD: {xkeysnail} *
|
||||
%{username} ALL=NOPASSWD: {systemctl} is-active --quiet xkeysnail
|
||||
|
@@ -7,7 +7,7 @@ gi.require_version('AppIndicator3', '0.1')
|
||||
gi.require_version('Notify', '0.7')
|
||||
|
||||
import signal,time,os,fcntl,datetime,re
|
||||
from subprocess import Popen, PIPE, CalledProcessError
|
||||
from subprocess import Popen, PIPE, CalledProcessError, check_output
|
||||
from shutil import which
|
||||
from gi.repository import Gtk,GLib,GdkPixbuf
|
||||
from gi.repository import AppIndicator3 as appindicator
|
||||
@@ -29,7 +29,15 @@ APPINDICATOR_ID = 'Kinto'
|
||||
class Indicator():
|
||||
|
||||
global child_pid
|
||||
kinto_status = Popen("while :; do clear; systemctl is-active xkeysnail; sleep 2s; done", stdout=PIPE, shell=True)
|
||||
global sysv
|
||||
try:
|
||||
sysv = check_output("pidof systemd >/dev/null 2>&1 && echo '0' || echo '1'").strip().decode('UTF-8')
|
||||
except:
|
||||
sysv = 1
|
||||
if sysv:
|
||||
kinto_status = Popen("while :; do clear; pgrep 'xkeysnail' && echo 'active'; sleep 2; done", stdout=PIPE, shell=True)
|
||||
else:
|
||||
kinto_status = Popen("while :; do clear; systemctl is-active xkeysnail; sleep 2; done", stdout=PIPE, shell=True)
|
||||
child_pid = kinto_status.pid
|
||||
|
||||
homedir = os.path.expanduser("~")
|
||||
@@ -79,7 +87,15 @@ class Indicator():
|
||||
last_status = ""
|
||||
|
||||
def __init__(self):
|
||||
res = Popen(['sudo', 'systemctl','is-active','--quiet','xkeysnail'])
|
||||
global sysv
|
||||
try:
|
||||
sysv = check_output("pidof systemd >/dev/null 2>&1 && echo '0' || echo '1'").strip().decode('UTF-8')
|
||||
except:
|
||||
sysv = 1
|
||||
if sysv:
|
||||
res = Popen(['pgrep','xkeysnail'])
|
||||
else:
|
||||
res = Popen(['sudo', 'systemctl','is-active','--quiet','xkeysnail'])
|
||||
res.wait()
|
||||
|
||||
if res.returncode == 0:
|
||||
@@ -446,7 +462,10 @@ class Indicator():
|
||||
global restartsvc
|
||||
if restartsvc == True:
|
||||
try:
|
||||
restartcmd = ['sudo', 'systemctl','restart','xkeysnail']
|
||||
if sysv:
|
||||
restartcmd = ['sudo', '-E','/etc/init.d/kinto','restart']
|
||||
else:
|
||||
restartcmd = ['sudo', 'systemctl','restart','xkeysnail']
|
||||
Popen(restartcmd)
|
||||
restartsvc = False
|
||||
|
||||
@@ -555,8 +574,12 @@ class Indicator():
|
||||
return
|
||||
|
||||
def runRestart(self,button):
|
||||
global sysv
|
||||
try:
|
||||
stop = Popen(['sudo', 'systemctl','stop','xkeysnail'])
|
||||
if sysv:
|
||||
stop = Popen(['sudo', '-E','/etc/init.d/kinto','stop'])
|
||||
else:
|
||||
stop = Popen(['sudo', 'systemctl','stop','xkeysnail'])
|
||||
stop.wait()
|
||||
time.sleep(1)
|
||||
res = Popen(['pgrep','xkeysnail'])
|
||||
@@ -567,13 +590,19 @@ class Indicator():
|
||||
pkillxkey = Popen(['sudo', 'pkill','-f','bin/xkeysnail'])
|
||||
pkillxkey.wait()
|
||||
|
||||
Popen(['sudo', 'systemctl','start','xkeysnail'])
|
||||
if sysv:
|
||||
Popen(['sudo', '-E','/etc/init.d/kinto','start'])
|
||||
else:
|
||||
Popen(['sudo', 'systemctl','start','xkeysnail'])
|
||||
except:
|
||||
Popen(['notify-send','Kinto: Error restarting Kinto!'])
|
||||
|
||||
def runStop(self,button):
|
||||
try:
|
||||
stop = Popen(['sudo', 'systemctl','stop','xkeysnail'])
|
||||
if sysv:
|
||||
stop = Popen(['sudo', '-E','/etc/init.d/kinto','stop'])
|
||||
else:
|
||||
stop = Popen(['sudo', 'systemctl','stop','xkeysnail'])
|
||||
stop.wait()
|
||||
time.sleep(1)
|
||||
res = Popen(['pgrep','xkeysnail'])
|
||||
@@ -689,7 +718,10 @@ class Indicator():
|
||||
cmdsTerm = Popen(cmds)
|
||||
cmdsTerm.wait()
|
||||
|
||||
restart = ['sudo', 'systemctl','restart','xkeysnail']
|
||||
if sysv:
|
||||
restart = ['sudo', '-E','/etc/init.d/kinto','restart']
|
||||
else:
|
||||
restart = ['sudo', 'systemctl','restart','xkeysnail']
|
||||
Popen(restart)
|
||||
|
||||
except CalledProcessError:
|
||||
|
8
linux/xkeysnail_sysv.desktop
Executable file
8
linux/xkeysnail_sysv.desktop
Executable file
@@ -0,0 +1,8 @@
|
||||
[Desktop Entry]
|
||||
Name=Kinto_xkey
|
||||
GenericName=Kinto_xkey
|
||||
Comment=Make Linux Type Like it's a Mac
|
||||
Exec=/bin/bash -c "grep -q 'autostart = true' {homedir}/.config/kinto/kinto.py && sudo -E /etc/init.d/kinto restart"
|
||||
Terminal=false
|
||||
Type=Application
|
||||
X-GNOME-Autostart-enabled=true
|
@@ -3,11 +3,18 @@
|
||||
# set about:config?filter=ui.key.menuAccessKeyFocuses
|
||||
# to false for wordwise to work in Firefox
|
||||
|
||||
function pause(){
|
||||
read -s -n 1 -p "Press any key to continue . . ."
|
||||
echo ""
|
||||
}
|
||||
|
||||
typeset -l distro
|
||||
distro=$(awk -F= '$1=="NAME" { gsub("[\",!,_, ]","",$2);print $2 ;}' /etc/os-release)
|
||||
typeset -l dename
|
||||
dename=$(./linux/system-config/dename.sh | cut -d " " -f1)
|
||||
|
||||
sysv=$(pidof systemd >/dev/null 2>&1 && echo "1" || echo "0")
|
||||
|
||||
function uninstall {
|
||||
|
||||
echo -e "\nNote: Restoring keys is only relevant if you had installed a version prior to 1.2 of Kinto. You should skip this step if 1.2+ is all you have installed."
|
||||
@@ -352,12 +359,12 @@ if ! [ -x "$(command -v pip3)" ]; then
|
||||
sudo ./linux/system-config/unipkg.sh python3-pip
|
||||
fi
|
||||
if ! [ -x "$(command -v python3-config)" ]; then
|
||||
if [ "$distro" == "ubuntu" ] || [ "$distro" == "debian" ] || [ "$distro" == 'linuxmint' ]; then
|
||||
if [ "$distro" == "ubuntu" ] || [ "${distro::6}" == "debian" ] || [ "$distro" == 'linuxmint' ]; then
|
||||
pydev="python3-dev"
|
||||
elif [ "$distro" == "fedora" ]; then
|
||||
pydev="python3-devel"
|
||||
fi
|
||||
if [ "$distro" == "gnome" ] || [ "$distro" == "fedora" ] || [ "$distro" == "debian" ] || [ "$distro" == 'linuxmint' ]; then
|
||||
if [ "$distro" == "gnome" ] || [ "$distro" == "fedora" ] || [ "${distro::6}" == "debian" ] || [ "$distro" == 'linuxmint' ]; then
|
||||
echo "Will need to install $pydev..."
|
||||
sudo ./linux/system-config/unipkg.sh "$pydev"
|
||||
fi
|
||||
@@ -370,8 +377,10 @@ if ! [ -x "$(command -v xhost)" ] || ! [ -x "$(command -v gcc)" ]; then
|
||||
sudo ./linux/system-config/unipkg.sh "xorg-xhost gcc"
|
||||
fi
|
||||
fi
|
||||
if [ "$distro" == 'linuxmint' ]; then
|
||||
if [ "$distro" == 'linuxmint' ] ; then
|
||||
pip3 install setuptools
|
||||
elif [ "${distro::6}" == "debian" ]; then
|
||||
sudo pip3 install setuptools wheel
|
||||
fi
|
||||
|
||||
pip3 install pillow
|
||||
@@ -386,7 +395,11 @@ mkdir -p ~/.config/kinto
|
||||
|
||||
# KDE startup - xhost fix
|
||||
mkdir -p ~/.config/autostart
|
||||
yes | cp -rf ./linux/xkeysnail.desktop ~/.config/kinto/xkeysnail.desktop
|
||||
if [ ! "$sysv" -eq 0 ];then
|
||||
yes | cp -rf ./linux/xkeysnail.desktop ~/.config/kinto/xkeysnail.desktop
|
||||
else
|
||||
yes | cp -rf ./linux/xkeysnail_sysv.desktop ~/.config/kinto/xkeysnail.desktop
|
||||
fi
|
||||
|
||||
# yes | cp -rf ./linux/xkeystart.sh ~/.config/kinto/xkeystart.sh
|
||||
|
||||
@@ -411,7 +424,6 @@ else
|
||||
fi
|
||||
|
||||
yes | cp -rf ./linux/kinto.py ./linux/kinto.py.new
|
||||
yes | cp -rf ./linux/limitedadmins ./linux/limitedadmins.new
|
||||
yes | cp -rf ./linux/gui/ ~/.config/kinto/
|
||||
yes | cp -nrf ./linux/initkb ~/.config/kinto/initkb
|
||||
yes | cp -rf ./linux/killdups.sh ~/.config/kinto/killdups.sh
|
||||
@@ -424,29 +436,36 @@ yes | cp -rf ./linux/trayapps/appindicator/icons/kinto-invert-16.svg ~/.config/k
|
||||
yes | cp -rf ./linux/trayapps/appindicator/icons/kinto-solid-16.svg ~/.config/kinto/kinto-solid.svg
|
||||
yes | cp -rf ./linux/trayapps/appindicator/icons/kinto.svg ~/.config/kinto/kinto.svg
|
||||
# yes | cp -rf ./linux/system-config/caret_status_xkey.sh ~/.config/kinto/caret_status_xkey.sh
|
||||
yes | cp -rf ./linux/xkeysnail.service ./linux/xkeysnail.service.new
|
||||
# yes | cp -rf ./linux/xkeysnail.timer ~/.config/systemd/user/xkeysnail.timer
|
||||
sed -i "s#{experimental-caret}#$exp#g" ./linux/xkeysnail.service.new
|
||||
if [ "$expsh" != " " ];then
|
||||
sed -i "s#{kill-caret}#/usr/bin/pkill -f $expsh#g" ./linux/xkeysnail.service.new
|
||||
|
||||
yes | cp -rf ./linux/limitedadmins ./linux/limitedadmins.new
|
||||
sed -i "s/{username}/`whoami`/g" ./linux/limitedadmins.new
|
||||
sed -i "s#{systemctl}#`\\which systemctl`#g" ./linux/limitedadmins.new
|
||||
sed -i "s#{pkill}#`\\which pkill`#g" ./linux/limitedadmins.new
|
||||
if [ ! "$sysv" -eq 0 ];then
|
||||
echo "Using systemd..."
|
||||
yes | cp -rf ./linux/xkeysnail.service ./linux/xkeysnail.service.new
|
||||
# yes | cp -rf ./linux/xkeysnail.timer ~/.config/systemd/user/xkeysnail.timer
|
||||
sed -i "s#{experimental-caret}#$exp#g" ./linux/xkeysnail.service.new
|
||||
if [ "$expsh" != " " ];then
|
||||
sed -i "s#{kill-caret}#/usr/bin/pkill -f $expsh#g" ./linux/xkeysnail.service.new
|
||||
else
|
||||
sed -i "s#{kill-caret}#$expsh#g" ./linux/xkeysnail.service.new
|
||||
fi
|
||||
sed -i "s/{username}/`whoami`/g" ./linux/xkeysnail.service.new
|
||||
sed -i "s#{homedir}#`echo "$HOME"`#g" ./linux/xkeysnail.service.new
|
||||
sed -i "s#{xhost}#`\\which xhost`#g" ./linux/xkeysnail.service.new
|
||||
sed -i "s/{displayid}/`echo "$DISPLAY"`/g" ./linux/xkeysnail.service.new
|
||||
else
|
||||
sed -i "s#{kill-caret}#$expsh#g" ./linux/xkeysnail.service.new
|
||||
echo "Using sysvinit..."
|
||||
fi
|
||||
sed -i "s/{username}/`whoami`/g" ./linux/xkeysnail.service.new
|
||||
sed -i "s#{homedir}#`echo "$HOME"`#g" ./linux/xkeysnail.service.new
|
||||
sed -i "s#{homedir}#`echo "$HOME"`#g" ~/.config/kinto/kintotray.desktop
|
||||
sed -i "s#{homedir}#`echo "$HOME"`#g" ~/.config/kinto/gui/kinto-gui.py
|
||||
sed -i "s#{homedir}#`echo "$HOME"`#g" ./linux/gui/kinto.desktop.new
|
||||
sudo mv ./linux/gui/kinto.desktop.new /usr/share/applications/kinto.desktop
|
||||
sed -i "s#{xhost}#`\\which xhost`#g" ./linux/xkeysnail.service.new
|
||||
sed -i "s/{username}/`whoami`/g" ./linux/limitedadmins.new
|
||||
sed -i "s#{systemctl}#`\\which systemctl`#g" ./linux/limitedadmins.new
|
||||
sed -i "s#{pkill}#`\\which pkill`#g" ./linux/limitedadmins.new
|
||||
sed -i "s#{systemctl}#`\\which systemctl`#g" ~/.config/kinto/xkeysnail.desktop
|
||||
sed -i "s#{xhost}#`\\which xhost`#g" ~/.config/kinto/xkeysnail.desktop
|
||||
sed -i "s#{homedir}#`echo "$HOME"`#g" ~/.config/kinto/xkeysnail.desktop
|
||||
# sed -i "s#{homedir}#`echo "$HOME"`#g" ~/.config/kinto/prexk.sh
|
||||
sed -i "s/{displayid}/`echo "$DISPLAY"`/g" ./linux/xkeysnail.service.new
|
||||
# sed -i "s/{displayid}/`echo "$DISPLAY"`/g" ~/.config/kinto/prexk.sh
|
||||
|
||||
if [[ $dename == "budgie" ]]; then
|
||||
@@ -493,7 +512,13 @@ fi
|
||||
if ! [[ $1 == "5" || $1 == "uninstall" || $1 == "Uninstall" ]]; then
|
||||
mv ./linux/kinto.py.new ~/.config/kinto/kinto.py
|
||||
# if [ "$distro" == "fedora" ];then
|
||||
sudo rm /etc/systemd/system/xkeysnail.service >/dev/null 2>&1
|
||||
if [ ! "$sysv" -eq 0 ];then
|
||||
# echo "Using systemd..."
|
||||
sudo rm /etc/systemd/system/xkeysnail.service >/dev/null 2>&1
|
||||
else
|
||||
# echo "Using sysvinit..."
|
||||
echo ""
|
||||
fi
|
||||
if [ -d /usr/lib/systemd/system ];then
|
||||
xkeypath="/usr/lib/systemd/system/"
|
||||
elif [ -d /lib/systemd/system ];then
|
||||
@@ -521,19 +546,27 @@ if ! [[ $1 == "5" || $1 == "uninstall" || $1 == "Uninstall" ]]; then
|
||||
echo -e "Run 'sudo pip3 install --upgrade .' to debug issue"
|
||||
exit 0
|
||||
fi
|
||||
sed -i "s#{xkeysnail}#`which xkeysnail`#g" ./linux/xkeysnail.service.new
|
||||
sed -i "s#{xkeysnail}#`which xkeysnail`#g" ./linux/limitedadmins.new
|
||||
sudo mv ./linux/xkeysnail.service.new "$xkeypath"xkeysnail.service && echo "Service file added to "$xkeypath"xkeysnail.service"
|
||||
sudo chown root:root ./linux/limitedadmins.new
|
||||
# Add a check here for xkeysnail path resolving
|
||||
sudo mv ./linux/limitedadmins.new /etc/sudoers.d/limitedadmins
|
||||
sudo chown -R root:root "$xkeypath"xkeysnail.service && echo "Ownership set for root..." || echo "Failed to set ownership..."
|
||||
sudo chmod 644 "$xkeypath"xkeysnail.service && echo "Permissions set to 644..." || echo "Failed to set permissions..."
|
||||
sudo ln -s "$xkeypath"xkeysnail.service /etc/systemd/system/xkeysnail.service && echo "Created soft symlink..." || echo "Failed to create soft symlink..."
|
||||
sudo ln -s "$xkeypath"xkeysnail.service /etc/systemd/system/graphical.target.wants/xkeysnail.service && echo "Created soft symlink for graphical target..." || echo "Failed to create soft symlink for graphical target..."
|
||||
sudo systemctl daemon-reload
|
||||
sudo systemctl disable xkeysnail
|
||||
sudo systemctl stop xkeysnail
|
||||
if [ ! "$sysv" -eq 0 ];then
|
||||
# echo "Using systemd..."
|
||||
sed -i "s#{xkeysnail}#`which xkeysnail`#g" ./linux/xkeysnail.service.new
|
||||
sudo mv ./linux/xkeysnail.service.new "$xkeypath"xkeysnail.service && echo "Service file added to "$xkeypath"xkeysnail.service"
|
||||
|
||||
sudo chown -R root:root "$xkeypath"xkeysnail.service && echo "Ownership set for root..." || echo "Failed to set ownership..."
|
||||
sudo chmod 644 "$xkeypath"xkeysnail.service && echo "Permissions set to 644..." || echo "Failed to set permissions..."
|
||||
sudo ln -s "$xkeypath"xkeysnail.service /etc/systemd/system/xkeysnail.service && echo "Created soft symlink..." || echo "Failed to create soft symlink..."
|
||||
sudo ln -s "$xkeypath"xkeysnail.service /etc/systemd/system/graphical.target.wants/xkeysnail.service && echo "Created soft symlink for graphical target..." || echo "Failed to create soft symlink for graphical target..."
|
||||
sudo systemctl daemon-reload
|
||||
sudo systemctl disable xkeysnail
|
||||
sudo systemctl stop xkeysnail
|
||||
else
|
||||
# echo "Using sysvinit..."
|
||||
echo ""
|
||||
sudo -E /etc/init.d/kinto stop &
|
||||
fi
|
||||
# sudo systemctl --state=not-found --all | grep xkeysnail
|
||||
# if [ "$distro" == "fedora" ];then
|
||||
# systemctl enable xkeysnail.service
|
||||
@@ -541,7 +574,8 @@ if ! [[ $1 == "5" || $1 == "uninstall" || $1 == "Uninstall" ]]; then
|
||||
# sudo systemctl enable xkeysnail.service
|
||||
# fi
|
||||
# sudo systemctl restart xkeysnail
|
||||
sudo pkill -f kintotray >/dev/null 2>&1
|
||||
sudo pkill -f kintotray &
|
||||
# >/dev/null 2>&1
|
||||
if [[ $dename == "gnome" || $dename == "kde" ]];then
|
||||
sed -i "s/systray = true/systray = false/g" ~/.config/kinto/initkb
|
||||
fi
|
||||
|
Reference in New Issue
Block a user