Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 122278 | Differences between
and this patch

Collapse All | Expand All

(-)powersave-0.11.0.orig/scripts/do_screen_saver (-3 / +3 lines)
Lines 42-48 Link Here
42
    get_x_user
42
    get_x_user
43
    [ "$SCREENSAVER_BLANKONLY" == "yes" ] && LOCK_MODE="-mode blank"
43
    [ "$SCREENSAVER_BLANKONLY" == "yes" ] && LOCK_MODE="-mode blank"
44
44
45
    [ -n "$X_USER" -a -n "$DISP" ] && su $X_USER -s /bin/bash -c "$DPMS xlock $LOCK_MODE -display $DISP &"
45
    [ -n "$X_USER" -a -n "$DISP" ] && su - $X_USER -c "$DPMS xlock $LOCK_MODE -display $DISP &"
46
    if [ $? != "0" ]; then
46
    if [ $? != "0" ]; then
47
	DEBUG "xlock failed for user '$X_USER'" DIAG
47
	DEBUG "xlock failed for user '$X_USER'" DIAG
48
	return 1
48
	return 1
Lines 69-75 Link Here
69
        LOCK_MODE2="$DEE_LOCK setBlankonly false;"
69
        LOCK_MODE2="$DEE_LOCK setBlankonly false;"
70
    }
70
    }
71
71
72
    [ -n "$X_USER" -a -n "$DISP" ] && su $X_USER -s /bin/bash -c \
72
    [ -n "$X_USER" -a -n "$DISP" ] && su - $X_USER -c \
73
        "$DPMS $LOCK_MODE $KDE_LOCK lock; X=\$?; $LOCK_MODE2 exit \$X"
73
        "$DPMS $LOCK_MODE $KDE_LOCK lock; X=\$?; $LOCK_MODE2 exit \$X"
74
    if [ $? != "0" ]; then
74
    if [ $? != "0" ]; then
75
        DEBUG "Could not activate KDE screen saver." DIAG
75
        DEBUG "Could not activate KDE screen saver." DIAG
Lines 87-93 Link Here
87
    [ "$SCREENSAVER_BLANKONLY" == "yes" ] && \
87
    [ "$SCREENSAVER_BLANKONLY" == "yes" ] && \
88
        LOCK_MODE="xscreensaver-command -display $DISP -throttle &&"
88
        LOCK_MODE="xscreensaver-command -display $DISP -throttle &&"
89
89
90
    [ -n "$X_USER" -a -n "$DISP" ] && su $X_USER -s /bin/bash -c \
90
    [ -n "$X_USER" -a -n "$DISP" ] && su - $X_USER -c \
91
        "$DPMS $LOCK_MODE xscreensaver-command -display $DISP -lock"
91
        "$DPMS $LOCK_MODE xscreensaver-command -display $DISP -lock"
92
    if [ $? != "0" ]; then
92
    if [ $? != "0" ]; then
93
        DEBUG "Could not activate xscreensaver." DIAG
93
        DEBUG "Could not activate xscreensaver." DIAG
(-)powersave-0.11.0.orig/scripts/helper_functions (-1 / +1 lines)
Lines 257-263 Link Here
257
_IFS="$IFS"
257
_IFS="$IFS"
258
IFS="."
258
IFS="."
259
K_V=($VERSION) # perform word splitting at $IFS, put into array(!) $K_V.
259
K_V=($VERSION) # perform word splitting at $IFS, put into array(!) $K_V.
260
read EVENT_TYPE EVENT_SUBTYPE EVENT_EXT < <(echo "$1" |/bin/awk -F/ '{print toupper($1);}')
260
read EVENT_TYPE EVENT_SUBTYPE EVENT_EXT < <(echo "$1" | awk -F/ '{print toupper($1);}')
261
# set IFS back or we will get trouble at the next read!
261
# set IFS back or we will get trouble at the next read!
262
IFS="$_IFS"
262
IFS="$_IFS"
263
K_RELEASE="${K_V[0]}.${K_V[1]}"
263
K_RELEASE="${K_V[0]}.${K_V[1]}"
(-)powersave-0.11.0.orig/scripts/wm_logout (-1 / +1 lines)
Lines 27-33 Link Here
27
27
28
get_x_user
28
get_x_user
29
DEBUG "Logging out of kde for user: $X_USER" INFO
29
DEBUG "Logging out of kde for user: $X_USER" INFO
30
[ -n "$X_USER" -a -n "$DISP" ] && su $X_USER -s /bin/bash -c "DISPLAY=$DISP $KDE_BINDIR/dcop ksmserver ksmserver logout 0 0 0"
30
[ -n "$X_USER" -a -n "$DISP" ] && su - $X_USER -c "DISPLAY=$DISP $KDE_BINDIR/dcop ksmserver ksmserver logout 0 0 0"
31
if [ $? != "0" ]; then
31
if [ $? != "0" ]; then
32
    DEBUG "Could not log out user '$X_USER' out of KDE display '$DISP'." DIAG
