GNOME Bugzilla – Bug 542542
Don't offer hibernate choice if no swap
Last modified: 2009-01-22 23:46:38 UTC
If there are no swap partitions, GDM probably shouldn't offer the choice to hibernate. I'm attaching a patch that checks /proc/swaps for partitions and doesn't show the menu option if there are none. Two things: (A) This patch is a little janky in that it relies on the format of /proc/swaps. I didn't find a better way to programatically ask the kernel about swaps. I believe the /proc/swaps format is stable? (B) It would be nicer to use HAL to ask the system if it can hibernate. We could check power_management.can_hibernate which tells us if hibernation support is even compiled into the kernel. And we could iterate over the volumes, checking the fstype of each for "swap" -- a cleaner way to check for swaps. So, HAL would be cleaner, but much more involved. Here's the quick and dirty patch anyway.
Created attachment 114393 [details] [review] /proc/swaps patch
the hibernate changes are ubuntu specific