rpms/pm-utils/devel pm-utils-1.1.0-log_order.patch, NONE, 1.1 pm-utils-99hd-apm-restore, 1.5, 1.6 pm-utils-hd-apm-restore.conf, 1.1, 1.2 pm-utils.spec, 1.96, 1.97

Till Maas (till) fedora-extras-commits at redhat.com
Tue Apr 15 12:28:27 UTC 2008


Author: till

Update of /cvs/pkgs/rpms/pm-utils/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv32719

Modified Files:
	pm-utils-99hd-apm-restore pm-utils-hd-apm-restore.conf 
	pm-utils.spec 
Added Files:
	pm-utils-1.1.0-log_order.patch 
Log Message:
* Mon Apr 14 2008 Till Maas <opensource till name> - 1.1.0-5
- remove double %dir %{_libdir}/pm-utils
- update pm-utils-99hd-apm-restore to work with current pm-utils release
  Red Hat Bugzilla: #442294
- move config file for hd apm restore away from config.d, which is only used
  for pm-utils internal config anymore
- own /var/run/pm-utils/ and create storage/locks subdirs (may be
  needed for selinux)
- make sure an empty logfile is created after install (touch -a ...)
- sort %files
- make Source0: an URL
- remove Conflicts: bluez utils, all supported Fedora releases ship
  already a newer version
- remove unused BR: hal-devel, dbus-devel, pkgconfig, docbook-utils


pm-utils-1.1.0-log_order.patch:

--- NEW FILE pm-utils-1.1.0-log_order.patch ---
diff -up pm-utils-1.1.0/src/pm-action.in.log_order pm-utils-1.1.0/src/pm-action.in
diff -up pm-utils-1.1.0/src/pm-action.in.log_order pm-utils-1.1.0/src/pm-action.in
--- pm-utils-1.1.0/src/pm-action.in.log_order	2008-03-31 12:02:35.000000000 +0200
+++ pm-utils-1.1.0/src/pm-action.in	2008-04-14 22:10:05.000000000 +0200
@@ -72,15 +72,24 @@ load_hook_parameters
 # Make sure we are not inhibited before we start.
 rm -f "${INHIBIT}"
 
-# run the sleep hooks
-log "$(date): Running hooks for $ACTION."
-run_hooks sleep "$ACTION"
-log "$(date): ${METHOD}ing"
-# Sleep only if we know how and if a hook did not inhibit us.
-command_exists "do_$METHOD" && [ ! -e "$INHIBIT" ] && { sync; "do_$METHOD"; }
-log "$(date): Awake."
-log "$(date): Running hooks for $REVERSE"
-# run the sleep hooks in reverse with the wakeup action
-run_hooks sleep "$REVERSE" reverse
-log "$(date): Finished."
-
+if command_exists "do_$METHOD" ; then
+    # run the sleep hooks
+    log "$(date): Running hooks for $ACTION."
+    run_hooks sleep "$ACTION"
+    # Sleep only if we know how and if a hook did not inhibit us.
+    if [ ! -e "$INHIBIT" ]; then
+        log "$(date): performing ${METHOD}"
+        sync
+        "do_$METHOD"
+        log "$(date): Awake."
+    else
+        log "$(date): Inhibit found, will not perform ${METHOD}"
+    fi
+    log "$(date): Running hooks for $REVERSE"
+    # run the sleep hooks in reverse with the wakeup action
+    run_hooks sleep "$REVERSE" reverse
+    log "$(date): Finished."
+else
+    log "$(date): Missing module to perform $METHOD - abort."
+    exit 1
+fi


Index: pm-utils-99hd-apm-restore
===================================================================
RCS file: /cvs/pkgs/rpms/pm-utils/devel/pm-utils-99hd-apm-restore,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- pm-utils-99hd-apm-restore	2 Jan 2008 17:04:33 -0000	1.5
+++ pm-utils-99hd-apm-restore	15 Apr 2008 12:27:47 -0000	1.6
@@ -14,44 +14,55 @@
 
 PATH=/sbin:/bin:/usr/sbin:/usr/bin
 
-HD_APM_STATEFILE=/var/run/pm-hd-apm
-HD_APM_DEVICES=sda
+source "${PM_FUNCTIONS}"
+source /etc/pm-utils-hd-apm-restore.conf
 
-source /usr/lib/pm-utils/functions
+HD_APM_DEVICES=""
+for udi in $(hal-find-by-capability --capability storage)
+do
+    drive_type=$(hal-get-property --udi "${udi}" --key storage.drive_type)
+    if [ "${drive_type}" == "disk" ]
+    then
+        HD_APM_DEVICES+="$(hal-get-property --udi "${udi}" --key block.device | sed 's,^/dev/,,') "
+
+    fi
+done
 
 case "$1" in
 	hibernate|suspend)
