From 15e91df3e4c78b0ee0995adcdfc05bde3f0a2c56 Mon Sep 17 00:00:00 2001 From: Ghost1227 Date: Tue, 5 Jan 2010 12:05:13 -0600 Subject: [PATCH] Fixed a few stupid errors --- CHANGELOG | 3 ++ install | 1 + src/cdm | 67 ++++++++++++++++++------------------------ src/cdmrc | 16 ++++------ src/xinitrc | 4 +++ src/zzz-cdm-profile.sh | 5 ++-- 6 files changed, 45 insertions(+), 51 deletions(-) create mode 100644 src/xinitrc diff --git a/CHANGELOG b/CHANGELOG index 7d36b26..718923f 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,6 @@ +Version 0.4.1 (2010-01-05) + - Fixed several stupid mistakes on my part + Version 0.4 (2010-01-03) - Fixed CHANGELOG to better match standards - Added proper utilization of exec diff --git a/install b/install index e2c284b..d2fafd6 100755 --- a/install +++ b/install @@ -8,6 +8,7 @@ else mkdir -p /usr/{bin,share/cdm} install -m755 cdm /usr/bin/ install -Dm644 cdmrc /etc/cdmrc + install -m644 xinitrc /usr/share/cdm/ install -Dm755 zzz-cdm-profile.sh /etc/profile.d/zzz-cdm-profile.sh cp -Rf themes /usr/share/cdm/ fi diff --git a/src/cdm b/src/cdm index e359667..9e5b40e 100755 --- a/src/cdm +++ b/src/cdm @@ -8,6 +8,7 @@ # important X incrementation function # brisbin33.......code cleanup # tigrmesh........finding a critical issue with the gnome-session handler +# Profjim.........several incredibly useful patches # # 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 @@ -25,17 +26,13 @@ # MA 02110-1301, USA. name="Console Display Manager" -ver="0.4" +ver="0.4.1" info="\e[1;34m==>\e[1;37m" error="\e[1;31m==>\e[1;37m" success="\e[1;32m==>\e[1;37m" reset="\e[0m" # Ignore SIGINT (^C) and SIGTSTP (^Z) trap "" 2 20 -userclientrc=$HOME/.xinitrc -sysclientrc=/etc/X11/xinit/xinitrc -# userserverrc=$HOME/.xserverrc -# sysserverrc=/etc/X11/xinit/xserverrc # Source cdm configuration if [[ -f /etc/cdmrc ]]; then @@ -64,7 +61,6 @@ if [[ ! -z ${theme} ]]; then echo -e "${info} Theme file ${theme} is invalid, reverting to default theme.${reset}" fi fi -# Fall back on defaults if valid theme isn't found if [[ -z $DIALOGRC ]]; then if [[ -f /usr/share/cdm/themes/default ]]; then DIALOGRC=/usr/share/cdm/themes/default @@ -73,14 +69,15 @@ if [[ -z $DIALOGRC ]]; then fi fi -# Based on FreeBSD's /etc/rc.subr -# +### Based on FreeBSD's /etc/rc.subr +## # checkyesno var # Test $1 variable, and warn if not set to YES or NO. # Return 0 if it's "yes" (et al), nonzero otherwise. # to make default yes, do "checkyesno var yes" -# -checkyesno() { + +checkyesno() +{ local value=${!1} # debug "checkyesno: $1 is set to $value." if [[ -n $2 ]]; then @@ -89,18 +86,18 @@ checkyesno() { value=${value:-no} fi case $value in - # "yes", "true", "on", or "1" - [Yy][Ee][Ss]|[Tt][Rr][Uu][Ee]|[Oo][Nn]|1) - return 0 - ;; - # "no", "false", "off", or "0" - [Nn][Oo]|[Ff][Aa][Ll][Ss][Ee]|[Oo][Ff][Ff]|0) - return 1 - ;; - *) - echo "\$${1} is not set properly." >&2 - exit 1 - ;; + # "yes", "true", "on", or "1" + [Yy][Ee][Ss]|[Tt][Rr][Uu][Ee]|[Oo][Nn]|1) + return 0 + ;; + # "no", "false", "off", or "0" + [Nn][Oo]|[Ff][Aa][Ll][Ss][Ee]|[Oo][Ff][Ff]|0) + return 1 + ;; + *) + echo "\$${1} is not set properly." >&2 + exit 1 + ;; esac } @@ -165,7 +162,8 @@ mainmenu() { else # Display selection dialog wm=$( - DIALOGRC="$DIALOGRC" dialog --colors --backtitle "${name} v${ver}" --stdout \ + DIALOGRC="$DIALOGRC" dialog --colors \ + --backtitle "${name} v${ver}" --stdout \ --ok-label " Select " --cancel-label " Logout " \ --menu "Select Window Manager" 0 0 0 ${menu} ) @@ -202,9 +200,10 @@ shutdownmenu() { # Display shutdown dialog haltopt=$( - DIALOGRC="$DIALOGRC" dialog --colors --backtitle "${name} v${ver}" --stdout \ - --ok-label " Select " --cancel-label " Cancel " \ - --menu "Shutdown" 0 0 0 ${haltmenu} + DIALOGRC="$DIALOGRC" dialog --colors \ + --backtitle "${name} v${ver}" --stdout \ + --ok-label " Select " --cancel-label " Cancel " \ + --menu "Shutdown" 0 0 0 ${haltmenu} ) if [[ $? == 0 ]]; then @@ -223,27 +222,19 @@ shutdownmenu() { xstart() { # Start X - if $(checkyesno usexinit); then - if [[ -f $userclientrc ]]; then - wm_bin="$userclientrc $wm_bin" - elif [[ -f $sysclientrc ]]; then - wm_bin="$sysclientrc $wm_bin" - fi - fi - serverargs=":${display} ${serverargs} vt$((xtty+display))" if $(checkyesno loginshell); then if [[ ${wm_bin} == "gnome-session" ]]; then - exec ck-launch-session bash --login -c "startx $wm_bin -- ${serverargs} &> /dev/null" & + exec ck-launch-session bash --login -c "startx /usr/share/cdm/xinirc "$wm_bin" -- ${serverargs} &> /dev/null" & else - exec bash --login -c "startx $wm_bin -- ${serverargs} &> /dev/null" & + exec bash --login -c "startx /usr/share/cdm/xinitrc "$wm_bin" -- ${serverargs} &> /dev/null" & fi else if [[ ${wm_bin} == "gnome-session" ]]; then - exec ck-launch-session startx $wm_bin -- ${serverargs} &> /dev/null & + exec ck-launch-session startx /usr/share/cdm/xinitrc $wm_bin -- ${serverargs} &> /dev/null & else - exec startx $wm_bin -- ${serverargs} &> /dev/null & + exec startx /usr/share/cdm/xinitrc $wm_bin -- ${serverargs} &> /dev/null & fi fi } diff --git a/src/cdmrc b/src/cdmrc index 7959c9c..be96dea 100644 --- a/src/cdmrc +++ b/src/cdmrc @@ -4,7 +4,7 @@ # Set CDM theme and dialog options theme=cdm -countfrom=0 +countfrom=1 # List all WM binary names wmbinlist=(awesome openbox-session) @@ -23,7 +23,7 @@ rebootcommand='sudo shutdown -r now' # Allow suspend? # Note that this option requires pm-utils # to be installed and properly configured. -allowsuspend=yes +allowsuspend=no suspendcommand='sudo pm-suspend' # Set configuration for specific users? @@ -50,7 +50,7 @@ courtney() { allowshutdown=no # Set specific display for user - # (Not honored unless locktty=yes) + # (Not used unless locktty=yes) # display=1 } @@ -61,7 +61,7 @@ courtney() { # Set default display display=0 -# Where should first X tty be spawned? +# Where should first X tty be spawned xtty=7 # Restrict tty? (By default, cdm increments X tty, this setting @@ -72,11 +72,5 @@ locktty=no # Enable login shell (fixes issues with some keymaps, uses bash) loginshell=no -# Use ~/.xinitrc when it exists, or /etc/X11/xinit/xinitrc when -# it doesn't. If no, then we instead call the chosen window -# manager directly. -usexinit=no - -# Additional arguments to pass to X server; it will be called as: -# exec /usr/bin/X :$display $serverargs vt$((xtty+display)) +# Additional arguments to pass to X server serverargs="-nolisten tcp -dpi 96" diff --git a/src/xinitrc b/src/xinitrc new file mode 100644 index 0000000..a150f8a --- /dev/null +++ b/src/xinitrc @@ -0,0 +1,4 @@ +#!/bin/sh + +wm_bin="$1" +exec ${wm_bin} diff --git a/src/zzz-cdm-profile.sh b/src/zzz-cdm-profile.sh index 2ac6608..4c1909a 100755 --- a/src/zzz-cdm-profile.sh +++ b/src/zzz-cdm-profile.sh @@ -1,7 +1,8 @@ -if [[ -z "$DISPLAY" ]]; then #&& [[ $(tty) = /dev/tty1 ]]; then +if [[ -z "$DISPLAY" ]]; then # Drop root to console if [[ $EUID -eq 0 ]]; then exec ${SHELL} fi - exec cdm + cdm + exit 0 fi