diff -ur powersave-0.11.0.orig/scripts/do_screen_saver powersave-0.11.0/scripts/do_screen_saver --- powersave-0.11.0.orig/scripts/do_screen_saver 2006-01-09 12:05:22.000000000 +0100 +++ powersave-0.11.0/scripts/do_screen_saver 2006-01-09 12:10:20.000000000 +0100 @@ -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 diff -ur powersave-0.11.0.orig/scripts/helper_functions powersave-0.11.0/scripts/helper_functions --- powersave-0.11.0.orig/scripts/helper_functions 2006-01-09 12:05:22.000000000 +0100 +++ powersave-0.11.0/scripts/helper_functions 2006-01-09 12:10:20.000000000 +0100 @@ -257,7 +257,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]}" diff -ur powersave-0.11.0.orig/scripts/wm_logout powersave-0.11.0/scripts/wm_logout --- powersave-0.11.0.orig/scripts/wm_logout 2006-01-09 12:05:22.000000000 +0100 +++ powersave-0.11.0/scripts/wm_logout 2006-01-09 12:10:20.000000000 +0100 @@ -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" diff -ur powersave-0.11.0.orig/scripts/wm_shutdown powersave-0.11.0/scripts/wm_shutdown --- powersave-0.11.0.orig/scripts/wm_shutdown 2006-01-09 12:05:22.000000000 +0100 +++ powersave-0.11.0/scripts/wm_shutdown 2006-01-09 12:10:20.000000000 +0100 @@ -1,4 +1,5 @@ -#!/bin/bash ############################################################### +#!/bin/bash +########################################################################### # # # Powersave Daemon # # # @@ -34,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 } @@ -43,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; diff -ur powersave-0.11.0.orig/scripts/wttyhx powersave-0.11.0/scripts/wttyhx --- powersave-0.11.0.orig/scripts/wttyhx 2006-01-09 12:05:22.000000000 +0100 +++ powersave-0.11.0/scripts/wttyhx 2006-01-09 12:10:20.000000000 +0100 @@ -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 diff -ur powersave-0.11.0.orig/scripts/x_helper_functions powersave-0.11.0/scripts/x_helper_functions --- powersave-0.11.0.orig/scripts/x_helper_functions 2006-01-09 12:05:22.000000000 +0100 +++ powersave-0.11.0/scripts/x_helper_functions 2006-01-09 12:10:20.000000000 +0100 @@ -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