-		rm -f ${HD_APM_STATEFILE}
-		touch ${HD_APM_STATEFILE}
 		for DEVICE in ${HD_APM_DEVICES}
 		do
-			HD_APM_FEATURE=$(hdparm -I /dev/sda | grep "Advanced Power Management feature set")
+			HD_APM_FEATURE=$(hdparm -I "/dev/${DEVICE}" | grep "Advanced Power Management feature set")
 			if [[ "${HD_APM_FEATURE}" != "" ]]
 			then
-				if (echo "${HD_APM_FEATURE}" | grep "*")
+				if (echo "${HD_APM_FEATURE}" | grep -q "*" )
 				then
-					HD_APM_LEVEL=$(hdparm -I /dev/${DEVICE} | grep "Advanced power management level" | cut -d" " -f 5)
+					HD_APM_LEVEL=$(hdparm -I "/dev/${DEVICE}" | grep "Advanced power management level" | cut -d" " -f 5)
 				else
 					HD_APM_LEVEL=255
 				fi
 				if [[ "${HD_APM_LEVEL}" != "unknown" ]]
 				then
-					echo "HD_APM_LEVEL_${DEVICE}=${HD_APM_LEVEL}" >> ${HD_APM_STATEFILE}
+					echo "saving level ${HD_APM_LEVEL} for device ${DEVICE}"
+					savestate "${DEVICE}" "${HD_APM_LEVEL}"
+				else
+					echo "Advanced Power Management value of device ${DEVICE} unknown"
 				fi
+			else
+				echo "Advanced Power Management not supported by device ${DEVICE}."
 			fi
 		done
 		;;
 	thaw|resume)
-		source ${HD_APM_STATEFILE}
 		for DEVICE in ${HD_APM_DEVICES}
 		do
-			eval HD_APM_LEVEL=\${HD_APM_LEVEL_${DEVICE}}
+			HD_APM_LEVEL=$(restorestate "${DEVICE}")
 			if [[ "${HD_APM_LEVEL}" != "" ]]
 			then
-				hdparm -B ${HD_APM_LEVEL} /dev/${DEVICE}
+				echo "restoring level ${HD_APM_LEVEL} for device ${DEVICE}"
+				hdparm -B "${HD_APM_LEVEL}" "/dev/${DEVICE}"
 			fi
 		done
-		rm -f ${HD_APM_STATEFILE}
 		;;
 	*)
 		;;


Index: pm-utils-hd-apm-restore.conf
===================================================================
RCS file: /cvs/pkgs/rpms/pm-utils/devel/pm-utils-hd-apm-restore.conf,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- pm-utils-hd-apm-restore.conf	2 Jan 2008 16:56:36 -0000	1.1
+++ pm-utils-hd-apm-restore.conf	15 Apr 2008 12:27:47 -0000	1.2
@@ -6,4 +6,7 @@
 # Use this to overwrite a value for a device in case hdparm reports
 # "unknown value" for the apm level. This is ignored when hdparm
 # returns an other value.
-#HD_APM_LEVEL_sda=192
+#savestate sda 192
+#savestate sdb 192
+#savestate sdc 192
+#savestate sdd 192


Index: pm-utils.spec
===================================================================
RCS file: /cvs/pkgs/rpms/pm-utils/devel/pm-utils.spec,v
retrieving revision 1.96
retrieving revision 1.97
diff -u -r1.96 -r1.97
--- pm-utils.spec	8 Apr 2008 14:59:29 -0000	1.96
+++ pm-utils.spec	15 Apr 2008 12:27:47 -0000	1.97
@@ -2,7 +2,7 @@
 Summary: Power management utilities and scripts for Fedora
 License: GPLv2
 Version: 1.1.0
-Release: 4%{?dist}
+Release: 5%{?dist}
 Group: System Environment/Base
 URL: http://pm-utils.freedesktop.org
 Requires: usermode kbd pciutils >= 2.2.1
@@ -14,8 +14,7 @@
 %ifarch %{ix86} x86_64
 Requires: vbetool
 %endif
-Conflicts: bluez-utils < 2.25-6
-Source0: pm-utils-%{version}.tar.gz
+Source0: http://pm-utils.freedesktop.org/releases/pm-utils-%{version}.tar.gz
 Source1: pm-suspend.pam
 Source2: pm-hibernate.pam
 Source3: pm-powersave.pam
@@ -31,10 +30,9 @@
 Source22: pm-utils-hd-apm-restore.conf
 Source23: pm-utils-bugreport-info.sh
 