32
    DEBUG "Could not log out user '$X_USER' out of KDE display '$DISP'." DIAG
33
    $SCRIPT_RETURN $EV_ID 1 "Could not log out user $X_USER out of KDE display $DISP"
33
    $SCRIPT_RETURN $EV_ID 1 "Could not log out user $X_USER out of KDE display $DISP"
(-)powersave-0.11.0.orig/scripts/wm_shutdown (-3 / +4 lines)
Lines 1-4 Link Here
1
#!/bin/bash ###############################################################
1
#!/bin/bash
2
###########################################################################
2
#                                                                         #
3
#                                                                         #
3
#                         Powersave Daemon                                #
4
#                         Powersave Daemon                                #
4
#                                                                         #
5
#                                                                         #
Lines 34-40 Link Here
34
save_gnome_session(){
35
save_gnome_session(){
35
    get_x_user
36
    get_x_user
36
    DEBUG "Save GNOME session for user: $X_USER" INFO
37
    DEBUG "Save GNOME session for user: $X_USER" INFO
37
    [ -n "$X_USER" -a -n "$DISP" ] && su $X_USER -s /bin/bash -c "DISPLAY=$DISP $GNOME_BINDIR/gnome-session-save"
38
    [ -n "$X_USER" -a -n "$DISP" ] && su - $X_USER -c "DISPLAY=$DISP $GNOME_BINDIR/gnome-session-save"
38
    [ $? != "0" ] && DEBUG "Could not log out user '$X_USER' out of GNOME display '$DISP'." DIAG
39
    [ $? != "0" ] && DEBUG "Could not log out user '$X_USER' out of GNOME display '$DISP'." DIAG
39
}
40
}
40
41
Lines 43-49 Link Here
43
44
44
    get_x_user
45
    get_x_user
45
    DEBUG "Shutting down kde for user: $X_USER" INFO
46
    DEBUG "Shutting down kde for user: $X_USER" INFO
46
    [ -n "$X_USER" -a -n "$DISP" ] && su $X_USER -s /bin/bash -c "DISPLAY=$DISP $KDE_BINDIR/dcop ksmserver ksmserver logout 0 2 2"
47
    [ -n "$X_USER" -a -n "$DISP" ] && su - $X_USER -c "DISPLAY=$DISP $KDE_BINDIR/dcop ksmserver ksmserver logout 0 2 2"
47
    if [ $? != "0" ]; then
48
    if [ $? != "0" ]; then
48
        DEBUG "Could not shut down KDE for user '$X_USER'." DIAG
49
        DEBUG "Could not shut down KDE for user '$X_USER'." DIAG
49
        return 1;
50
        return 1;
(-)powersave-0.11.0.orig/scripts/wttyhx (-1 / +2 lines)
Lines 95-100 Link Here
95
	case "$BIN" in
95
	case "$BIN" in
96
		/usr/X11R6/bin/XFree86) VERSION[$n]=4 ;;
96
		/usr/X11R6/bin/XFree86) VERSION[$n]=4 ;;
97
		/usr/X11R6/bin/Xorg)    VERSION[$n]=4 ;;
97
		/usr/X11R6/bin/Xorg)    VERSION[$n]=4 ;;
98
		/usr/bin/Xorg)		VERSION[$n]=4 ;;
98
		/usr/X11R6/bin/X)       VERSION[$n]=3 ;;
99
		/usr/X11R6/bin/X)       VERSION[$n]=3 ;;
99
		*)                      continue      ;;
100
		*)                      continue      ;;
100
	esac
101
	esac
Lines 119-125 Link Here
119
	# id at several places and then take the user with the highest uid.
120
	# id at several places and then take the user with the highest uid.
120
	while read USER D R; do
121
	while read USER D R; do
121
		test "$D" = "$DISP" && break
122
		test "$D" = "$DISP" && break
