summaryrefslogtreecommitdiffstats
path: root/ubuntu/precise
diff options
context:
space:
mode:
Diffstat (limited to 'ubuntu/precise')
-rw-r--r--ubuntu/precise/applications/tdepowersave/debian/acpi-support/policy-funcs67
-rw-r--r--ubuntu/precise/applications/tdepowersave/debian/control2
-rw-r--r--ubuntu/precise/applications/tdepowersave/debian/install1
-rw-r--r--ubuntu/precise/applications/tdepowersave/debian/postrm2
-rw-r--r--ubuntu/precise/applications/tdepowersave/debian/preinst22
5 files changed, 86 insertions, 8 deletions
diff --git a/ubuntu/precise/applications/tdepowersave/debian/acpi-support/policy-funcs b/ubuntu/precise/applications/tdepowersave/debian/acpi-support/policy-funcs
new file mode 100644
index 000000000..8b9f13762
--- /dev/null
+++ b/ubuntu/precise/applications/tdepowersave/debian/acpi-support/policy-funcs
@@ -0,0 +1,67 @@
+. /usr/share/acpi-support/power-funcs
+
+CheckUPowerPolicy() {
+ pidof upowerd > /dev/null
+}
+
+# The (not very aptly named) function CheckPolicy checks if the current X
+# console user is running a power management daemon that handles suspend/resume
+# requests. This is used in various places to determine if we need to handle
+# something ourselves or if we need to pass the info on to a power management
+# daemon (e.g. through a fake key press).
+
+CheckPolicy() {
+ local PMS
+
+ getXconsole
+ PMS="/usr/bin/gnome-power-manager /usr/bin/kpowersave /usr/bin/xfce4-power-manager"
+ PMS="$PMS /usr/bin/guidance-power-manager /usr/lib/dalston/dalston-power-applet"
+ PMS="$PMS /opt/trinity/bin/tdepowersave"
+ pidof -x $PMS > /dev/null ||
+ { test "$XUSER" != "" &&
+ pidof dcopserver > /dev/null &&
+ test -x /opt/trinity/bin/dcop &&
+ /opt/trinity/bin/dcop --user $XUSER kded kded loadedModules | grep -q klaptopdaemon; } ||
+ PowerDevilRunning ||
+ GnomeSettingsDaemonPowerRunning
+}
+
+# Find a DBUS session bus, by looking at the given process' environment and
+# then send a message to that bus. If multiple processes match the given name,
+# the message is sent to all of the buses (and output is simply concatenated.
+DBusSend() {
+ # The process to get the DBUS session address from
+ local PROC_NAME="$1"
+
+ # Parameters for dbus-send
+ local DEST="$2"
+ local DBUS_PATH="$3"
+ local METHOD="$4"
+
+ test -x /usr/bin/dbus-send || return 1
+
+ local DBUS_SESS
+ for p in $(pidof "$PROC_NAME"); do
+ test -r /proc/$p/environ || continue
+ DBUS_SESS=$(grep -a -z "DBUS_SESSION_BUS_ADDRESS=" /proc/$p/environ || :)
+ test "$DBUS_SESS" != "" || continue
+ su $(ps -o user= $p) -s /bin/sh -c "$DBUS_SESS dbus-send --print-reply --dest='$DEST' '$DBUS_PATH' '$METHOD'"
+ done
+}
+
+# Ask kde if the powerdevil module is loaded
+PowerDevilRunning() {
+ DBusSend kded4 org.kde.kded /kded org.kde.kded.loadedModules | grep -q powerdevil
+}
+
+# gnome-power-manager was integrated into gnome-settings-daemon from version
+# 3.1.4, in a new Power plugin (though the handling of buttons is done in the
+# MediaKeys plugin.
+#
+# gnome-settings-daemon does not export a list of loaded plugins, but
+# fortunately the Power plugin does have its own Dbus interface we can check
+# for (We can't check the MediaKeys plugin, since that has been around for
+# longer).
+GnomeSettingsDaemonPowerRunning() {
+ DBusSend gnome-settings-daemon org.gnome.SettingsDaemon /org/gnome/SettingsDaemon/Power org.freedesktop.DBus.Introspectable.Introspect | grep -q 'interface name="org.gnome.SettingsDaemon.Power"'
+}
diff --git a/ubuntu/precise/applications/tdepowersave/debian/control b/ubuntu/precise/applications/tdepowersave/debian/control
index 7882039dd..82dec22b8 100644
--- a/ubuntu/precise/applications/tdepowersave/debian/control
+++ b/ubuntu/precise/applications/tdepowersave/debian/control
@@ -3,7 +3,7 @@ Section: tde
Priority: optional
Maintainer: Timothy Pearson <kb9vqf@pearsoncomputing.net>
XSBC-Original-Maintainer: Michael Biebl <biebl@debian.org>
-Build-Depends: cdbs, debhelper (>= 5.0.0), quilt, tdelibs14-trinity-dev, libxss-dev, libxtst-dev, libdbus-1-dev (>= 0.6), libdbus-tqt-1-dev, cmake, automake, autoconf, libtool, libltdl-dev
+Build-Depends: cdbs, debhelper (>= 5.0.0), quilt, tdelibs14-trinity-dev, libxss-dev, libxtst-dev, libdbus-1-dev (>= 0.6), libdbus-1-tqt-dev, cmake, automake, autoconf, libtool, libltdl-dev
Build-Conflicts: autoconf2.13
Standards-Version: 3.8.4
Homepage: http://sourceforge.net/projects/powersave/
diff --git a/ubuntu/precise/applications/tdepowersave/debian/install b/ubuntu/precise/applications/tdepowersave/debian/install
index 8d2341734..a07d0d86c 100644
--- a/ubuntu/precise/applications/tdepowersave/debian/install
+++ b/ubuntu/precise/applications/tdepowersave/debian/install
@@ -1 +1,2 @@
debian/tdepowersave.xpm opt/trinity/share/pixmaps
+debian/acpi-support/policy-funcs usr/share/acpi-support
diff --git a/ubuntu/precise/applications/tdepowersave/debian/postrm b/ubuntu/precise/applications/tdepowersave/debian/postrm
index c373aa20d..f5560224c 100644
--- a/ubuntu/precise/applications/tdepowersave/debian/postrm
+++ b/ubuntu/precise/applications/tdepowersave/debian/postrm
@@ -11,7 +11,7 @@ fi
case "$1" in
remove)
- dpkg-divert --package $package_name --rename --remove /etc/acpi/powerbtn.sh
+ dpkg-divert --package $package_name --rename --remove /usr/share/acpi-support/policy-funcs
;;
purge)
;;
diff --git a/ubuntu/precise/applications/tdepowersave/debian/preinst b/ubuntu/precise/applications/tdepowersave/debian/preinst
index fe411fc94..4a6bebe68 100644
--- a/ubuntu/precise/applications/tdepowersave/debian/preinst
+++ b/ubuntu/precise/applications/tdepowersave/debian/preinst
@@ -11,21 +11,31 @@ fi
case "$1" in
install)
+ # remove obsolete divert for acpid
divert=`dpkg-divert --listpackage "/etc/acpi/powerbtn.sh"`
if [ -n "$divert" ] && [ "$divert" = "LOCAL" ]; then
dpkg-divert --remove --local --rename "/etc/acpi/powerbtn.sh"
- divert=""
fi
- dpkg-divert --package $package_name --divert /etc/acpi/powerbtn.sh.distrib --rename /etc/acpi/powerbtn.sh
+
+ # create new divert for acpi-support-base
+ dpkg-divert --package $package_name --rename /usr/share/acpi-support/policy-funcs
;;
upgrade)
+ # remove obsolete divert acpid
divert=`dpkg-divert --listpackage "/etc/acpi/powerbtn.sh"`
- if [ -n "$divert" ] && [ "$divert" = "LOCAL" ]; then
- dpkg-divert --remove --local --rename "/etc/acpi/powerbtn.sh"
- divert=""
+ if [ -n "$divert" ]; then
+ if [ "$divert" = "LOCAL" ]; then
+ dpkg-divert --remove --local --rename "/etc/acpi/powerbtn.sh"
+ fi
+ if [ "$divert" = $package_name ]; then
+ dpkg-divert --remove --package $package_name --rename "/etc/acpi/powerbtn.sh"
+ fi
fi
+
+ # create new divert for acpi-support-base
+ divert=`dpkg-divert --listpackage "/usr/share/acpi-support/policy-funcs"`
if [ -z "$divert" ]; then
- dpkg-divert --package $package_name --divert /etc/acpi/powerbtn.sh.distrib --rename /etc/acpi/powerbtn.sh
+ dpkg-divert --package $package_name --rename /usr/share/acpi-support/policy-funcs
fi
;;
abort-upgrade)