Git-Url: http://git.frugalware.org/gitweb/gitweb.cgi?p=frugalware-current.git;a=commitdiff;h=a3e83acf18cb1b0174fbe0b5df10e2e6310bd4fa
commit a3e83acf18cb1b0174fbe0b5df10e2e6310bd4fa Author: DeX77 <[email protected]> Date: Tue Feb 23 12:28:10 2016 +0100 laptop-mode-tools-1.68.1-2-x86_64 * rebuild: fix for systemd>=229 diff --git a/source/apps-extra/laptop-mode-tools/1.68.1...lmt-upstream.diff b/source/apps-extra/laptop-mode-tools/1.68.1...lmt-upstream.diff new file mode 100644 index 0000000..2abecc6 --- /dev/null +++ b/source/apps-extra/laptop-mode-tools/1.68.1...lmt-upstream.diff @@ -0,0 +1,447 @@ +diff --git a/README.md b/README.md +index 9acb49b..decbd59 100644 +--- a/README.md ++++ b/README.md +@@ -28,7 +28,7 @@ Notes + + * To configure the laptop mode scripts, edit `/etc/laptop-mode/laptop-mode.conf`. + +-* The laptop mode FAQ can be found at <http://samwel.tk/laptop_mode/faq> ++* The laptop mode FAQ can be found at <https://github.com/rickysarraf/laptop-mode-tools/wiki/FAQ> + + * The revision history is included in the `Documentation` directory. + +@@ -43,4 +43,4 @@ Notes + References + ---------- + +-The laptop mode tools website: <http://samwel.tk/laptop_mode/> ++The laptop mode tools website: <http://rickysarraf.github.io/laptop-mode-tools/> +diff --git a/etc/laptop-mode/conf.d/cpuhotplug.conf b/etc/laptop-mode/conf.d/cpuhotplug.conf +new file mode 100644 +index 0000000..2dbd178 +--- /dev/null ++++ b/etc/laptop-mode/conf.d/cpuhotplug.conf +@@ -0,0 +1,36 @@ ++# ++# Configuration file for Laptop Mode Tools module cpuhotplug. ++# ++# For more information, consult the laptop-mode.conf(8) manual page. ++# ++ ++############################################################################### ++# CPU Hot Plugging ++# ---------------- ++# ++#__COMMENT Laptop mode tools can automatically switch off multiple CPU cores ++#__COMMENT when switching to battery. ++#__COMMENT This can be very useful if your use does not involve CPU intensive ++#__COMMENT tasks, while on battery ++#__COMMENT ++#__COMMENT IMPORTANT: This feature is NOT enabled by default ++#__COMMENT ++#__COMMENT Enalbe it only if you understand what you are doing ++# ++############################################################################### ++ ++# Enable debug mode for this module ++# Set to 1 if you want to debug this module ++DEBUG=0 ++ ++# ++# Should laptop mode tools control the CPU Hot Plugging functionality? ++# ++# Set to 0 to disable ++CONTROL_CPU_HOTPLUG=0 ++ ++ ++# Conditions under which to enable CPU Hot Plugging, i.e. shutdown of the CPU ++BATT_CPU_HOTPLUG=1 ++LM_AC_CPU_HOTPLUG=0 ++NOLM_AC_CPU_HOTPLUG=0 +diff --git a/etc/laptop-mode/conf.d/runtime-pm.conf b/etc/laptop-mode/conf.d/runtime-pm.conf +index b9f97f0..66d8f8d 100644 +--- a/etc/laptop-mode/conf.d/runtime-pm.conf ++++ b/etc/laptop-mode/conf.d/runtime-pm.conf +@@ -42,7 +42,7 @@ AUTOSUSPEND_RUNTIME_DEVID_BLACKLIST="" + # The list of device driver types that should not use autosuspend. The driver + # type is given by "DRIVER=..." in a device's uevent file. + # Example: AUTOSUSPEND_DEVID_BLACKLIST="usbhid usb-storage" +-AUTOSUSPEND_RUNTIME_DEVTYPE_BLACKLIST="" ++AUTOSUSPEND_RUNTIME_DEVTYPE_BLACKLIST="usbmouse usb-storage usbkbd" + + # The list of Device IDs that should use autosuspend. Use system commands or + # look into sysfs to find out the IDs of your devices. +diff --git a/etc/laptop-mode/laptop-mode.conf b/etc/laptop-mode/laptop-mode.conf +index 4ac77d1..83880d8 100644 +--- a/etc/laptop-mode/laptop-mode.conf ++++ b/etc/laptop-mode/laptop-mode.conf +@@ -81,13 +81,14 @@ DEBUG=0 + + + # +-# Enable laptop mode when on battery power. ++# Enable laptop mode power saving, when on battery power. + # + ENABLE_LAPTOP_MODE_ON_BATTERY=1 + + + # +-# Enable laptop mode when on AC power. ++# Enable laptop mode power savings, even when on AC power. ++# This is useful when running as a headless machine, in low power mode + # + ENABLE_LAPTOP_MODE_ON_AC=0 + +diff --git a/etc/rules/99-laptop-mode.rules b/etc/rules/99-laptop-mode.rules +index 99483bc..3e8aba7 100644 +--- a/etc/rules/99-laptop-mode.rules ++++ b/etc/rules/99-laptop-mode.rules +@@ -1,3 +1,3 @@ + ACTION=="change", SUBSYSTEM=="power_supply", ENV{POWER_SUPPLY_NAME}=="|AC|ACAD", RUN+="lmt-udev auto" +-ACTION=="add|remove", SUBSYSTEM=="machinecheck", RUN+="lmt-udev auto force" ++ACTION=="add|remove", SUBSYSTEM=="machinecheck", RUN+="lmt-udev auto" + ACTION=="add|remove", SUBSYSTEM=="usb", RUN+="lmt-udev force modules=runtime-pm devices=%k" +diff --git a/etc/rules/lmt-udev b/etc/rules/lmt-udev +index 7844b39..50dd278 100755 +--- a/etc/rules/lmt-udev ++++ b/etc/rules/lmt-udev +@@ -25,26 +25,34 @@ non_systemd_way() { + } + + ++## For Debug only ++#export LMT_DEBUG="/tmp/__lmt__debug.txt" ++[ -z $LMT_DEBUG ] || rm -f $LMT_DEBUG ++## + + # Under systemd, we don't do synchronous operations, so we can run in the foreground; + # And we need also need to run in foreground, because forked children get kill immediately + # under systemd/udev + +-if [ -d /run/systemd/system ]; then ++# The seconds "auto" evaluation is to determine if it is a standard execution; ++# i.e. a reload/restart or a device plug/unplug ++ ++if [ -d /run/systemd/system ] && [ "$@" = "auto" ]; then ++ [ -z $LMT_DEBUG ] || echo "systemd is $PPID $$ $@" > $LMT_DEBUG + exec systemctl --no-block reload-or-restart laptop-mode + else ++ [ -z $LMT_DEBUG ] || echo "regulard is $PPID $$ $@" > $LMT_DEBUG + # Under sysvinit/upstart, we need to fork as we start the long-running + # /usr/sbin/laptop_mode process. + # + # Also, if this happens during boot, we may want to wait until /usr is available +- # This else stanza is going to be used rarely, because going forward we are +- # going to use systemd. +- # But for compatibility reasons, we'll carry this + # + # That said, we background the execution here, because, otherwise udevd will wait + # for this process which will block + +- exec > /dev/null 2>dev/null ++ # This stanza will also be called for device plug/unplug events ++ ++ exec > /dev/null 2>/dev/null + non_systemd_way "$@" & + fi + +diff --git a/etc/systemd/lmt-poll.service b/etc/systemd/lmt-poll.service +index e7f5a17..8378fad 100644 +--- a/etc/systemd/lmt-poll.service ++++ b/etc/systemd/lmt-poll.service +@@ -6,8 +6,8 @@ Documentation=http://samwel.tk/laptop_mode + [Service] + Type=oneshot + RemainAfterExit=no +-ExecStart=/lib/udev/lmt-udev +-ExecReload=/lib/udev/lmt-udev ++ExecStart=/lib/udev/lmt-udev auto ++ExecReload=/lib/udev/lmt-udev auto + StandardOutput=journal + StandardError=journal + +diff --git a/install.sh b/install.sh +index d9d870f..e6f73dd 100755 +--- a/install.sh ++++ b/install.sh +@@ -118,6 +118,7 @@ $INSTALL -d -m 755 "$DESTDIR/usr/share/laptop-mode-tools/modules" + $INSTALL -d -m 755 "$DESTDIR/usr/share/laptop-mode-tools/module-helpers" + $INSTALL -d -m 755 "$DESTDIR/etc/laptop-mode/conf.d" + $INSTALL -d -m 755 "$DESTDIR/etc/laptop-mode/modules" ++$INSTALL -d -m 755 "$DESTDIR/usr/share/polkit-1/actions" + $INSTALL -d -m 755 "$DESTDIR/usr/sbin" + $INSTALL -d -m 755 "$DESTDIR/$UDEV_D/rules.d" + $INSTALL -d -m 755 "$DESTDIR/$MAN_D/man8" +@@ -154,6 +155,11 @@ if ( ! $INSTALL -m 755 usr/sbin/laptop_mode "$DESTDIR/usr/sbin" ) ; then + exit 11 + fi + ++if ( ! $INSTALL -m 644 usr/share/polkit-1/actions/org.linux.lmt.gui.policy "$DESTDIR/usr/share/polkit-1/actions/" ) ; then ++ echo "$0: Failed to install $DESTDIR/usr/share/polkit-1/actions/org.linux.lmt.gui.policy Installation failed." ++ exit 11 ++fi ++"$DESTDIR/usr/share/polkit-1/actions" + if ( ! $INSTALL -m 755 usr/sbin/lm-syslog-setup "$DESTDIR/usr/sbin" ) ; then + echo "$0: Failed to install $DESTDIR/usr/sbin/lm-syslog-setup. installation failed." + exit 25 +diff --git a/laptop-mode-tools.spec b/laptop-mode-tools.spec +index a0ad151..c8afaa4 100644 +--- a/laptop-mode-tools.spec ++++ b/laptop-mode-tools.spec +@@ -91,7 +91,6 @@ fi + + %dir %{_sysconfdir}/acpi/events + %dir %{_sysconfdir}/acpi/actions +-%dir %{_usr}/sbin + %dir %{_usr}/lib/pm-utils/sleep.d + %dir %{_usr}/lib/tmpfiles.d + %dir %{_usr}/share/laptop-mode-tools/modules +diff --git a/man/laptop-mode.conf.8 b/man/laptop-mode.conf.8 +index 77f388b..0fdc0ff 100644 +--- a/man/laptop-mode.conf.8 ++++ b/man/laptop-mode.conf.8 +@@ -85,7 +85,9 @@ With this option alone, you can enable all auto modules. Incase you need to fine + These options determine whether laptop mode will be activated when the + computer is on battery or on AC power, respectively. Note that if the + system service laptop-mode is not started, then laptop mode will never +-be started, even if this option is enabled. ++be started, even if this option is enabled. ++ ++The ENABLE_LAPTOP_MODE_ON_AC setting is useful when you want to run on a headless machine, in low-power mode, for eg. a Jukebox. + + .IP "\fBENABLE_LAPTOP_MODE_WHEN_LID_CLOSED\fP" 10 + When this option is enabled, laptop mode will be activated when the laptop's lid is +@@ -292,8 +294,17 @@ Specify the list of ethernet devices to control. Defaults to eth0 + + .IP "\fBDISABLE_ETHERNET_ON_BATTERY\fP" 10 + Set this to 1 if you want to completely disable your ethernet device when running on +-battery. Default is 0 ++battery, and when no carrier is detected on the interface (e.g., no active cable is ++plugged in). Default is 0 ++ ++.SS "\fI/etc/laptop-mode/conf.d/cpuhotplug.conf\fP" ++ ++The cpuhotplug module allows you to switch off the CPU cores when running on battery + ++.IP "\fBCONTROL_CPU_HOTPLUG\fP" 10 ++When this option is enabled, Laptop Mode Tools can hotplug your CPU, thus switching ++it offline, and conserving some power. ++NOTE: This module is NOT enabled by default + + .SS "\fI/etc/laptop-mode/conf.d/cpufreq.conf\fP" + +diff --git a/usr/sbin/laptop_mode b/usr/sbin/laptop_mode +index caedfa0..2ea7b80 100755 +--- a/usr/sbin/laptop_mode ++++ b/usr/sbin/laptop_mode +@@ -1115,6 +1115,9 @@ lmt_main_function () + log "VERBOSE" "Module $SCRIPT is not executable or is to be skipped." + fi + done ++ ++ # Wait for the forks to complete ++ wait + + exit 0 + +@@ -1148,7 +1151,7 @@ if [ x$CONTROL_BATTERY_LEVEL_POLLING = x1 ] && [ x$BLACKLIST_IN_FLOCK = x1 ]; th + log "VERBOSE" "On battery and there was no polling daemon yet, starting the polling daemon." + + # If there is no polling daemon, we start one. +- /usr/share/laptop-mode-tools/module-helpers/lm-polling-daemon < /dev/null > /dev/null 2> /dev/null & ++ setsid /usr/share/laptop-mode-tools/module-helpers/lm-polling-daemon < /dev/null > /dev/null 2> /dev/null & + fi + else + log "VERBOSE" "Lock acquisition on descriptor 7 failed with pid $$"; +diff --git a/usr/share/laptop-mode-tools/modules/cpuhotplug b/usr/share/laptop-mode-tools/modules/cpuhotplug +new file mode 100755 +index 0000000..b211868 +--- /dev/null ++++ b/usr/share/laptop-mode-tools/modules/cpuhotplug +@@ -0,0 +1,33 @@ ++#! /bin/sh ++# ++# Laptop mode tools module to handle CPU Hot Plugging ++# ++ ++ ++if [ x$CONTROL_CPU_HOTPLUG = x1 ] || [ x$ENABLE_AUTO_MODULES = x1 -a x$CONTROL_CPU_HOTPLUG = xauto ]; then ++ if [ $ON_AC -eq 1 ] ; then ++ if [ "$ACTIVATE" -eq 1 ] ; then ++ ECHO_VAL="$LM_AC_CPU_HOTPLUG" ++ else ++ ECHO_VAL="$NOLM_AC_CPU_HOTPLUG" ++ fi ++ else ++ ECHO_VAL="$BATT_CPU_HOTPLUG" ++ fi ++ ++ # To disable the CPU, write 0. So flip it here. ++ if [ x$ECHO_VAL = x1 ]; then ++ CPU_VAL=0; ++ else ++ CPU_VAL=1; ++ fi ++ ++ for THISCPU in /sys/devices/system/cpu/cpu[0-9]* ; do ++ if [ -e "$THISCPU/online" ]; then ++ log "VERBOSE" "Bringing CPU $THISCPU to $ECHO_VAL"; ++ echo $CPU_VAL > $THISCPU/online; ++ else ++ log "VERBOSE" "CPU $THISCPU cannot be hot plugged"; ++ fi ++ done ++fi +diff --git a/usr/share/laptop-mode-tools/modules/ethernet b/usr/share/laptop-mode-tools/modules/ethernet +index fb552e6..78685ba 100755 +--- a/usr/share/laptop-mode-tools/modules/ethernet ++++ b/usr/share/laptop-mode-tools/modules/ethernet +@@ -32,6 +32,43 @@ if [ x$CONTROL_ETHERNET = x1 ] || [ x$ENABLE_AUTO_MODULES = x1 -a x$CONTROL_ETHE + fi + + ++ # Determine speed capability of physical device ++ speed=`$MIITOOL -v $DEVICE 2>/dev/null | grep capabilities | tr ' ' '\n' |\ ++ sort -n | sed -ne '/^1.*/p' | cut -d "b" -f1` ++ if [ -z "$speed" ]; then ++ speed=0; ++ fi ++ max_s=0; ++ min_s=100000; ++ for s in $speed; ++ do ++ if [ $s -gt $max_s ]; then ++ max_s=$s ++ fi ++ if [ $s -lt $min_s ]; then ++ min_s=$s ++ fi ++ done ++ MAX_SPEED=$max_s; ++ ++ case "$THROTTLE_SPEED" in ++ "slowest") ++ THROTTLE_SPEED=$min_s ++ ;; ++ "fastest") ++ THROTTLE_SPEED=$max_s ++ ;; ++ esac ++ ++ # Carrier detection ++ if $IPTOOL link show $DEVICE | grep -q NO-CARRIER; then ++ carrier="false"; ++ else ++ carrier="true"; ++ fi ++ ++ ++ # What state we are in + if [ $ON_AC -eq 1 ]; then + if [ "$ACTIVATE" -eq 1 ]; then + THROTTLE_ETHERNET="$LM_AC_THROTTLE_ETHERNET" +@@ -39,6 +76,12 @@ if [ x$CONTROL_ETHERNET = x1 ] || [ x$ENABLE_AUTO_MODULES = x1 -a x$CONTROL_ETHE + THROTTLE_ETHERNET="$NOLM_AC_THROTTLE_ETHERNET" + fi + ++ # One off a case. ++ # So that when back on AC, we can resume the speed back to MAX. ++ if [ x$THROTTLE_ETHERNET = x0 ]; then ++ THROTTLE_SPEED=$MAX_SPEED; ++ fi ++ + if [ x$DISABLE_ETHERNET_ON_BATTERY = x1 ]; then + # We are ON_AC and Disable feature is requested + # So we might be required to re-enable the device. +@@ -61,13 +104,6 @@ if [ x$CONTROL_ETHERNET = x1 ] || [ x$ENABLE_AUTO_MODULES = x1 -a x$CONTROL_ETHE + for DEVICE in $ETHERNET_DEVICES ; do + log "VERBOSE" "ethernet: $DEVICE" + +- # Carrier detection +- if $IPTOOL link show $DEVICE | grep -q NO-CARRIER; then +- carrier="false"; +- else +- carrier="true"; +- fi +- + # Wakeup-on-LAN handling + if [ x$DISABLE_WAKEUP_ON_LAN = x1 ] ; then + ret=`$ETHTOOL -s $DEVICE wol d 2>&1` +@@ -80,34 +116,6 @@ if [ x$CONTROL_ETHERNET = x1 ] || [ x$ENABLE_AUTO_MODULES = x1 -a x$CONTROL_ETHE + fi + fi + +- # Determine speed +- speed=`$MIITOOL -v $DEVICE 2>/dev/null | grep capabilities | tr ' ' '\n' |\ +- sort -n | sed -ne '/^1.*/p' | cut -d "b" -f1` +- if [ -z "$speed" ]; then +- speed=0; +- fi +- max_s=0; +- min_s=100000; +- for s in $speed; +- do +- if [ $s -gt $max_s ]; then +- max_s=$s +- fi +- if [ $s -lt $min_s ]; then +- min_s=$s +- fi +- done +- MAX_SPEED=$max_s; +- +- case "$THROTTLE_SPEED" in +- "slowest") +- THROTTLE_SPEED=$min_s +- ;; +- "fastest") +- THROTTLE_SPEED=$max_s +- ;; +- esac +- + # Handle throttling + if [ x$THROTTLE_ETHERNET = x1 ] ; then + # Handle Speed Throttling +@@ -119,16 +127,6 @@ if [ x$CONTROL_ETHERNET = x1 ] || [ x$ENABLE_AUTO_MODULES = x1 -a x$CONTROL_ETHE + else + log "VERBOSE" "Could not throttle speed for $DEVICE" + fi +- else +- # Handle Speed Throttling +- ret=`$ETHTOOL -s $DEVICE speed $MAX_SPEED 2>&1` +- exit_status=$?; +- log "VERBOSE" "$ret"; +- if [ $exit_status -eq 0 ]; then +- log "VERBOSE" "Restored speed to $MAX_SPEED Mbit for $DEVICE" +- else +- log "VERBOSE" "Could not restore speed for $DEVICE" +- fi + fi + + # Shut down interface +diff --git a/usr/share/polkit-1/actions/org.linux.lmt.gui.policy b/usr/share/polkit-1/actions/org.linux.lmt.gui.policy +new file mode 100644 +index 0000000..98e38fc +--- /dev/null ++++ b/usr/share/polkit-1/actions/org.linux.lmt.gui.policy +@@ -0,0 +1,19 @@ ++<?xml version="1.0" encoding="UTF-8"?> ++<!DOCTYPE policyconfig PUBLIC ++ "-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN" ++ "http://www.freedesktop.org/standards/PolicyKit/1/policyconfig.dtd"> ++<policyconfig> ++ ++ <action id="org.linux.lmt.gui.policy"> ++ <message>Authentication is required to run Laptop Mode Tools Config</message> ++ <icon_name>package-x-generic</icon_name> ++ <defaults> ++ <allow_any>auth_admin</allow_any> ++ <allow_inactive>auth_admin</allow_inactive> ++ <allow_active>auth_admin</allow_active> ++ </defaults> ++ <annotate key="org.freedesktop.policykit.exec.path">/usr/sbin/lmt-config-gui</annotate> ++ <annotate key="org.freedesktop.policykit.exec.allow_gui">true</annotate> ++ </action> ++ ++</policyconfig> diff --git a/source/apps-extra/laptop-mode-tools/FrugalBuild b/source/apps-extra/laptop-mode-tools/FrugalBuild index 018128f..7c0fa3b 100644 --- a/source/apps-extra/laptop-mode-tools/FrugalBuild +++ b/source/apps-extra/laptop-mode-tools/FrugalBuild @@ -3,7 +3,7 @@ pkgname=laptop-mode-tools pkgver=1.68.1 -pkgrel=1 +pkgrel=2 pkgdesc="A kernel mode that allows you to extend the battery life of your laptop" url="http://www.samwel.tk/laptop_mode/" depends=('hdparm' 'acpid') @@ -38,13 +38,18 @@ groups=('apps-extra') archs=('i686' 'x86_64') Fpkgversep="_" up2date="Flasttar $url/packages/tarball" -source=($url/tools/downloads/${pkgname}_${pkgver}.tar.gz) -sha1sums=('da48a3753d9cd0dac353a5d21dae0fac87960edf') +source=($url/tools/downloads/${pkgname}_${pkgver}.tar.gz \ + 1.68.1...lmt-upstream.diff) + +sha1sums=('da48a3753d9cd0dac353a5d21dae0fac87960edf' \ + '4bc3344c5f36c12b4951cb45dcb66188a321cd7b') _F_systemd_units=(laptop-mode-tools=e) Finclude systemd build() { Fcd + pwd + Fpatchall Fsed "etc/udev" "lib/udev" install.sh make DESTDIR="$Fdestdir" INIT_D=none MAN_D=/usr/share/man APM=disabled PMU=disabled install || Fdie Fsed '[ -x /sbin/udevadm ]' \ _______________________________________________ Frugalware-git mailing list [email protected] http://frugalware.org/mailman/listinfo/frugalware-git