+Patch0: pm-utils-1.1.0-log_order.patch
+
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
-BuildRequires: hal-devel pkgconfig
-BuildRequires: dbus-devel >= 0.90
-BuildRequires: docbook-utils
 
 
 %description
@@ -54,6 +52,8 @@
 
 %prep
 %setup -q 
+%patch0 -p1 -b .log_order
+
 
 %build
 %configure
@@ -84,9 +84,10 @@
 popd
 
 install -D -m 0600 /dev/null $RPM_BUILD_ROOT%{_localstatedir}/log/pm-suspend.log
+mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/run/pm-utils/{locks,storage}
 
 install -D -m 0755 %{SOURCE21} $RPM_BUILD_ROOT%{_libdir}/pm-utils/sleep.d/99hd-apm-restore.hook
-install -D -m 0644 %{SOURCE22} $RPM_BUILD_ROOT%{_sysconfdir}/pm/config.d/hd-apm-restore.conf
+install -D -m 0644 %{SOURCE22} $RPM_BUILD_ROOT%{_sysconfdir}/pm-utils-hd-apm-restore.conf
 
 install -D -m 0755 %{SOURCE23} $RPM_BUILD_ROOT%{_bindir}/pm-utils-bugreport-info.sh
 
@@ -105,6 +106,7 @@
 if [ -f %{_sysconfdir}/pm/config.rpmsave ]; then
 	mv %{_sysconfdir}/pm/config.rpmsave %{_sysconfdir}/pm/config.d/02oldconfig.conf
 fi
+touch -a %{_localstatedir}/log/pm-suspend.log
 if [ -f %{_localstatedir}/log/pm-suspend.log ] ; then
 	chmod 0600 %{_localstatedir}/log/pm-suspend.log
 	[ -x /sbin/restorecon ] && restorecon  %{_localstatedir}/log/pm-suspend.log > /dev/null 2>&1
@@ -114,7 +116,7 @@
 %files
 %defattr(-,root,root,-)
 %doc README COPYING AUTHORS ChangeLog
-%config(noreplace) %{_sysconfdir}/pm/config.d/hd-apm-restore.conf
+%config(noreplace) %{_sysconfdir}/pm-utils-hd-apm-restore.conf
 %{_sysconfdir}/pm/
 %{_sysconfdir}/security/console.apps/pm-hibernate
 %{_sysconfdir}/security/console.apps/pm-powersave
@@ -128,8 +130,10 @@
 %{_libdir}/pm-utils/bin/
 %{_libdir}/pm-utils/defaults
 %{_libdir}/pm-utils/functions
+%{_libdir}/pm-utils/pm-functions
 %{_libdir}/pm-utils/power.d/
 %{_libdir}/pm-utils/sleep.d/
+%{_libdir}/pm-utils/module.d
 %{_bindir}/on_ac_power
 %{_bindir}/pm-hibernate
 %{_bindir}/pm-is-supported
@@ -143,10 +147,7 @@
 %{_sbindir}/pm-suspend-hybrid
 %{_mandir}/man1/on_ac_power.1*
 %{_mandir}/man1/pm-pmu.1*
-%dir %{_libdir}/pm-utils
-%{_libdir}/pm-utils/pm-functions
-%dir %{_libdir}/pm-utils/module.d
-%{_libdir}/pm-utils/module.d/*
+%{_localstatedir}/run/pm-utils/
 
 %ghost %verify(not md5 size mtime) %{_localstatedir}/log/pm-suspend.log
 
@@ -155,6 +156,21 @@
 %{_libdir}/pkgconfig/pm-utils.pc
 
 %changelog
+* Mon Apr 14 2008 Till Maas <opensource till name> - 1.1.0-5
+- remove double %%dir %%{_libdir}/pm-utils
+- update pm-utils-99hd-apm-restore to work with current pm-utils release
+  Red Hat Bugzilla: #442294
+- move config file for hd apm restore away from config.d, which is only used
+  for pm-utils internal config anymore
+- own /var/run/pm-utils/ and create storage/locks subdirs (may be
+  needed for selinux)
+- make sure an empty logfile is created after install (touch -a ...)
+- sort %%files
+- make Source0: an URL
+- remove Conflicts: bluez utils, all supported Fedora releases ship
+  already a newer version
+- remove unused BR: hal-devel, dbus-devel, pkgconfig, docbook-utils
+
 * Mon Apr  8 2008 Richard Hughes <rhughes at redhat.com> - 1.1.0-4
 - Fix build on 64 bit machines - harder.
 




More information about the scm-commits mailing list