From 760ff8acf8370c13a64b7368d5c8db85341955ae Mon Sep 17 00:00:00 2001 From: Ghost1227 Date: Wed, 18 Nov 2009 23:15:34 -0600 Subject: [PATCH] Several bug fixes, read changelog for details. --- CHANGELOG | 6 ++++++ src/cdm | 30 +++++++++++++++++++----------- 2 files changed, 25 insertions(+), 11 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index f5a9568..fc8f662 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -8,3 +8,9 @@ Version 0.1b (2009-11-09) Version 0.2 (2009-11-10) - Added shutdown option - Added ability to set login shell (fix for some foreign layouts) + +Version 0.3 (2009-11-18) + - Fixed X incrementing function (thanks Andrwe) + - Fixed an issue with allowshutdown off and allowconsole on + - Code cleanup (thanks Brisbin33) + - Fixed issue with profile.d execution order diff --git a/src/cdm b/src/cdm index 6275a2c..19ba3de 100755 --- a/src/cdm +++ b/src/cdm @@ -4,6 +4,9 @@ # # Copyright (C) 2009, Daniel J Griffiths # Thanks to: +# Andrwe..........beta-testing and submitting the fix for the all +# important X incrementation function +# brisbin33.......code cleanup # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -61,11 +64,11 @@ fi # otherwise, increment. if [[ ${locktty} == "yes" ]]; then # Verify display exists - if `echo ""${display}"" | grep [^0-9] &> /dev/null`; then + if [ -n "${display//[0-9]/}" ]; then display=0 fi # Activate existing X session - if [[ `xdpyinfo -display :${display}.0 &> /dev/null` != "1" ]]; then + if xdpyinfo -display :${display}.0 &> /dev/null; then let tty=${display}+${xtty} chvt ${tty} exit 0 @@ -73,8 +76,8 @@ if [[ ${locktty} == "yes" ]]; then else # Get the first empty display display=0 - while ${display} < 7; do - if [[ `xdpyinfo -display :${display}.0 &> /dev/null` != "1" ]]; then + while [ ${display} -lt 7 ]; do + if xdpyinfo -display :${display}.0 &> /dev/null; then let display=${display}+1 else break @@ -94,6 +97,9 @@ mainmenu() { # Check if console access is allowed if [[ ${allowconsole} == "yes" ]]; then + if [[ ${allowshutdown} != "yes" ]]; then + let halt=99 + fi let console=${#wmdisplist[@]} menu=$(echo -ne "${menu} ${console} Console ") fi @@ -106,10 +112,12 @@ mainmenu() { let halt=${#wmdisplist[@]}+1 fi menu=$(echo -ne "${menu} ${halt} Shutdown ") - fi + fi + + echo "halt=${halt} console=${console} wm='${wm}'" > ~/cdm.tmp # Override dialog display if only one option is available - if [[ ${allowconsole} != "yes" ]] && [[ ${#wmdisplist[@]} == 1 ]]; then + if [[ ${allowconsole} != "yes" ]] && [[ ${allowshutdown} != "yes" ]] && [[ ${#wmdisplist[@]} == 1 ]]; then wm=${wmbinlist[@]} else # Display selection dialog @@ -159,14 +167,14 @@ shutdownmenu() { xstart() { # Start X - if [[ ${loginshell} == "yes" ]]; then - if [[ ${wm_bin} == "gnome-session" ]]; then - exec bash --login -c startx /usr/share/cdm/xinitrc -- :${display} &> /dev/null & + if [ ${loginshell} == "yes" ]; then + if [ ${wm_bin} == "gnome-session" ]; then + exec bash --login -c "startx /usr/share/cdm/xinitrc -- :${display} &> /dev/null" & else - exec ck-launch-session bash --login -c startx /usr/share/cdm/xinitrc -- :${display} &> /dev/null & + exec ck-launch-session bash --login -c "startx /usr/share/cdm/xinitrc -- :${display} &> /dev/null" & fi else - if [[ ${wm_bin} == "gnome-session" ]]; then + if [ ${wm_bin} == "gnome-session" ]; then exec startx /usr/share/cdm/xinitrc -- :${display} &> /dev/null & else exec ck-launch-session startx /usr/share/cdm/xinitrc -- :${display} &> /dev/null &