Package: hibernate Version: 1.94-2 Severity: wishlist Tags: patch It's useful if hibernate logs out Gaim in the suspend process, and logs it in back in the resume process (thus I won't appear as online minutes after I packed up my laptop:-).
I've attached a scriptlet that implements this auto logout/login. Best regards, norbi -- Package-specific info: --- configuration ==> /etc/hibernate/common.conf <== Verbosity 0 LogFile /var/log/hibernate.log LogVerbosity 1 AlwaysKill yes HibernateVT 15 Distribution debian SaveClock yes Unmount /media/* UnmountFSTypes smbfs cifs nfs ChangeGrubMenu yes GrubMenuFile /boot/grub/menu.lst FullSpeedCPU yes LockXScreenSaver yes OnResume 00 /bin/bash -c '(echo -ne "\\a\\r\\n\\r\\nWelcome back in the real world.."; for ((i=0;i<20000;i++));do :;done; echo -ne "\\a\\r\\n\\r\\n") >/dev/tty1' UnloadBlacklistedModules yes LoadModules auto DownInterfaces auto UpInterfaces auto MuteAudio yes PauseAudio yes EjectCards yes StopServices mysql StartServices microcode.ctl console-screen.sh keymap.sh alsa-utils anacron backup RestartServices laptop-mode SwitchToTextMode yes LogoutGaim yes ==> /etc/hibernate/disk.conf <== OnSuspend 00 /usr/local/sbin/wtmp -a -i hibernate -l '(disk)' -h `uname -r` suspend OnResume 00 /usr/local/sbin/wtmp -d -i hibernate -l '(disk)' -h `uname -r` suspend TryMethod ususpend-disk.conf TryMethod sysfs-disk.conf Include common.conf ==> /etc/hibernate/hibernate.conf <== OnSuspend 00 /usr/local/sbin/wtmp -a -i hibernate -l '(ram)' -h `uname -r` suspend OnResume 00 /usr/local/sbin/wtmp -d -i hibernate -l '(ram)' -h `uname -r` suspend OnResume 99 /usr/local/sbin/video_post TryMethod ususpend-ram.conf TryMethod sysfs-ram.conf Include common.conf ==> /etc/hibernate/obsolete-hibernate-to-disk.conf <== UseSysfsPowerState disk PowerdownMethod shutdown Verbosity 0 LogFile /var/log/hibernate.log LogVerbosity 1 SwsuspVT 15 Distribution debian SaveClock yes IncompatibleDevices /dev/dsp* /dev/snd/* /dev/video* Unmount /media/* UnmountFSTypes smbfs cifs nfs ChangeGrubMenu yes GrubMenuFile /boot/grub/menu.lst OnResume 99 /usr/local/sbin/video_post OnResume 00 /bin/bash -c '(echo -ne "\\a\\r\\n\\r\\nWelcome back in the real world.."; for ((i=0;i<20000;i++));do :;done; echo -ne "\\a\\r\\n\\r\\n") >/dev/tty1' UnloadBlacklistedModules yes LoadModules auto DownInterfaces auto UpInterfaces auto StopServices mysql StartServices microcode.ctl laptop-mode console-screen.sh keymap.sh alsa-utils anacron backup RestartServices dmesg cpufreqd SwitchToTextMode yes LockKDE yes LockGnomeScreenSaver yes LockXScreenSaver yes LockXLock yes LockXAutoLock yes MuteAudio yes PauseAudio yes FullSpeedCPU yes EjectCards yes ==> /etc/hibernate/obsolete-suspend-to-ram.conf <== UseSysfsPowerState mem PowerdownMethod shutdown Include common.conf ==> /etc/hibernate/ram.conf <== OnSuspend 00 /usr/local/sbin/wtmp -a -i hibernate -l '(ram)' -h `uname -r` suspend OnResume 00 /usr/local/sbin/wtmp -d -i hibernate -l '(ram)' -h `uname -r` suspend OnResume 99 /usr/local/sbin/video_post TryMethod ususpend-ram.conf TryMethod sysfs-ram.conf Include common.conf ==> /etc/hibernate/suspend2.conf <== UseSuspend2 yes Reboot no EnableEscape yes DefaultConsoleLevel 1 Compressor lzf Encryptor none FullSpeedCPU yes Include common.conf ==> /etc/hibernate/sysfs-disk.conf <== UseSysfsPowerState disk PowerdownMethod shutdown ==> /etc/hibernate/sysfs-ram.conf <== UseSysfsPowerState mem PowerdownMethod shutdown ==> /etc/hibernate/ususpend-both.conf <== USuspendMethod both ==> /etc/hibernate/ususpend-disk.conf <== USuspendMethod disk ==> /etc/hibernate/ususpend-ram.conf <== USuspendMethod ram --- /sys/power ==> /sys/power/disk <== shutdown ==> /sys/power/image_size <== 524288000 ==> /sys/power/resume <== 3:2 ==> /sys/power/state <== mem disk --- log hibernate.log file not readable. -- System Information: Debian Release: 4.0 APT prefers oldstable APT policy: (500, 'oldstable'), (500, 'stable') Architecture: i386 (i686) Shell: /bin/sh linked to /bin/bash Kernel: Linux 2.6.18 Locale: LANG=C, LC_CTYPE=hu_HU (charmap=ISO-8859-2) Versions of packages hibernate depends on: ii console-tools 1:0.2.3dbs-65 Linux console and font utilities Versions of packages hibernate recommends: ii dash 0.5.3-7 The Debian Almquist Shell ii hdparm 6.9-2 tune hard disk parameters for high pn uswsusp <none> (no description available) ii vbetool 0.7-1.1 run real-mode video BIOS code to a -- debconf-show failed
# -*- sh -*- # vim:ft=sh:ts=8:sw=4:noet # $Id: gaim 331 2007-06-03 15:31:24Z mendel $ gaim_remote=$(command -v gaim-remote) AddConfigHandler GaimOptions AddConfigHelp "LogoutGaim <boolean>" "Changes all locally running Gaim's status to offline before suspending, and change it back to the original state after resuming." # Gets the value of the environment variable with the given name of the process with the given PID. get_env_var_of_process() { local pid="$1" envvar="$2" tr '\0' '\n' </proc/$pid/environ | sed -ne 's/^'"$envvar"'=\(.*\)$/\1/p' } LogoutGaim() { [ x"$LOGOUT_GAIM" != "x1" ] && return 0 if [ -z "$gaim_remote" ] || [ ! -x "$gaim_remote" ]; then vecho 0 'Cannot log out Gaim: `gaim-remote` not found.' return 0 fi local pid i=0 for pid in `pidof gaim`; do local user dbus_session_bus_address gaim_status saved_status_id status_type user=$(get_env_var_of_process $pid USER) dbus_session_bus_address=$(get_env_var_of_process $pid DBUS_SESSION_BUS_ADDRESS) vecho 2 "Saving status of $user's Gaim using D-Bus session bus address $dbus_session_bus_address" # gaim-remote (as of 2.0.0beta5) does not support the 'getstatus' command, so we do it manually saved_status_id=$(DBUS_SESSION_BUS_ADDRESS="$dbus_session_bus_address" su "$user" -c "$gaim_remote 'GaimSavedstatusGetCurrent'") status_type=$(DBUS_SESSION_BUS_ADDRESS="$dbus_session_bus_address" su "$user" -c "$gaim_remote 'GaimSavedstatusGetType?saved_status=$saved_status_id'") gaim_status=$(DBUS_SESSION_BUS_ADDRESS="$dbus_session_bus_address" su "$user" -c "$gaim_remote 'GaimPrimitiveGetIdFromType?type=$status_type'") # using this eval-crap to be POSIX-compliant (arrays are nonstandard) eval "GAIM_LOGGED_OUT_SESSIONS_USER_$i='$user'" eval "GAIM_LOGGED_OUT_SESSIONS_DBUS_$i='$dbus_session_bus_address'" eval "GAIM_LOGGED_OUT_SESSIONS_STATUS_$i='$gaim_status'" i=`expr $i + 1` vecho 2 "Logging out $user's Gaim using D-Bus session bus address $dbus_session_bus_address" DBUS_SESSION_BUS_ADDRESS="$dbus_session_bus_address" su "$user" -c "$gaim_remote 'setstatus?status=offline&message=My computer hibernated.'" done return 0 } LoginGaim() { [ x"$LOGOUT_GAIM" != "x1" ] && return 0 if [ -z "$gaim_remote" ] || [ ! -x "$gaim_remote" ]; then vecho 0 'Cannot log on Gaim: `gaim-remote` not found.' return 0 fi local i=0 while :; do local user dbus_session_bus_address gaim_status user=`eval "echo \\\$GAIM_LOGGED_OUT_SESSIONS_USER_$i"` dbus_session_bus_address=`eval "echo \\\$GAIM_LOGGED_OUT_SESSIONS_DBUS_$i"` gaim_status=`eval "echo \\\$GAIM_LOGGED_OUT_SESSIONS_STATUS_$i"` i=`expr $i + 1` [ -z "$user" ] && break vecho 2 "Logging back (to status $gaim_status) $user's Gaim using D-Bus session bus address $dbus_session_bus_address" DBUS_SESSION_BUS_ADDRESS="$dbus_session_bus_address" su "$user" -c "$gaim_remote 'setstatus?status=$gaim_status&message=My computer resumed from hibernation.'" done return 0 } GaimOptions() { case "$1" in logoutgaim) if BoolIsOn "$1" "$2"; then LOGOUT_GAIM=1 if [ -z "$GAIMLOGOUT_HOOKED" ]; then AddSuspendHook 19 LogoutGaim AddResumeHook 19 LoginGaim GAIMLOGOUT_HOOKED=1 fi else LOGOUT_GAIM=0 fi ;; *) return 1 ;; esac }