File pm-utils-0.99.4-suse.diff of Package pm-utils
Index: b/pm/functions
===================================================================
--- a/pm/functions
+++ b/pm/functions
@@ -8,17 +8,33 @@ export PATH=/sbin:/usr/sbin:/bin:/usr/bi
#
# PM_CMDLINE
# RESUME_MODULES
#
set -a
+### for compatibility with the other pm-utils project ###
+PM_UTILS_LIBDIR="/usr/lib/pm-utils"
+PM_UTILS_ETCDIR="/etc/pm"
+PM_UTILS_RUNDIR="/var/run/pm-utils"
+PATH=/sbin:/usr/sbin:/bin:/usr/bin:"${PM_UTILS_LIBDIR}"/bin
+#LOCKDIR="${PM_UTILS_RUNDIR}/locks"
+#STORAGEDIR="${PM_UTILS_RUNDIR}/${STASHNAME}/storage"
+NA=254
+NX=253
+DX=252
+PM_FUNCTIONS="$PM_UTILS_LIBDIR/functions"
+# Use c sort order
+LC_COLLATE=C
+PM_CMDLINE="$*"
+### end compatibility section ###########################
+
HIBERNATE_RESUME_POST_VIDEO=no
INHIBIT=/var/run/pm-utils.inhibit
PM_LOGFILE=${PM_LOGFILE:=/var/log/pm-suspend.log}
SUSPEND_MODULES=""
HIBERNATE_METHOD=""
-S2DISK_CONF="/etc/suspend.conf"
-TEMPORARY_CPUFREQ_GOVERNOR="userspace"
+S2DISK_CONF="/var/lib/s2disk.conf"
+TEMPORARY_CPUFREQ_GOVERNOR="performance"
[ -f /usr/lib/pm-utils/defaults ] && . /usr/lib/pm-utils/defaults
set +a
# set nullglob to make glob results empty in case the pattern does not
@@ -39,11 +55,13 @@ source_configs()
source_configs
take_suspend_lock()
{
VT=$(fgconsole)
- chvt 63
+ # don't switch console here, suspend tools are doing this anyway later
+ # on, and it looks better with splashy support
+ #chvt 63
if [ -f /.suspended ]; then
read pid < /.suspended
if [ -d /proc/$pid ]; then
return 1
fi
@@ -54,13 +72,13 @@ take_suspend_lock()
return 0
}
remove_suspend_lock()
{
- rm -f /var/run/pm-suspend
- chvt 1
- chvt $VT
+# rm -f /var/run/pm-suspend
+ #chvt 1
+ #chvt $VT
openvt -- sh -c "usleep $1 ; rm -f /.suspended >/dev/null 2>&1 0<&1" >/dev/null 2>&1 0<&1 &
}
find_sleepd_files()
{
@@ -79,32 +97,32 @@ run_hooks()
{
# $1=suspend/suspend_hybrid/hibernate $2=suspend/hibernate/thaw/resume $3=reverse/""
[ -z "$1" ] && return 0
[ -f /var/run/pm-suspend ] && . /var/run/pm-suspend
- rm -f /var/run/pm-suspend
+# rm -f /var/run/pm-suspend
- echo "$(date): running '$1'/'$2'/'$3' hooks."
+ echo "$(date '+%F %T.%N %z'): running '$1'/'$2'/'$3' hooks."
files=$(find_sleepd_files)
if [ "$3" = "reverse" ]; then
filea=($files)
filen=${#filea[*]}
while [ "$filen" -gt 0 ]; do
let filen--
file="${filea[$filen]}"
- echo "===== $(date): running hook: $file ====="
+ echo "===== $(date '+%F %T.%N') running hook: $file ====="
$file $2 $1
done
else
for file in $files ; do
- echo "===== $(date): running hook: $file ====="
+ echo "===== $(date '+%F %T.%N') running hook: $file ====="
$file $2 $1
done
fi
- echo "$(date): done running $1/$2 hooks."
+ echo "$(date '+%F %T.%N'): done running $1/$2 hooks."
}
get_power_status()
{
RETVAL=0
Index: b/pm/hooks/00clear
===================================================================
--- a/pm/hooks/00clear
+++ b/pm/hooks/00clear
@@ -3,11 +3,11 @@
. /usr/lib/pm-utils/functions
RETVAL=0
case "$1" in
hibernate|suspend)
- TERM=linux openvt -w -s -f -c 63 -- clear >/dev/null 2>&1
+ TERM=linux openvt -w -f -c 63 -- echo -e "\033[H\033[JPreparing $1..." >/dev/null 2>&1
RETVAL=$?
;;
*)
;;
esac
Index: b/pm/hooks/50modules
===================================================================
--- a/pm/hooks/50modules
+++ b/pm/hooks/50modules
@@ -4,19 +4,21 @@
suspend_modules()
{
[ -z "$SUSPEND_MODULES" ] && return 0
for x in $SUSPEND_MODULES ; do
+ echo "trying to unload: $x"
modunload $x
done
return 0
}
resume_modules()
{
[ -z "$RESUME_MODULES" ] && return 0
for x in $RESUME_MODULES ; do
+ echo "trying to reload: $x"
modprobe $x
done
}
case "$1" in
Index: b/src/pm-powersave
===================================================================
--- a/src/pm-powersave
+++ b/src/pm-powersave
@@ -26,10 +26,13 @@
# set nullglob to make glob results empty in case the pattern does not
# match any files
shopt -s nullglob
+PM_POWERSAVE_LOGFILE="/var/log/pm-powersave.log"
+echo -n > $PM_POWERSAVE_LOGFILE
+
find_powerd_files()
{
flist="/etc/pm/power.d/*[^~] /usr/lib/pm-utils/power.d/*[^~]"
bases=$(for file in $flist ; do echo $(basename $file) ; done | sort -n | uniq)
for base in $bases ; do
@@ -43,11 +46,11 @@ find_powerd_files()
runpowerhooks()
{
files=$(find_powerd_files)
for file in $files ; do
- $file $1
+ $file $1 >> $PM_POWERSAVE_LOGFILE 2>&1
done
}
if [ "$1" == "true" ] ; then
runpowerhooks true
@@ -55,5 +58,8 @@ elif [ "$1" == "false" ] ; then
runpowerhooks false
else
echo "Argument needs to be true or false" >&2
exit 1
fi
+
+cat $PM_POWERSAVE_LOGFILE
+
Index: b/src/pm-action
===================================================================
--- a/src/pm-action
+++ b/src/pm-action
@@ -126,10 +126,12 @@ case "$ACTION" in
*)
exit 1
;;
esac
+logger -i -t "pm-$METHOD" "Entering $METHOD. In case of problems, please check /var/log/pm-suspend.log"
+
export PM_CMDLINE="$@"
pm_main "$METHOD" "$ACTION" "$REVERSE"
exit $?