122
	done < <(w -hn | sed -n 's#^\([^ ]*\).* :\([0-9]\+\).*$#\1 \2#p')
123
	done < <(w -h | sed -n 's#^\([^ ]*\).* :\([0-9]\+\).*$#\1 \2#p')
123
	USER_W[$n]=$USER; UID_W[$n]=`id -u $USER 2>/dev/null`
124
	USER_W[$n]=$USER; UID_W[$n]=`id -u $USER 2>/dev/null`
124
	while read TAG U0 U1 U2 U3 R; do
125
	while read TAG U0 U1 U2 U3 R; do
125
		if [ "$TAG" = "Uid:" ] ; then
126
		if [ "$TAG" = "Uid:" ] ; then
(-)powersave-0.11.0.orig/scripts/x_helper_functions (-5 / +5 lines)
Lines 45-51 Link Here
45
    i=0
45
    i=0
46
    KDE_RUNNING[$i]=false
46
    KDE_RUNNING[$i]=false
47
    while read X_USERS[$i] DISPS[$i] DUMMY; do
47
    while read X_USERS[$i] DISPS[$i] DUMMY; do
48
      su ${X_USERS[$i]} -c "DISPLAY=${DISPS[$i]} $KDE_BINDIR/dcopfind kdesktop >/dev/null 2>&1" && \
48
      su - ${X_USERS[$i]} -c "DISPLAY=${DISPS[$i]} $KDE_BINDIR/dcopfind kdesktop >/dev/null 2>&1" && \
49
            KDE_RUNNING[$i]=true
49
            KDE_RUNNING[$i]=true
50
      let i++
50
      let i++
51
    done < <($WTTYHX -a)
51
    done < <($WTTYHX -a)
Lines 79-85 Link Here
79
check_x_access(){
79
check_x_access(){
80
    local RET
80
    local RET
81
    [ -n "$X_USER" -a -n "$DISP" ] || return 1
81
    [ -n "$X_USER" -a -n "$DISP" ] || return 1
82
    su $X_USER -s /bin/bash -c "DISPLAY=$DISP xset q > /dev/null"
82
    su - $X_USER -c "DISPLAY=$DISP xset q > /dev/null"
83
    RET=$?
83
    RET=$?
84
    return $RET
84
    return $RET
85
}
85
}
Lines 103-109 Link Here
103
    esac
103
    esac
104
    get_x_user
104
    get_x_user
105
    if check_x_access; then
105
    if check_x_access; then
106
        su $X_USER -s /bin/bash -c "DISPLAY=$DISP $XMESSAGE_BIN -center -fn \
106
        su - $X_USER -c "DISPLAY=$DISP $XMESSAGE_BIN -center -fn \
107
            '-misc-fixed-bold-r-*-*-18-*-*-*-*-*-iso10646-1' $ARG\
107
            '-misc-fixed-bold-r-*-*-18-*-*-*-*-*-iso10646-1' $ARG\
108
            '`echo $MESSAGE|fmt -w 60 `' $WAIT"  # we re-format it to 60 chars
108
            '`echo $MESSAGE|fmt -w 60 `' $WAIT"  # we re-format it to 60 chars
109
        RET=$?
109
        RET=$?
Lines 132-138 Link Here
132
    esac
132
    esac
133
    get_x_user
133
    get_x_user
134
    [ "$X_USER" -a -n "$DISP" ] && \
134
    [ "$X_USER" -a -n "$DISP" ] && \
135
        su $X_USER -s /bin/bash -c "DISPLAY=$DISP $KDIALOG_BIN $ARG \"$MSG\" $WAIT" 
135
        su - $X_USER -c "DISPLAY=$DISP $KDIALOG_BIN $ARG \"$MSG\" $WAIT" 
136
    return $?
136
    return $?
137
}
137
}
138
138
Lines 154-160 Link Here
154
    esac
154
    esac
155
    get_x_user
155
    get_x_user
156
    if check_x_access; then
156
    if check_x_access; then
157
        su $X_USER -s /bin/bash -c "DISPLAY=$DISP $ZENITY_BIN $ARG --text=\"$MSG\" $WAIT" 
157
        su - $X_USER -c "DISPLAY=$DISP $ZENITY_BIN $ARG --text=\"$MSG\" $WAIT" 
158
        return $?
158
        return $?
159
    else
159
    else
160
	return 255
160
	return 255

Return to bug 122278