From 2a3de09e19fda931b0209fe3f746390f898c5942 Mon Sep 17 00:00:00 2001 From: Eric Hameleers Date: Wed, 20 Apr 2016 11:16:32 +0200 Subject: Powerdevil needs a new polkit rules file to bring back suspend/hibernate. --- kde/doinst.sh/powerdevil | 1 + kde/post-install/powerdevil.post-install | 4 ++++ kde/post-install/powerdevil/10-enable-suspend.rules | 10 ++++++++++ 3 files changed, 15 insertions(+) create mode 100644 kde/post-install/powerdevil/10-enable-suspend.rules diff --git a/kde/doinst.sh/powerdevil b/kde/doinst.sh/powerdevil index ccf6b67..6e92caa 100644 --- a/kde/doinst.sh/powerdevil +++ b/kde/doinst.sh/powerdevil @@ -12,6 +12,7 @@ config() { } # Move over the new policy files: +config etc/polkit-1/rules.d/10-enable-suspend.rules.new config etc/polkit-1/localauthority/50-local.d/30-org.freedesktop.upower.pkla.new config etc/polkit-1/localauthority/50-local.d/40-org.freedesktop.consolekit.system.stop-multiple-users.pkla.new config etc/polkit-1/localauthority/50-local.d/41-org.freedesktop.consolekit.system.restart-multiple-users.pkla.new diff --git a/kde/post-install/powerdevil.post-install b/kde/post-install/powerdevil.post-install index 20e2e59..8bc673b 100644 --- a/kde/post-install/powerdevil.post-install +++ b/kde/post-install/powerdevil.post-install @@ -2,10 +2,14 @@ mkdir -p $PKG/etc mv $PKG/etc/kde/dbus-1 $PKG/etc/ +mkdir -p $PKG/etc/polkit-1/rules.d mkdir -p $PKG/etc/polkit-1/localauthority/50-local.d chmod 700 $PKG/etc/polkit-1/localauthority # Add polkit policy file that brings back suspend/hibernate options: +install -m 0660 -o root \ + $CWD/post-install/powerdevil/10-enable-suspend.rules \ + $PKG/etc/polkit-1/rules.d/10-enable-suspend.rules.new install -m 0660 -o root \ $CWD/post-install/powerdevil/30-org.freedesktop.upower.pkla \ $PKG/etc/polkit-1/localauthority/50-local.d/30-org.freedesktop.upower.pkla.new diff --git a/kde/post-install/powerdevil/10-enable-suspend.rules b/kde/post-install/powerdevil/10-enable-suspend.rules new file mode 100644 index 0000000..5ef58ac --- /dev/null +++ b/kde/post-install/powerdevil/10-enable-suspend.rules @@ -0,0 +1,10 @@ +polkit.addRule( + function(action, subject) { + if ((action.id == "org.freedesktop.upower.suspend" || + action.id == "org.freedesktop.upower.hibernate") && + subject.isInGroup("power")) + { + return polkit.Result.YES; + } + } +); -- cgit v1.2.3