Hi, I finally found the culprit which caused the strange behaviour under Debian. In Debian awk is installed under /usr/bin, so the parsing of the commandline at the end of the script helper_functions fails and as a consequence scripts/notify returns the wrong EVENT_TYPE on a battery.warning message. This causes powersaved to generate an Notification and because of the failed parsing the EVENT_TYPE is empty. awk_path.diff fixes this, it is made against the current SVN.
About the su issue under gentoo, please don't use the patch I sent in my previous email, but the su.diff file I attached to this email. Finally my modifications to wttyhx (missing -n under !SUSE distros, path to Xorg under Gentoo) in the wttyhx.diff patch. Would it have any ill effects under SUSE if the -n switch is removed? I also noticed that the path to xmessage in x_helper_functions is hardcoded to /usr/X11R6/bin/xmessage. This is unsafe, as I mentioned in my previous post the new modular Xorg will abandon /usr/X11R6. Either use no absolute path at all or something like the following: XMESSAGE_BIN=/usr/X11R6/bin/xmessage [ -x "$XMESSAGE_BIN" ] || XMESSAGE="/usr/bin/xmessage" Cheers, Michael -- Why is it that all of the instruments seeking intelligent life in the universe are pointed away from Earth?
Index: scripts/helper_functions
===================================================================
--- scripts/helper_functions (Revision 1643)
+++ scripts/helper_functions (Arbeitskopie)
@@ -276,7 +276,7 @@
_IFS="$IFS"
IFS="."
K_V=($VERSION) # perform word splitting at $IFS, put into array(!) $K_V.
-read EVENT_TYPE EVENT_SUBTYPE EVENT_EXT < <(echo "$1" |/bin/awk -F/ '{print toupper($1);}')
+read EVENT_TYPE EVENT_SUBTYPE EVENT_EXT < <(echo "$1" | awk -F/ '{print toupper($1);}')
# set IFS back or we will get trouble at the next read!
IFS="$_IFS"
K_RELEASE="${K_V[0]}.${K_V[1]}"
Index: scripts/x_helper_functions
===================================================================
--- scripts/x_helper_functions (Revision 1643)
+++ scripts/x_helper_functions (Arbeitskopie)
@@ -45,7 +45,7 @@
i=0
KDE_RUNNING[$i]=false
while read X_USERS[$i] DISPS[$i] DUMMY; do
- su ${X_USERS[$i]} -c "DISPLAY=${DISPS[$i]} $KDE_BINDIR/dcopfind kdesktop >/dev/null 2>&1" && \
+ su - ${X_USERS[$i]} -c "DISPLAY=${DISPS[$i]} $KDE_BINDIR/dcopfind kdesktop >/dev/null 2>&1" && \
KDE_RUNNING[$i]=true
let i++
done < <($WTTYHX -a)
@@ -79,7 +79,7 @@
check_x_access(){
local RET
[ -n "$X_USER" -a -n "$DISP" ] || return 1
- su $X_USER -s /bin/bash -c "DISPLAY=$DISP xset q > /dev/null"
+ su - $X_USER -c "DISPLAY=$DISP xset q > /dev/null"
RET=$?
return $RET
}
@@ -103,7 +103,7 @@
esac
get_x_user
if check_x_access; then
- su $X_USER -s /bin/bash -c "DISPLAY=$DISP $XMESSAGE_BIN -center -fn \
+ su - $X_USER -c "DISPLAY=$DISP $XMESSAGE_BIN -center -fn \
'-misc-fixed-bold-r-*-*-18-*-*-*-*-*-iso10646-1' $ARG\
'`echo $MESSAGE|fmt -w 60 `' $WAIT" # we re-format it to 60 chars
RET=$?
@@ -132,7 +132,7 @@
esac
get_x_user
[ "$X_USER" -a -n "$DISP" ] && \
- su $X_USER -s /bin/bash -c "DISPLAY=$DISP $KDIALOG_BIN $ARG \"$MSG\" $WAIT"
+ su - $X_USER -c "DISPLAY=$DISP $KDIALOG_BIN $ARG \"$MSG\" $WAIT"
return $?
}
@@ -154,7 +154,7 @@
esac
get_x_user
if check_x_access; then
- su $X_USER -s /bin/bash -c "DISPLAY=$DISP $ZENITY_BIN $ARG --text=\"$MSG\" $WAIT"
+ su - $X_USER -c "DISPLAY=$DISP $ZENITY_BIN $ARG --text=\"$MSG\" $WAIT"
return $?
else
return 255
Index: scripts/do_screen_saver
===================================================================
--- scripts/do_screen_saver (Revision 1643)
+++ scripts/do_screen_saver (Arbeitskopie)
@@ -42,7 +42,7 @@
get_x_user
[ "$SCREENSAVER_BLANKONLY" == "yes" ] && LOCK_MODE="-mode blank"
- [ -n "$X_USER" -a -n "$DISP" ] && su $X_USER -s /bin/bash -c "$DPMS xlock $LOCK_MODE -display $DISP &"
+ [ -n "$X_USER" -a -n "$DISP" ] && su - $X_USER -c "$DPMS xlock $LOCK_MODE -display $DISP &"
if [ $? != "0" ]; then
DEBUG "xlock failed for user '$X_USER'" DIAG
return 1
@@ -69,7 +69,7 @@
LOCK_MODE2="$DEE_LOCK setBlankonly false;"
}
- [ -n "$X_USER" -a -n "$DISP" ] && su $X_USER -s /bin/bash -c \
+ [ -n "$X_USER" -a -n "$DISP" ] && su - $X_USER -c \
"$DPMS $LOCK_MODE $KDE_LOCK lock; X=\$?; $LOCK_MODE2 exit \$X"
if [ $? != "0" ]; then
DEBUG "Could not activate KDE screen saver." DIAG
@@ -87,7 +87,7 @@
[ "$SCREENSAVER_BLANKONLY" == "yes" ] && \
LOCK_MODE="xscreensaver-command -display $DISP -throttle &&"
- [ -n "$X_USER" -a -n "$DISP" ] && su $X_USER -s /bin/bash -c \
+ [ -n "$X_USER" -a -n "$DISP" ] && su - $X_USER -c \
"$DPMS $LOCK_MODE xscreensaver-command -display $DISP -lock"
if [ $? != "0" ]; then
DEBUG "Could not activate xscreensaver." DIAG
Index: scripts/wm_logout
===================================================================
--- scripts/wm_logout (Revision 1643)
+++ scripts/wm_logout (Arbeitskopie)
@@ -27,7 +27,7 @@
get_x_user
DEBUG "Logging out of kde for user: $X_USER" INFO
-[ -n "$X_USER" -a -n "$DISP" ] && su $X_USER -s /bin/bash -c "DISPLAY=$DISP $KDE_BINDIR/dcop ksmserver ksmserver logout 0 0 0"
+[ -n "$X_USER" -a -n "$DISP" ] && su - $X_USER -c "DISPLAY=$DISP $KDE_BINDIR/dcop ksmserver ksmserver logout 0 0 0"
if [ $? != "0" ]; then
DEBUG "Could not log out user '$X_USER' out of KDE display '$DISP'." DIAG
$SCRIPT_RETURN $EV_ID 1 "Could not log out user $X_USER out of KDE display $DISP"
Index: scripts/wm_shutdown
===================================================================
--- scripts/wm_shutdown (Revision 1643)
+++ scripts/wm_shutdown (Arbeitskopie)
@@ -35,7 +35,7 @@
save_gnome_session(){
get_x_user
DEBUG "Save GNOME session for user: $X_USER" INFO
- [ -n "$X_USER" -a -n "$DISP" ] && su $X_USER -s /bin/bash -c "DISPLAY=$DISP $GNOME_BINDIR/gnome-session-save"
+ [ -n "$X_USER" -a -n "$DISP" ] && su - $X_USER -c "DISPLAY=$DISP $GNOME_BINDIR/gnome-session-save"
[ $? != "0" ] && DEBUG "Could not log out user '$X_USER' out of GNOME display '$DISP'." DIAG
}
@@ -44,7 +44,7 @@
get_x_user
DEBUG "Shutting down kde for user: $X_USER" INFO
- [ -n "$X_USER" -a -n "$DISP" ] && su $X_USER -s /bin/bash -c "DISPLAY=$DISP $KDE_BINDIR/dcop ksmserver ksmserver logout 0 2 2"
+ [ -n "$X_USER" -a -n "$DISP" ] && su - $X_USER -c "DISPLAY=$DISP $KDE_BINDIR/dcop ksmserver ksmserver logout 0 2 2"
if [ $? != "0" ]; then
DEBUG "Could not shut down KDE for user '$X_USER'." DIAG
return 1;
Index: scripts/wttyhx =================================================================== --- scripts/wttyhx (Revision 1643) +++ scripts/wttyhx (Arbeitskopie) @@ -95,6 +95,7 @@ case "$BIN" in /usr/X11R6/bin/XFree86) VERSION[$n]=4 ;; /usr/X11R6/bin/Xorg) VERSION[$n]=4 ;; + /usr/bin/Xorg) VERSION[$n]=4 ;; /usr/X11R6/bin/X) VERSION[$n]=3 ;; *) continue ;; esac @@ -119,7 +120,7 @@ # id at several places and then take the user with the highest uid. while read USER D R; do test "$D" = "$DISP" && break - done < <(w -hn | sed -n 's#^\([^ ]*\).* :\([0-9]\+\).*$#\1 \2#p') + done < <(w -h | sed -n 's#^\([^ ]*\).* :\([0-9]\+\).*$#\1 \2#p') USER_W[$n]=$USER; UID_W[$n]=`id -u $USER 2>/dev/null` while read TAG U0 U1 U2 U3 R; do if [ "$TAG" = "Uid:" ] ; then
signature.asc
Description: OpenPGP digital signature
_______________________________________________ powersave-devel mailing list [email protected] http://forge.novell.com/mailman/listinfo/powersave-devel
