summaryrefslogtreecommitdiffstats
path: root/source/a/upower
diff options
context:
space:
mode:
Diffstat (limited to 'source/a/upower')
-rw-r--r--source/a/upower/10-enable-upower-suspend.rules9
-rw-r--r--source/a/upower/doinst.sh2
-rwxr-xr-xsource/a/upower/upower.SlackBuild9
3 files changed, 18 insertions, 2 deletions
diff --git a/source/a/upower/10-enable-upower-suspend.rules b/source/a/upower/10-enable-upower-suspend.rules
new file mode 100644
index 000000000..4bccfb014
--- /dev/null
+++ b/source/a/upower/10-enable-upower-suspend.rules
@@ -0,0 +1,9 @@
+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;
+ }
+ }
+);
diff --git a/source/a/upower/doinst.sh b/source/a/upower/doinst.sh
index 46abf401c..40e2087ca 100644
--- a/source/a/upower/doinst.sh
+++ b/source/a/upower/doinst.sh
@@ -12,4 +12,4 @@ config() {
}
config etc/UPower/UPower.conf.new
-
+config usr/share/polkit-1/rules.d/10-enable-upower-suspend.rules.new
diff --git a/source/a/upower/upower.SlackBuild b/source/a/upower/upower.SlackBuild
index 04ded50a7..7afa472b0 100755
--- a/source/a/upower/upower.SlackBuild
+++ b/source/a/upower/upower.SlackBuild
@@ -28,7 +28,7 @@ cd $(dirname $0) ; CWD=$(pwd)
PKGNAM=upower
VERSION=${VERSION:-$(echo $PKGNAM-*.tar.?z* | rev | cut -f 3- -d . | cut -f 1 -d- | rev)}
-BUILD=${BUILD:-1}
+BUILD=${BUILD:-2}
NUMJOBS=${NUMJOBS:-" -j$(expr $(nproc) + 1) "}
@@ -114,6 +114,13 @@ CXXFLAGS="$SLKCFLAGS" \
make $NUMJOBS || make || exit 1
make install DESTDIR=$PKG || exit 1
+# Add upower policy allowing users in the 'power' group
+# to suspend/hibernate the computer:
+mkdir -p $PKG/usr/share/polkit-1/rules.d
+install -m 0644 -o root \
+ $CWD/10-enable-upower-suspend.rules \
+ $PKG/usr/share/polkit-1/rules.d/10-enable-upower-suspend.rules.new
+
# Don't ship .la files:
rm -f $PKG/{,usr/}lib${LIBDIRSUFFIX}/*.la