aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--debian/logout-manager.postinst9
-rw-r--r--debian/logout-manager.prerm11
-rw-r--r--src/Makefile5
-rw-r--r--src/usr/share/logout-manager/lmlib.py21
4 files changed, 39 insertions, 7 deletions
diff --git a/debian/logout-manager.postinst b/debian/logout-manager.postinst
new file mode 100644
index 0000000..b98d697
--- /dev/null
+++ b/debian/logout-manager.postinst
@@ -0,0 +1,9 @@
+#!/bin/sh -e
+#DEBHELPER#
+case "$1" in
+ configure|abort-upgrade|abort-remove|abort-deconfigure)
+ update-alternatives --install /usr/bin/logout-manager logout-manager /usr/bin/logout-manager-gtk.py 80
+ update-alternatives --install /usr/bin/logout-manager logout-manager /usr/bin/logout-manager-tcl.py 70
+ update-alternatives --install /usr/bin/logout-manager logout-manager /usr/bin/logout-manager-ncurses.py 60
+ ;;
+esac
diff --git a/debian/logout-manager.prerm b/debian/logout-manager.prerm
new file mode 100644
index 0000000..c0c50d3
--- /dev/null
+++ b/debian/logout-manager.prerm
@@ -0,0 +1,11 @@
+#!/bin/sh -e
+#DEBHELPER#
+case "$1" in
+ remove|deconfigure)
+ update-alternatives --remove logout-manager /usr/bin/logout-manager-gtk.py
+ update-alternatives --remove logout-manager /usr/bin/logout-manager-tcl.py
+ update-alternatives --remove logout-manager /usr/bin/logout-manager-ncurses.py
+ ;;
+ upgrade|failed-upgrade)
+ ;;
+esac
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