Bug#749185: When run pm-powersave truehave strange result

2014-05-25 Thread asd
Hi 

Temporarily  fixed this issue by editing script from /usr/lib/pm-utils/pm-
functions :

_run_hooks() {
# $1 = type of hook to find.  
# $2 = paramaters to pass to hooks.
# $3 = if present and equal to reverse, run hooks backwards.
# Currently only power and sleep are meaningful.
local syshooks=${PM_UTILS_ETCDIR}/$1.d
local phooks=${PM_UTILS_LIBDIR}/$1.d
command_exists before_hooks  before_hooks
local sort=sort
local base
local hook
local oifs=${IFS}
# the next two lines are not a typo or a formatting error!
local nifs=

IFS=${nifs} # tolerate spaces in filenames.
[ $3 = reverse ]  sort=sort -r
for base in $(IFS=${oifs}; for f in $syshooks/*[!~] $phooks/*[!~];
do [ -O $f ]  echo ${f##*/} ; done | $sort | uniq) ;
do
IFS=${oifs}
# if we are running backwards, skip hooks that we did not 
# run going forwards due to a hook failing.
[ $3 -a $3 = reverse -a $LAST_HOOK ]  \
[ $base \ $LAST_HOOK ]  continue
# if we have already inhibited suspend/resume,
# don't run any more hooks.
[ ! $3 ]  inhibited  break
update_parameters
if [ -f $syshooks/$base ]; then
hook=$syshooks/$base
elif [ -f $phooks/$base ]; then
hook=$phooks/$base
fi
# run_hook $hook $2
run_hook $hook true
IFS=${nifs}
done
IFS=${oifs}
# return value is 1 if something was inhibited, 0 otherwise.
inhibited  return 1 || return 0
}

I choose  when run run_hook to allways to be true and working for me.


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#749185: When run pm-powersave truehave strange result

2014-05-25 Thread asd
Hi 
On below present one patch which make posible to set first args on pm-powersave 
allways true 
pm-powersave true-excl will be placed on /etc/rc.local .--- a/src/pm-powersave.in
+++ b/src/pm-powersave.in
@@ -25,7 +25,7 @@
 #
 
 export STASHNAME=pm-powersave
-. @PM-UTILS-LIBDIR@/pm-functions
+. @PM-UTILS-LIBDIR@/pm-functions
 
 remove_powersave_lock() {
 release_lock ${STASHNAME}.lock
@@ -66,18 +66,24 @@
 }
 
 _on_ac_power() {
+if [ $1 = true-excl ]; then
+	touch ${STORAGEDIR}/rtue-excl
+	return 0
+else
 on_ac_power
 case $? in
 # If on_ac_power can't determine AC power state (255), assume it's a desktop.
 0|255) return 0 ;;
 1) return 1 ;;
 esac
+fi
 }
 
 case $1 in
 true|battery) lock_and_load  run_hooks power true;;
 false|ac) lock_and_load  run_hooks power false;;
 --help) help  run_hooks power help;;
+true-excl) lock_and_load  _on_ac_power true-excl  run_hooks power false;;
 '') lock_and_load; _on_ac_power  run_hooks power false || run_hooks power true;;
 *) help  exit 1;;
 esac
--- a/pm/pm-functions.in
+++ b/pm/pm-functions.in
@@ -245,8 +245,13 @@
 		elif [ -f $phooks/$base ]; then
 			hook=$phooks/$base
 		fi
+		if [ -f ${STORAGEDIR}/true-excl ]; then
+		run_hook $hook true
+		IFS=${nifs}
+		else
 		run_hook $hook $2
 		IFS=${nifs}
+		fi
 	done
 	IFS=${oifs}
 	# return value is 1 if something was inhibited, 0 otherwise.