From 09d852e44efbcedd955ee6f74afefba5af712c0c Mon Sep 17 00:00:00 2001 From: Ghost1227 Date: Sat, 21 Nov 2009 15:25:52 -0600 Subject: [PATCH] Added suspend option --- CHANGELOG | 7 +++++++ src/cdm | 15 ++++++++++++--- src/cdmrc | 6 ++++++ 3 files changed, 25 insertions(+), 3 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index fc8f662..c9c1ec8 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -14,3 +14,10 @@ Version 0.3 (2009-11-18) - Fixed an issue with allowshutdown off and allowconsole on - Code cleanup (thanks Brisbin33) - Fixed issue with profile.d execution order + +Version 0.3.1 (2009-11-20) + - Added failsafe to startup script that overrides execution if + logged in as root + +Version 0.3.2 (2009-11-21) + - Added suspend option diff --git a/src/cdm b/src/cdm index 00fd386..3b3e9ef 100755 --- a/src/cdm +++ b/src/cdm @@ -24,7 +24,7 @@ # MA 02110-1301, USA. name="Console Display Manager" -ver="0.3.1" +ver="0.3.2" info="\e[1;34m==>\e[1;37m" error="\e[1;31m==>\e[1;37m" success="\e[1;32m==>\e[1;37m" @@ -140,19 +140,28 @@ mainmenu() { } shutdownmenu() { + haltmenu="0 Shutdown 1 Reboot" + + # Check if suspend is enabled + if [[ ${allowsuspend} == "yes" ]]; then + haltmenu=$(echo -n "${haltmenu} 2 Suspend ") + fi + # Display shutdown dialog haltopt=$( dialog --colors --backtitle "${name} v${ver}" --stdout \ --ok-label " Select " --cancel-label " Cancel " \ - --menu "Shutdown" 0 0 0 0 Shutdown 1 Reboot + --menu "Shutdown" 0 0 0 ${haltmenu} ) if [[ $? == 0 ]]; then clear if [[ ${haltopt} -eq 0 ]]; then ${shutdowncommand} - else + elif [[ ${haltopt} -eq 1 ]]; then ${rebootcommand} + else + ${suspendcommand} fi else mainmenu diff --git a/src/cdmrc b/src/cdmrc index b12f0cf..c400050 100644 --- a/src/cdmrc +++ b/src/cdmrc @@ -19,6 +19,12 @@ allowshutdown=yes shutdowncommand='sudo shutdown -h now' rebootcommand='sudo shutdown -r now' +# Allow suspend? +# Note that this option requires pm-utils +# to be installed and properly configured. +allowsuspend=yes +suspendcommand='sudo pm-suspend' + # Set configuration for specific users? userconfig=(courtney)