Hello community, here is the log from the commit of package laptop-mode-tools for openSUSE:Factory checked in at 2013-02-05 11:15:55 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/laptop-mode-tools (Old) and /work/SRC/openSUSE:Factory/.laptop-mode-tools.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "laptop-mode-tools", Maintainer is "hma...@suse.com" Changes: -------- --- /work/SRC/openSUSE:Factory/laptop-mode-tools/laptop-mode-tools.changes 2012-07-30 09:15:41.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.laptop-mode-tools.new/laptop-mode-tools.changes 2013-02-05 11:15:57.000000000 +0100 @@ -1,0 +2,19 @@ +Mon Feb 4 09:18:41 UTC 2013 - wstephen...@suse.com + +- update to 1.62: + * Add systemd support + * Be specific on what file systems we want to handle. Given the + wide range of file systems Linux has, we don't want to consider + them all as not all of them fall under the power saving scenarios. + * Factor out some common code + * Do not touch autonegotiation settings. Fiddling with + auto-negotiation settings can cause more problems and the + standards expect them to be always on + * Trim mount point display + * Organize state/STATE tracking so that we get actual results. + * cleaner output when asking status. + * Append to stdout/stderr to avoid truncating file logs + * Fix spec file for RPM syntax +- fix some rpmlint warnings + +------------------------------------------------------------------- Old: ---- laptop-mode-tools_1.60.tar.gz New: ---- laptop-mode-tools_1.62.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ laptop-mode-tools.spec ++++++ --- /var/tmp/diff_new_pack.ymIVPi/_old 2013-02-05 11:15:58.000000000 +0100 +++ /var/tmp/diff_new_pack.ymIVPi/_new 2013-02-05 11:15:58.000000000 +0100 @@ -1,7 +1,7 @@ # # spec file for package laptop-mode-tools # -# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -17,7 +17,7 @@ Name: laptop-mode-tools -Version: 1.60 +Version: 1.62 Release: 0 BuildRoot: %{_tmppath}/%{name}-%{version}-build Summary: The Laptop Mode Tools @@ -34,7 +34,6 @@ Patch4: laptop-mode-1.49-new-dirty-ratio-defaults.diff Patch5: laptop-mode-1.53-fix-pm-utils-sleep-script.diff Patch6: laptop-mode-1.53-moblin-enable-intel-hda-powersave.patch -Patch7: laptop-mode-1.60-local-can-only-be-used-in-a-function.patch BuildArch: noarch BuildRequires: pm-utils @@ -60,7 +59,6 @@ %patch4 -p1 %patch5 -p1 %patch6 -p1 -%patch7 -p1 cp %{S:2} . %build @@ -70,6 +68,7 @@ DESTDIR=$RPM_BUILD_ROOT MAN_D=%{_mandir} INSTALL=install INIT_D=/etc/init.d ACPI=DISABLED PMU=disabled APM=disabled ./install.sh install -D -m 0755 %{S:1} $RPM_BUILD_ROOT/usr/lib/pm-utils/power.d/laptop-mode-tools chmod 644 $RPM_BUILD_ROOT/%{_mandir}/man8/* +ln -s /etc/init.d/laptop-mode %{buildroot}/usr/sbin/rclaptop-mode %clean rm -rf "$RPM_BUILD_ROOT" @@ -89,7 +88,7 @@ %dir /etc/laptop-mode %config /etc/laptop-mode/* /etc/init.d/laptop-mode -/etc/udev/rules.d/99-laptop-mode.rules +%config /etc/udev/rules.d/99-laptop-mode.rules /usr/sbin/* %dir /usr/share/laptop-mode-tools/ %dir /usr/share/laptop-mode-tools/modules/ @@ -104,5 +103,8 @@ %doc /usr/share/man/man8/* %doc README.SUSE /lib/udev/lmt-udev +%dir /usr/lib/tmpfiles.d +/usr/lib/tmpfiles.d/laptop-mode.conf +%config /lib/systemd/system/laptop-mode.service %changelog ++++++ laptop-mode-tools_1.60.tar.gz -> laptop-mode-tools_1.62.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/laptop-mode-tools_1.60/Documentation/revision-history.txt new/laptop-mode-tools_1.62/Documentation/revision-history.txt --- old/laptop-mode-tools_1.60/Documentation/revision-history.txt 2011-10-14 09:40:08.000000000 +0200 +++ new/laptop-mode-tools_1.62/Documentation/revision-history.txt 2012-10-30 12:25:13.000000000 +0100 @@ -1,3 +1,28 @@ +1.62 - Tue Oct 30 16:45:46 IST 2012 + * Add systemd support + * Be specific on what file systems we want to handle. Given the wide range of + file systems Linux has, we don't want to consider them all as not all of them + fall under the power saving scenarios. + * Factor out some common code + * Do not touch autonegotiation settings. Fiddling with auto-negotiation settings + can cause more problems and the standards expect them to be always on + * Trim mount point display + * Organize state/STATE tracking so that we get actual results. + * cleaner output when asking status. Thanks Jasmine Hassan + * Append to stdout/stderr to avoid truncating file logs + * Fix spec file for RPM syntax + +1.61 - Thu May 17 17:44:26 IST 2012 + * Handle devices with persistent device naming. This fixes the issues where + you don't have a disk referenced by a block name, the commit= value was + completely skipped + * Fix issue where hdparm skips SSDs for power management + * Add parallel execution for the modules. In theory this should speeden up the + execution. See git commit log comments for details + * Add support for non-deafult customized settings + * calculate design_capacity_warning on machines/arches where it is not readily + available + 1.60 - Fri Oct 14 13:08:09 IST 2011 * Use proper device reference for iwconfig (Debian BTS: #639388) * Check for block device's existence. Thanks to Simon Que diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/laptop-mode-tools_1.60/etc/rules/lmt-udev new/laptop-mode-tools_1.62/etc/rules/lmt-udev --- old/laptop-mode-tools_1.60/etc/rules/lmt-udev 2011-10-14 09:40:08.000000000 +0200 +++ new/laptop-mode-tools_1.62/etc/rules/lmt-udev 2012-10-30 12:25:13.000000000 +0100 @@ -7,11 +7,11 @@ wait_for_file /usr/sbin/laptop_mode exec /usr/sbin/laptop_mode "$@" else - local file=$1 - local timeout=$2 + file=$1 + timeout=$2 [ "$timeout" ] || timeout=120 - local count=$timeout + count=$timeout while [ $count != 0 ]; do [ -e "/usr/sbin/laptop_mode" ] && exec /usr/sbin/laptop_mode "$@" && return 0 sleep 1 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/laptop-mode-tools_1.60/etc/systemd/laptop-mode.conf.tmpfiles new/laptop-mode-tools_1.62/etc/systemd/laptop-mode.conf.tmpfiles --- old/laptop-mode-tools_1.60/etc/systemd/laptop-mode.conf.tmpfiles 1970-01-01 01:00:00.000000000 +0100 +++ new/laptop-mode-tools_1.62/etc/systemd/laptop-mode.conf.tmpfiles 2012-10-30 12:25:13.000000000 +0100 @@ -0,0 +1,4 @@ +# systemd tmpfiles for Laptop Mode Tools + +D /run/laptop-mode-tools +F /run/laptop-mode-tools/enabled diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/laptop-mode-tools_1.60/etc/systemd/laptop-mode.service new/laptop-mode-tools_1.62/etc/systemd/laptop-mode.service --- old/laptop-mode-tools_1.60/etc/systemd/laptop-mode.service 1970-01-01 01:00:00.000000000 +0100 +++ new/laptop-mode-tools_1.62/etc/systemd/laptop-mode.service 2012-10-30 12:25:13.000000000 +0100 @@ -0,0 +1,14 @@ +[Unit] +Description=Laptop Mode Tools + +[Service] +Type=oneshot +RemainAfterExit=yes +ExecStart=/usr/sbin/laptop_mode init auto +ExecStop=/usr/sbin/laptop_mode init stop +ExecStopPost=/bin/rm -f /var/run/laptop-mode-tools/enabled +StandardOutput=tty +StandardError=tty + +[Install] +WantedBy=multi-user.target diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/laptop-mode-tools_1.60/install.sh new/laptop-mode-tools_1.62/install.sh --- old/laptop-mode-tools_1.60/install.sh 2011-10-14 09:40:08.000000000 +0200 +++ new/laptop-mode-tools_1.62/install.sh 2012-10-30 12:25:13.000000000 +0100 @@ -110,9 +110,13 @@ $INSTALL -d -m 755 "$DESTDIR/etc/laptop-mode/nolm-ac-stop" $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/usr/lib/tmpfiles.d" $INSTALL -d -m 755 "$DESTDIR/etc/laptop-mode/conf.d" +$INSTALL -d -m 755 "$DESTDIR/etc/laptop-mode/conf.d/board-specific" $INSTALL -d -m 755 "$DESTDIR/etc/laptop-mode/modules" $INSTALL -d -m 755 "$DESTDIR/usr/sbin" +$INSTALL -d -m 755 "$DESTDIR/lib/udev" +$INSTALL -d -m 755 "$DESTDIR/lib/systemd/system" $INSTALL -d -m 755 "$DESTDIR/$MAN_D/man8" ALREADY_EXISTED=0 @@ -204,6 +208,16 @@ echo "$0: Failed to install udev helper tool into /lib/udev/ Installation failed." fi +# systemd service +if ( ! $INSTALL -D -m 644 etc/systemd/laptop-mode.service "$DESTDIR/lib/systemd/system/laptop-mode.service" ) ; then + echo "$0: Failed to install systemd service into /lib/systemd/system/ Installation failed." +fi + +# and systemd's tmpfiles.d +if ( ! $INSTALL -D -m 644 etc/systemd/laptop-mode.conf.tmpfiles "$DESTDIR/usr/lib/tmpfiles.d/laptop-mode.conf" ) ; then + echo "$0: Failed to install systemd tmpfiles into /usr/lib/tmpfiles.d/ Installation failed." +fi + ACPI_DONE=0 APM_DONE=0 PMU_DONE=0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/laptop-mode-tools_1.60/laptop-mode-tools.spec new/laptop-mode-tools_1.62/laptop-mode-tools.spec --- old/laptop-mode-tools_1.60/laptop-mode-tools.spec 2011-10-14 09:40:08.000000000 +0200 +++ new/laptop-mode-tools_1.62/laptop-mode-tools.spec 2012-10-30 12:25:13.000000000 +0100 @@ -3,7 +3,7 @@ Summary: Tools for power savings based on battery/AC status Name: laptop-mode-tools -Version: 1.59 +Version: 1.62 Release: 1 License: GPL Group: System Environment/Base @@ -74,27 +74,37 @@ %config(noreplace) %{_sysconfdir}/laptop-mode/ %config %{_initrddir}/laptop-mode /lib/udev/lmt-udev +/lib/systemd/system/laptop-mode.service %{_sysconfdir}/apm/event.d/* %{_sysconfdir}/power/scripts.d/* %{_sysconfdir}/power/event.d/* %{_usr}/sbin/* %{_usr}/share/laptop-mode-tools/modules/* +%{_usr}/share/laptop-mode-tools/module-helpers/* %{_usr}/lib/pm-utils/sleep.d/* +%{_usr}/lib/tmpfiles.d/laptop-mode.conf %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 -%dir %{_usr}/share/laptop-mode-tools/module-helpers/* +%dir %{_usr}/share/laptop-mode-tools/module-helpers %dir %{_sysconfdir}/apm/event.d %dir %{_sysconfdir}/power/scripts.d %dir %{_sysconfdir}/power/event.d %changelog +* Tue Oct 30 2012 Ritesh Raj Sarraf <r...@researchut.com> - 1.62-1 +- Updated to release 1.62. + +* Thu May 17 2012 Ritesh Raj Sarraf <r...@researchut.com> - 1.61-1 +- Updated to release 1.61. + * Fri Oct 14 2011 Ritesh Raj Sarraf <r...@researchut.com> - 1.60-1 - Updated to release 1.60. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/laptop-mode-tools_1.60/usr/sbin/laptop_mode new/laptop-mode-tools_1.62/usr/sbin/laptop_mode --- old/laptop-mode-tools_1.60/usr/sbin/laptop_mode 2011-10-14 09:40:08.000000000 +0200 +++ new/laptop-mode-tools_1.62/usr/sbin/laptop_mode 2012-10-30 12:25:13.000000000 +0100 @@ -35,7 +35,7 @@ # The laptop mode tools version number. Extracted by the installer makefile # as well, so don't change the format! -LMTVERSION=1.60 +LMTVERSION=1.62 # This script is loaded from multiple scripts to set the config defaults # and to read the configuration on top of those. Only when the command is @@ -190,12 +190,12 @@ fi if [ "$1" = "VERBOSE" ]; then - $LM_VERBOSE && echo "$2" >/dev/fd/2; + $LM_VERBOSE && echo "$2" >>/dev/fd/2; elif [ "$1" = "ERR" ]; then - echo "$2" >/dev/fd/2; + echo "$2" >>/dev/fd/2; else # Message of type MSG and STATUS can go to stdout. - echo "$2" >/dev/fd/1; + echo "$2" >>/dev/fd/1; fi } @@ -229,8 +229,12 @@ # Source config. Some config settings have been moved from the main config file # to modular configuration files, and to support existing laptop-mode.conf # files from earlier versions, we source the modular configuration files FIRST. - if [ -d /etc/laptop-mode/conf.d ] ; then - for CONF in /etc/laptop-mode/conf.d/*.conf ; do + CONF_DIR="" + test -d /etc/laptop-mode/conf.d && CONF_DIR="$CONF_DIR /etc/laptop-mode/conf.d" + test -d /etc/laptop-mode/conf.d/board-specific && CONF_DIR="$CONF_DIR /etc/laptop-mode/conf.d/board-specific" + + for PER_DIR in $CONF_DIR; do + for CONF in $PER_DIR/*; do if [ -r "$CONF" ] ; then . "$CONF" #Handle individual module debug settings @@ -243,7 +247,8 @@ log "MSG" "Warning: Configuration file $CONF is not readable, skipping." fi done - fi + done + if [ -r /etc/laptop-mode/laptop-mode.conf ] ; then . /etc/laptop-mode/laptop-mode.conf else @@ -251,11 +256,6 @@ exit 1 fi - if [ x$ENABLE_LAPTOP_MODE_TOOLS = x0 ]; then - log "MSG" "laptop-mode-tools is disabled in config file. Exiting" - exit 0; - fi - # Add a simple bash debug mode switch if [ "$DEBUG" -eq 1 ]; then set -vx; @@ -507,16 +507,13 @@ ON_AC=1 fi -} - + -# The main workhorse. -lmt_main_function () -{ + # Evaluate options passed to laptop_mode in here if [ "$1" = "status" ] ; then # Display a status report. log "STATUS" "Mounts:" - mount | sed "s/^/ /" + mount | grep ^/dev | sed "s/^/ /" log "STATUS" " " log "STATUS" "Drive power status:" for disk in $HD; do @@ -627,13 +624,25 @@ esac shift done + fi +} + + +# The main workhorse. +lmt_main_function () +{ mkdir -p /var/run/laptop-mode-tools # Used to display laptop mode state later on. This is the enabled/disabled # state for laptop mode processing, it tells us nothing about whether laptop # mode is actually _active_. - STATE=enabled + STATE=disabled + if [ x$ENABLE_LAPTOP_MODE_TOOLS = x1 ]; then + touch /var/run/laptop-mode-tools/enabled + STATE=enabled + fi + if [ "$ENABLE_LAPTOP_MODE_ON_BATTERY" -eq 0 -a "$ENABLE_LAPTOP_MODE_ON_AC" -eq 0 -a "$ENABLE_LAPTOP_MODE_WHEN_LID_CLOSED" -eq 0 ] ; then STATE=disabled fi @@ -683,16 +692,15 @@ # If the init script has not been run or has been run with the "stop" # argument, then we should never start laptop mode. - if [ ! -f /var/run/laptop-mode-tools/enabled ] ; then + if [ ! -f /var/run/laptop-mode-tools/enabled -o x$INITSCRIPT_STOP = x1 ] ; then log "VERBOSE" "Laptop mode disabled because /var/run/laptop-mode-tools/enabled is missing." STATE=disabled fi - if [ "$ACTIVATE" -eq 1 -a -f /etc/default/laptop-mode ] ; then - . /etc/default/laptop-mode - if ! ( echo "$ENABLE_LAPTOP_MODE" |grep y ) ; then - log "VERBOSE" "Not starting laptop mode because it is disabled in /etc/default/laptop-mode." - STATE=disabled + if [ "$ACTIVATE" -eq 1 ]; then + if [ x$ENABLE_LAPTOP_MODE_TOOLS = x0 ]; then + log "VERBOSE" "Not starting laptop mode because it is disabled in /etc/laptop-mode/laptop-mode.conf" + STATE=disabled fi fi @@ -798,8 +806,23 @@ fi fi - # $BATT/alarm is the design_capacity_warning of a battery. - ALARM_LEVEL=$(cat $BATT/alarm) + if [ -f $BATT/alarm ]; then + # $BATT/alarm is the design_capacity_warning of a battery. + ALARM_LEVEL=$(cat $BATT/alarm) + elif [ -f $BATT/energy_full ]; then + # On Arm, it has been reported that there's no design_capacity_warning. + # The design_capacity_warning is 5% of the energy_full value + ENERGY_FULL=$(cat $BATT/energy_full) + ALARM_LEVEL=$(expr $ENERGY_FULL \* 5 / 100) + else + # If nothing is available, we don't want to touch hibernation. + # We'll rather report it + log "ERR" "You seem to have a broken battery" + log "ERR" "Cannot determine design_capacity_warning" + log "ERR" "Disabling hibernation" + ENOUGH_CHARGE=1 + fi + if [ "$ALARM_LEVEL" -ne 0 ] ; then if [ "$REMAINING" -le "$ALARM_LEVEL" ] ; then # Restore the state we had before checking this battery, so that @@ -1017,14 +1040,13 @@ read WAS_ACTIVE WAS_ON_AC WAS_ACTIVATE_WITH_POSSIBLE_DATA_LOSS WAS_STATE < /var/run/laptop-mode-tools/state if [ "$WAS_STATE" != "" ] ; then if [ "$WAS_ACTIVE" -eq "$ACTIVATE" -a "$WAS_ON_AC" -eq "$ON_AC" -a "$WAS_ACTIVATE_WITH_POSSIBLE_DATA_LOSS" -eq "$ACTIVATE_WITH_POSSIBLE_DATA_LOSS" -a "$WAS_STATE" = "$STATE" -a "$FORCE" -eq 0 ] ; then - log "MSG" "$STATE, " if [ "$WAS_ACTIVE" -eq 1 ] ; then - log "MSG" "active [unchanged]" + log "MSG" "$STATE, active [unchanged]" if [ "$ACTIVATE_WITH_POSSIBLE_DATA_LOSS" -eq 0 ] ; then log "MSG" " (Data-loss sensitive features disabled.)" fi else - log "MSG" "not active [unchanged]" + log "MSG" "$STATE, not active [unchanged]" fi exit 0 fi @@ -1083,22 +1105,20 @@ SCRIPT_DEBUG=$SCRIPT; # We do this because in start-stop-programs module a $SCRIPT variable is used. That # changes the whole meaning when passed to disableDebug () enableDebug $SCRIPT_DEBUG; - . $SCRIPT + (. $SCRIPT) & disableDebug $SCRIPT_DEBUG; else log "VERBOSE" "Module $SCRIPT is not executable or is to be skipped." fi done - exit 0 # This fi closes the if for "readconfig". If I would have indented this one # I would have indented the whole file. :) - fi } -lmt_load_config +lmt_load_config "$@"; # We do a special run of battery polling daemon here so that it does not get # plagued by the lock. We need the polling daemon to be independent of the REQ and INVOC locks. @@ -1110,7 +1130,7 @@ log "VERBOSE" "On AC, stopping the polling daemon." # In AC mode we disable the polling daemon. - killall -q lm-polling-daemon + killall -g -q lm-polling-daemon elif [ x$ON_AC = x0 ]; then exec 7>$LMT_BATTPOLL_LOCK; if $FLOCK -n -x -w 1 7; then @@ -1129,7 +1149,7 @@ # should be killed. if [ x$INITSCRIPT_STOP = x1 ]; then log "VERBOSE" "On Battery, but init script stop is called. Killing lm-polling-daemon" - killall -q lm-polling-daemon + killall -g -q lm-polling-daemon fi else log "ERR" "Unknown ON_AC state: $ON_AC"; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/laptop-mode-tools_1.60/usr/share/laptop-mode-tools/modules/ethernet new/laptop-mode-tools_1.62/usr/share/laptop-mode-tools/modules/ethernet --- old/laptop-mode-tools_1.60/usr/share/laptop-mode-tools/modules/ethernet 2011-10-14 09:40:08.000000000 +0200 +++ new/laptop-mode-tools_1.62/usr/share/laptop-mode-tools/modules/ethernet 2012-10-30 12:25:13.000000000 +0100 @@ -111,16 +111,6 @@ # Handle throttling if [ x$THROTTLE_ETHERNET = x1 ] ; then - # Handle auto-negotiation - ret=`ethtool -s $DEVICE autoneg off 2>&1` - exit_status=$?; - log "VERBOSE" "$ret"; - if [ $exit_status -eq 0 ]; then - log "VERBOSE" "Switched auto-negotiation to off for $DEVICE" - else - log "VERBOSE" "Could not set auto-negotiation to off for $DEVICE" - fi - # Handle Speed Throttling ret=`ethtool -s $DEVICE speed $THROTTLE_SPEED 2>&1` exit_status=$?; @@ -131,16 +121,6 @@ log "VERBOSE" "Could not throttle speed for $DEVICE" fi else - # Handle auto-negotiation - ret=`ethtool -s $DEVICE autoneg on 2>&1` - exit_status=$?; - log "VERBOSE" "$ret"; - if [ $exit_status -eq 0 ]; then - log "VERBOSE" "Switched auto-negotiation to on for $DEVICE" - else - log "VERBOSE" "Could not set auto-negotiation to on for $DEVICE" - fi - # Handle Speed Throttling ret=`ethtool -s $DEVICE speed $MAX_SPEED 2>&1` exit_status=$?; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/laptop-mode-tools_1.60/usr/share/laptop-mode-tools/modules/hdparm new/laptop-mode-tools_1.62/usr/share/laptop-mode-tools/modules/hdparm --- old/laptop-mode-tools_1.60/usr/share/laptop-mode-tools/modules/hdparm 2011-10-14 09:40:08.000000000 +0200 +++ new/laptop-mode-tools_1.62/usr/share/laptop-mode-tools/modules/hdparm 2012-10-30 12:25:13.000000000 +0100 @@ -22,6 +22,14 @@ return 1; fi + if [ -n "$(hdparm -I $1 | grep SSD)" ]; then + # If the device is a SSD, it is not capable of power management. + if [ "$2" = "POWERMGMT" ]; then + log "VERBOSE" "$1 is a SSD, not capable of power management" + return 1 + fi + fi + # If we are running udev, this is the most portable way # It assumes more or less recent udev (> 070) if [ $HAVE_UDEVINFO -ne 0 ] ; then diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/laptop-mode-tools_1.60/usr/share/laptop-mode-tools/modules/laptop-mode new/laptop-mode-tools_1.62/usr/share/laptop-mode-tools/modules/laptop-mode --- old/laptop-mode-tools_1.60/usr/share/laptop-mode-tools/modules/laptop-mode 2011-10-14 09:40:08.000000000 +0200 +++ new/laptop-mode-tools_1.62/usr/share/laptop-mode-tools/modules/laptop-mode 2012-10-30 12:25:13.000000000 +0100 @@ -114,6 +114,197 @@ } + +# +# +# [Re]Mount the devices/partitions that need to be controlled +# Parameter: BOOL +# +# +control_mount_options() { + + DO=0 + + log "VERBOSE" "Remounting filesystems." + # The -r flag makes 'read' preserve backslashes read from + # mtab. Spaces are represented by \040 in mtab. (also UTF-8) + cat /etc/mtab | while read -r DEV MP FST OPTS DUMP PASS ; do + # Now expand the escapes, inside quotes to preserve the spaces :) + MP="$(echo $MP)" + + case "$FST" in + ext*|reiserfs|xfs) + log "VERBOSE" "$FST mount options apply" + ;; + *) + log "VERBOSE" "$FST skipped for LMT" + continue + ;; + esac + + case " $PARTITIONS " in + *" $DEV "*) + DO=1 + log "VERBOSE" "$DEV found in PARTITIONS." + ;; + *) + log "VERBOSE" "$DEV not found in PARTITIONS." + ;; + esac + case " $PARTITIONS " in + *" $MP "*) + DO=1 + log "VERBOSE" "$MP found in PARTITIONS." + ;; + *) + log "VERBOSE" "$MP not found in PARTITIONS." + ;; + esac + case " $PARTITIONS " in + *" auto "*) + + # If we have a device referenced by a persistent device naming scheme, it does + # not get covered in the previous heuristics. So, if we reach here, we would + # want to do a check for it too. + + log "VERBOSE" "Checking $DEV against HD because PARTITIONS contains \"auto\"." + case $DEV in + *"/dev/disk/by-"*) + log "VERBOSE" "$DEV has a persistent device naming. Extracting real name\n" + REAL_DEV=`readlink -f $DEV` + ;; + + *) REAL_DEV=0 + ;; + esac + + log "VERBOSE" "Checking $DEV against HD because PARTITIONS contains \"auto\"." + for THISHD in $HD ; do + log "VERBOSE" " Considering $THISHD." + case " $DEV" in *"$THISHD"*) + DO=1 + log "VERBOSE" " $DEV contains $THISHD, which is in HD, so we will remount it." + break + ;; + esac + log "VERBOSE" "Considering the persistent device names\n" + case " $REAL_DEV" in *"$THISHD"*) + DO=1 + log "VERBOSE" " $REALDEV contains $THISHD, which is in HD, so we will remount it." + log "VERBOSE" "Chaning dev to real_dev\n" + DEV=$REAL_DEV + break + ;; + esac + done + ;; + esac + + if [ "$DO" -ne 0 ] ; then + + if [ $1 -ne 1 ]; then + # Enable ON_AC mount options + + # Reset commit and atime options to defaults. + log "VERBOSE" "Original options: $OPTS" + if [ "$FST" = 'unknown' ]; then + log "VERBOSE" "Deducing fstype for $MP." + FST=$(deduce_fstype $MP) + log "VERBOSE" "Deduced fstype for $MP as $FST." + fi + + # Strip stuff like ext3,ext2 into just ext3. + log "VERBOSE" "Reducing file system type." + FST=${FST%%,*} + + # Retrieve original non-laptop mode mount options and restore them. + # If the file that stores them doesn't exist, then laptop mode + # has never been started. + if [ "$WAS_ACTIVE" -ne 0 -a -f /var/run/laptop-mode-tools/nolm-mountopts ] ; then + SAVED_OPTS=`grep "^$DEV " /var/run/laptop-mode-tools/nolm-mountopts` + SAVED_OPTS=${SAVED_OPTS#* } # trim device name + + case "$FST" in + "ext3"|"reiserfs"|"ext4dev"|"ext4") + PARSEDOPTS="$(replace_numeric_mount_option commit commit=0 $SAVED_OPTS $OPTS)" + PARSEDOPTS="$(replace_atime_mount_option $SAVED_OPTS $PARSEDOPTS)" + log "VERBOSE" "Executing: mount $DEV $MP -t $FST -o remount,$PARSEDOPTS" + mount $DEV "$MP" -t $FST -o remount,$PARSEDOPTS + ;; + *) + PARSEDOPTS="$(replace_atime_mount_option $SAVED_OPTS $OPTS)" + log "VERBOSE" "Executing: mount $DEV $MP -t $FST -o remount,$PARSEDOPTS" + mount $DEV "$MP" -t $FST -o remount,$PARSEDOPTS + ;; + esac + else + log "VERBOSE" "No saved mount options, so apparently we never remounted this filesystem during this session." + log "VERBOSE" "Not remounting." + fi + if [ -b $DEV -a "$CONTROL_READAHEAD" -ne 0 ] ; then + log "VERBOSE" "Executing: /sbin/blockdev $READAHEAD_OPTION $(($NOLM_READAHEAD * 2)) $DEV" + log "VERBOSE" "`/sbin/blockdev $READAHEAD_OPTION $(($NOLM_READAHEAD * 2)) $DEV 2>&1`" + fi + + else + # Enable power saving mount options + + log "VERBOSE" "Original options: $OPTS" + if [ "$WAS_ACTIVE" -eq 0 ] ; then + # Coming from inactive state: save last known mount options for the device. + log "VERBOSE" "Updating /var/run/laptop-mode-tools/nolm-mountopts." + if [ -f /var/run/laptop-mode-tools/nolm-mountopts ] ; then + sed -i "s|^$DEV .*$||" /var/run/laptop-mode-tools/nolm-mountopts + fi + echo $DEV $OPTS >> /var/run/laptop-mode-tools/nolm-mountopts + else + log "VERBOSE" "Not updating /var/run/laptop-mode-tools/nolm-mountopts because laptop mode was already active." + fi + + if [ "$FST" = 'unknown' ]; then + log "VERBOSE" "Deducing fstype for $MP." + FST=$(deduce_fstype $MP) + log "VERBOSE" "Deduced fstype for $MP as $FST." + fi + # Strip stuff like ext3,ext2 into just ext3. + log "VERBOSE" "Reducing file system type." + FST=${FST%%,*} + + case "$FST" in + "ext3"|"reiserfs"|"ext4dev"|"ext4") + log "VERBOSE" "Removing commit mount option from original options." + PARSEDOPTS="$(remove_numeric_mount_option commit "$OPTS")" + log "VERBOSE" "Executing: mount $DEV $MP -t $FST -o remount,$PARSEDOPTS,commit=$MAX_LOST_WORK_SECONDS$NOATIME_OPT" + if (! mount $DEV "$MP" -t $FST -o remount,$PARSEDOPTS,commit=$MAX_LOST_WORK_SECONDS$NOATIME_OPT) ; then + if [ "$FST" = "ext3" -a "$MP" = "/" ] ; then + echo "BIG FAT WARNING: Your root filesystem mounted as ext3 seems to lack support for" + echo "the commit mount option. This usually means that your root filesystem is" + echo "mounted as ext2 because there is no ext3 support in the kernel at boot time," + echo "usually because you compiled ext3 as a module and don't load it in an initrd." + echo "Note that on recent 2.6 kernels, /proc/mounts shows the correct fs type for" + echo "the device /dev/root. You can check your actual root filesystem mount type" + echo "there. To fix the problem, either make ext3 available at boot time by compiling" + echo "it statically into the kernel, or configure the correct filesystem type in" + echo "/etc/fstab." + fi + fi + ;; + *) + log "VERBOSE" "Executing: mount $DEV $MP -t $FST -o remount,$OPTS$NOATIME_OPT" + mount $DEV "$MP" -t $FST -o remount,$OPTS$NOATIME_OPT + ;; + esac + if [ -b $DEV -a "$CONTROL_READAHEAD" -ne 0 ] ; then + log "VERBOSE" "Executing: /sbin/blockdev $READAHEAD_OPTION $(($LM_READAHEAD * 2)) $DEV" + log "VERBOSE" "`/sbin/blockdev $READAHEAD_OPTION $(($LM_READAHEAD * 2)) $DEV 2>&1`" + fi + + fi + fi + done +} + + if [ "$CONTROL_READAHEAD" -ne 0 ] ; then if /sbin/blockdev --help 2>&1 | grep -Fq -- '--setfra' ; then READAHEAD_OPTION=--setfra @@ -200,101 +391,7 @@ set_sysctl /proc/sys/vm/dirty_background_ratio "$LM_DIRTY_BACKGROUND_RATIO" fi if [ $CONTROL_MOUNT_OPTIONS -eq 1 ]; then - log "VERBOSE" "Remounting filesystems." - # The -r flag makes 'read' preserve backslashes read from - # mtab. Spaces are represented by \040 in mtab. (also UTF-8) - cat /etc/mtab | while read -r DEV MP FST OPTS DUMP PASS ; do - # Now expand the escapes, inside quotes to preserve the spaces :) - MP="$(echo $MP)" - case "$FST" in - rootfs|unionfs|tmpfs|squashfs|sysfs|usbfs|proc|devpts) - continue - ;; - esac - - DO=0 - - case " $PARTITIONS " in - *" $DEV "*) - DO=1 - log "VERBOSE" "$DEV found in PARTITIONS." - ;; - *) - log "VERBOSE" "$DEV not found in PARTITIONS." - ;; - esac - case " $PARTITIONS " in - *" $MP "*) - DO=1 - log "VERBOSE" "$MP found in PARTITIONS." - ;; - *) - log "VERBOSE" "$MP not found in PARTITIONS." - esac - case " $PARTITIONS " in - *" auto "*) - log "VERBOSE" "Checking $DEV against HD because PARTITIONS contains \"auto\"." - for THISHD in $HD ; do - log "VERBOSE" " Considering $THISHD." - case " $DEV" in *"$THISHD"*) - DO=1 - log "VERBOSE" " $DEV contains $THISHD, which is in HD, so we will remount it." - break - ;; - esac - done - ;; - esac - if [ "$DO" -ne 0 ] ; then - log "VERBOSE" "Original options: $OPTS" - if [ "$WAS_ACTIVE" -eq 0 ] ; then - # Coming from inactive state: save last known mount options for the device. - log "VERBOSE" "Updating /var/run/laptop-mode-tools/nolm-mountopts." - if [ -f /var/run/laptop-mode-tools/nolm-mountopts ] ; then - sed -i "s|^$DEV .*$||" /var/run/laptop-mode-tools/nolm-mountopts - fi - echo $DEV $OPTS >> /var/run/laptop-mode-tools/nolm-mountopts - else - log "VERBOSE" "Not updating /var/run/laptop-mode-tools/nolm-mountopts because laptop mode was already active." - fi - if [ "$FST" = 'unknown' ]; then - log "VERBOSE" "Deducing fstype for $MP." - FST=$(deduce_fstype $MP) - log "VERBOSE" "Deduced fstype for $MP as $FST." - fi - # Strip stuff like ext3,ext2 into just ext3. - log "VERBOSE" "Reducing file system type." - FST=${FST%%,*} - case "$FST" in - "ext3"|"reiserfs"|"ext4dev"|"ext4") - log "VERBOSE" "Removing commit mount option from original options." - PARSEDOPTS="$(remove_numeric_mount_option commit "$OPTS")" - log "VERBOSE" "Executing: mount $DEV $MP -t $FST -o remount,$PARSEDOPTS,commit=$MAX_LOST_WORK_SECONDS$NOATIME_OPT" - if (! mount $DEV "$MP" -t $FST -o remount,$PARSEDOPTS,commit=$MAX_LOST_WORK_SECONDS$NOATIME_OPT) ; then - if [ "$FST" = "ext3" -a "$MP" = "/" ] ; then - echo "BIG FAT WARNING: Your root filesystem mounted as ext3 seems to lack support for" - echo "the commit mount option. This usually means that your root filesystem is" - echo "mounted as ext2 because there is no ext3 support in the kernel at boot time," - echo "usually because you compiled ext3 as a module and don't load it in an initrd." - echo "Note that on recent 2.6 kernels, /proc/mounts shows the correct fs type for" - echo "the device /dev/root. You can check your actual root filesystem mount type" - echo "there. To fix the problem, either make ext3 available at boot time by compiling" - echo "it statically into the kernel, or configure the correct filesystem type in" - echo "/etc/fstab." - fi - fi - ;; - *) - log "VERBOSE" "Executing: mount $DEV $MP -t $FST -o remount,$OPTS$NOATIME_OPT" - mount $DEV "$MP" -t $FST -o remount,$OPTS$NOATIME_OPT - ;; - esac - if [ -b $DEV -a "$CONTROL_READAHEAD" -ne 0 ] ; then - log "VERBOSE" "Executing: /sbin/blockdev $READAHEAD_OPTION $(($LM_READAHEAD * 2)) $DEV" - log "VERBOSE" "`/sbin/blockdev $READAHEAD_OPTION $(($LM_READAHEAD * 2)) $DEV 2>&1`" - fi - fi - done + control_mount_options $ACTIVATE_WITH_POSSIBLE_DATA_LOSS fi else # DEACTIVATE w.r.t. kernel options and mount point settings @@ -323,89 +420,8 @@ set_sysctl /proc/sys/vm/dirty_ratio "$NOLM_DIRTY_RATIO" set_sysctl /proc/sys/vm/dirty_background_ratio "$NOLM_DIRTY_BACKGROUND_RATIO" fi - if [ $CONTROL_MOUNT_OPTIONS -eq 1 ] ; then - log "VERBOSE" "Remounting filesystems." - # The -r flag makes 'read' preserve backslashes read from - # mtab. Spaces are represented by \040 in mtab. (also UTF-8) - cat /etc/mtab | while read -r DEV MP FST OPTS DUMP PASS ; do - # Now expand the escapes, inside quotes to preserve the spaces :) - MP="$(echo $MP)" - DO=0 - case " $PARTITIONS " in - *" $DEV "*) - DO=1 - log "VERBOSE" "$DEV found in PARTITIONS." - ;; - *) - log "VERBOSE" "$DEV not found in PARTITIONS." - ;; - esac - case " $PARTITIONS " in - *" $MP "*) - DO=1 - log "VERBOSE" "$MP found in PARTITIONS." - ;; - *) - log "VERBOSE" "$MP not found in PARTITIONS." - ;; - esac - case " $PARTITIONS " in - *" auto "*) - log "VERBOSE" "Checking $DEV against HD because PARTITIONS contains \"auto\"." - for THISHD in $HD ; do - log "VERBOSE" " Considering $THISHD." - case " $DEV" in *"$THISHD"*) - DO=1 - log "VERBOSE" " $DEV contains $THISHD, which is in HD, so we will remount it." - break - ;; - esac - done - ;; - esac - if [ "$DO" -ne 0 ] ; then - # Reset commit and atime options to defaults. - log "VERBOSE" "Original options: $OPTS" - if [ "$FST" = 'unknown' ]; then - log "VERBOSE" "Deducing fstype for $MP." - FST=$(deduce_fstype $MP) - log "VERBOSE" "Deduced fstype for $MP as $FST." - fi - - # Strip stuff like ext3,ext2 into just ext3. - log "VERBOSE" "Reducing file system type." - FST=${FST%%,*} - - # Retrieve original non-laptop mode mount options and restore them. - # If the file that stores them doesn't exist, then laptop mode - # has never been started. - if [ "$WAS_ACTIVE" -ne 0 -a -f /var/run/laptop-mode-tools/nolm-mountopts ] ; then - SAVED_OPTS=`grep "^$DEV " /var/run/laptop-mode-tools/nolm-mountopts` - SAVED_OPTS=${SAVED_OPTS#* } # trim device name - - case "$FST" in - "ext3"|"reiserfs"|"ext4dev"|"ext4") - PARSEDOPTS="$(replace_numeric_mount_option commit commit=0 $SAVED_OPTS $OPTS)" - PARSEDOPTS="$(replace_atime_mount_option $SAVED_OPTS $PARSEDOPTS)" - log "VERBOSE" "Executing: mount $DEV $MP -t $FST -o remount,$PARSEDOPTS" - mount $DEV "$MP" -t $FST -o remount,$PARSEDOPTS - ;; - *) - PARSEDOPTS="$(replace_atime_mount_option $SAVED_OPTS $OPTS)" - log "VERBOSE" "Executing: mount $DEV $MP -t $FST -o remount,$PARSEDOPTS" - mount $DEV "$MP" -t $FST -o remount,$PARSEDOPTS - ;; - esac - else - log "VERBOSE" "No saved mount options, so apparently we never remounted this filesystem during this session." - log "VERBOSE" "Not remounting." - fi - if [ -b $DEV -a "$CONTROL_READAHEAD" -ne 0 ] ; then - log "VERBOSE" "Executing: /sbin/blockdev $READAHEAD_OPTION $(($NOLM_READAHEAD * 2)) $DEV" - log "VERBOSE" "`/sbin/blockdev $READAHEAD_OPTION $(($NOLM_READAHEAD * 2)) $DEV 2>&1`" - fi - fi - done + if [ $CONTROL_MOUNT_OPTIONS -eq 1 ]; then + control_mount_options $ACTIVATE_WITH_POSSIBLE_DATA_LOSS fi fi -- To unsubscribe, e-mail: opensuse-commit+unsubscr...@opensuse.org For additional commands, e-mail: opensuse-commit+h...@opensuse.org