aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorB Stack <bgstack15@gmail.com>2020-03-11 12:35:10 -0400
committerB Stack <bgstack15@gmail.com>2020-03-11 12:35:10 -0400
commitbe87206a369b09e595e498504eef1540e2c91c41 (patch)
treee753e64e7ca90b1dc0eab2b6afa4cd92ccab50c3 /src
parentadd initial debuild stuff (diff)
downloadlogout-manager-be87206a369b09e595e498504eef1540e2c91c41.tar.gz
logout-manager-be87206a369b09e595e498504eef1540e2c91c41.tar.bz2
logout-manager-be87206a369b09e595e498504eef1540e2c91c41.zip
use alternatives, and actually run commands
Diffstat (limited to 'src')
-rw-r--r--src/Makefile5
-rw-r--r--src/usr/share/logout-manager/lmlib.py21
2 files changed, 19 insertions, 7 deletions
diff --git a/src/Makefile b/src/Makefile
index 1ef600d..236f079 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -65,7 +65,9 @@ deplist_opts:
install:
@${echobin} Installing files to ${DESTDIR}
- ${installbin} -d ${SYSCONFDIR} ${DEFAULTDIR} ${BINDIR} ${APPSDIR} ${APPDIR} ${DOCDIR} ${BASHCDIR} ${SUDOERSDIR}
+ ${installbin} -d ${SYSCONFDIR} ${DEFAULTDIR} ${BINDIR} \
+ ${APPSDIR} ${APPDIR} ${DOCDIR} ${BASHCDIR} ${SUDOERSDIR} \
+ ${LIBEXECDIR}/${APPNAME}
${cpbin} -pr ${SRCDIR}/etc/*.* ${SYSCONFDIR}
${cpbin} -pr ${SRCDIR}/etc/sysconfig/* ${DEFAULTDIR}
${cpbin} -pr ${SRCDIR}/usr/bin/* ${BINDIR}
@@ -74,6 +76,7 @@ install:
${cpbin} -pr ${SRCDIR}/usr/share/doc/${APPNAME}/* ${DOCDIR}
${installbin} -m 0644 -t ${BASHCDIR} ${SRCDIR}/usr/share/bash-completion/completions/*
${installbin} -m 0640 -t ${SUDOERSDIR} ${SRCDIR}/etc/sudoers.d/*
+ ${installbin} -m 0755 -t ${LIBEXECDIR}/${APPNAME} ${SRCDIR}/usr/libexec/${APPNAME}/*
# symlink, when alternatives is not being used
${lnbin} -s logout-manager-gtk.py ${BINDIR}/logout-manager
diff --git a/src/usr/share/logout-manager/lmlib.py b/src/usr/share/logout-manager/lmlib.py
index 7c9dc1e..40ee3a0 100644
--- a/src/usr/share/logout-manager/lmlib.py
+++ b/src/usr/share/logout-manager/lmlib.py
@@ -13,36 +13,45 @@
# Improve:
# Documentation:
-import configparser, platform, os
+import configparser, platform, os, subprocess
logout_manager_version="2020-03-10a"
class Actions:
+ def __take_action(command):
+ print(command)
+ command=str(command).split()
+ command2=[]
+ for i in command:
+ command2.append(str(i.strip('"')))
+ command=command2
+ subprocess.run(command)
+
@staticmethod
def hibernate(config, event=None):
#print("need to run the /sys/power/state trick, if available")
- print(config.get_hibernate_command())
+ Actions.__take_action(config.get_hibernate_command())
@staticmethod
def lock(config, event=None):
#print("please lock the screen.")
- print(config.get_lock_command())
+ Actions.__take_action(config.get_lock_command())
@staticmethod
def logout(config, event=None):
#print("please log out of current session!")
- print(config.get_logout_command())
+ Actions.__take_action(config.get_logout_command())
@staticmethod
def reboot(config, event=None):
#print("please reboot.")
- print(config.get_reboot_command())
+ Actions.__take_action(config.get_reboot_command())
@staticmethod
def shutdown(config, event=None):
#print("please shut yourself down!")
- print(config.get_shutdown_command())
+ Actions.__take_action(config.get_shutdown_command())
class Config:
def __init__(self):
bgstack15