Fixed a few stupid errors

pull/3/head
Ghost1227 15 years ago
parent e949fb84c7
commit 15e91df3e4

@ -1,3 +1,6 @@
Version 0.4.1 (2010-01-05)
- Fixed several stupid mistakes on my part
Version 0.4 (2010-01-03) Version 0.4 (2010-01-03)
- Fixed CHANGELOG to better match standards - Fixed CHANGELOG to better match standards
- Added proper utilization of exec - Added proper utilization of exec

@ -8,6 +8,7 @@ else
mkdir -p /usr/{bin,share/cdm} mkdir -p /usr/{bin,share/cdm}
install -m755 cdm /usr/bin/ install -m755 cdm /usr/bin/
install -Dm644 cdmrc /etc/cdmrc install -Dm644 cdmrc /etc/cdmrc
install -m644 xinitrc /usr/share/cdm/
install -Dm755 zzz-cdm-profile.sh /etc/profile.d/zzz-cdm-profile.sh install -Dm755 zzz-cdm-profile.sh /etc/profile.d/zzz-cdm-profile.sh
cp -Rf themes /usr/share/cdm/ cp -Rf themes /usr/share/cdm/
fi fi

@ -8,6 +8,7 @@
# important X incrementation function # important X incrementation function
# brisbin33.......code cleanup # brisbin33.......code cleanup
# tigrmesh........finding a critical issue with the gnome-session handler # 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 # 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 # it under the terms of the GNU General Public License as published by
@ -25,17 +26,13 @@
# MA 02110-1301, USA. # MA 02110-1301, USA.
name="Console Display Manager" name="Console Display Manager"
ver="0.4" ver="0.4.1"
info="\e[1;34m==>\e[1;37m" info="\e[1;34m==>\e[1;37m"
error="\e[1;31m==>\e[1;37m" error="\e[1;31m==>\e[1;37m"
success="\e[1;32m==>\e[1;37m" success="\e[1;32m==>\e[1;37m"
reset="\e[0m" reset="\e[0m"
# Ignore SIGINT (^C) and SIGTSTP (^Z) # Ignore SIGINT (^C) and SIGTSTP (^Z)
trap "" 2 20 trap "" 2 20
userclientrc=$HOME/.xinitrc
sysclientrc=/etc/X11/xinit/xinitrc
# userserverrc=$HOME/.xserverrc
# sysserverrc=/etc/X11/xinit/xserverrc
# Source cdm configuration # Source cdm configuration
if [[ -f /etc/cdmrc ]]; then 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}" echo -e "${info} Theme file ${theme} is invalid, reverting to default theme.${reset}"
fi fi
fi fi
# Fall back on defaults if valid theme isn't found
if [[ -z $DIALOGRC ]]; then if [[ -z $DIALOGRC ]]; then
if [[ -f /usr/share/cdm/themes/default ]]; then if [[ -f /usr/share/cdm/themes/default ]]; then
DIALOGRC=/usr/share/cdm/themes/default DIALOGRC=/usr/share/cdm/themes/default
@ -73,14 +69,15 @@ if [[ -z $DIALOGRC ]]; then
fi fi
fi fi
# Based on FreeBSD's /etc/rc.subr ### Based on FreeBSD's /etc/rc.subr
# ##
# checkyesno var # checkyesno var
# Test $1 variable, and warn if not set to YES or NO. # Test $1 variable, and warn if not set to YES or NO.
# Return 0 if it's "yes" (et al), nonzero otherwise. # Return 0 if it's "yes" (et al), nonzero otherwise.
# to make default yes, do "checkyesno var yes" # to make default yes, do "checkyesno var yes"
#
checkyesno() { checkyesno()
{
local value=${!1} local value=${!1}
# debug "checkyesno: $1 is set to $value." # debug "checkyesno: $1 is set to $value."
if [[ -n $2 ]]; then if [[ -n $2 ]]; then
@ -89,18 +86,18 @@ checkyesno() {
value=${value:-no} value=${value:-no}
fi fi
case $value in case $value in
# "yes", "true", "on", or "1" # "yes", "true", "on", or "1"
[Yy][Ee][Ss]|[Tt][Rr][Uu][Ee]|[Oo][Nn]|1) [Yy][Ee][Ss]|[Tt][Rr][Uu][Ee]|[Oo][Nn]|1)
return 0 return 0
;; ;;
# "no", "false", "off", or "0" # "no", "false", "off", or "0"
[Nn][Oo]|[Ff][Aa][Ll][Ss][Ee]|[Oo][Ff][Ff]|0) [Nn][Oo]|[Ff][Aa][Ll][Ss][Ee]|[Oo][Ff][Ff]|0)
return 1 return 1
;; ;;
*) *)
echo "\$${1} is not set properly." >&2 echo "\$${1} is not set properly." >&2
exit 1 exit 1
;; ;;
esac esac
} }
@ -165,7 +162,8 @@ mainmenu() {
else else
# Display selection dialog # Display selection dialog
wm=$( 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 " \ --ok-label " Select " --cancel-label " Logout " \
--menu "Select Window Manager" 0 0 0 ${menu} --menu "Select Window Manager" 0 0 0 ${menu}
) )
@ -202,9 +200,10 @@ shutdownmenu() {
# Display shutdown dialog # Display shutdown dialog
haltopt=$( haltopt=$(
DIALOGRC="$DIALOGRC" dialog --colors --backtitle "${name} v${ver}" --stdout \ DIALOGRC="$DIALOGRC" dialog --colors \
--ok-label " Select " --cancel-label " Cancel " \ --backtitle "${name} v${ver}" --stdout \
--menu "Shutdown" 0 0 0 ${haltmenu} --ok-label " Select " --cancel-label " Cancel " \
--menu "Shutdown" 0 0 0 ${haltmenu}
) )
if [[ $? == 0 ]]; then if [[ $? == 0 ]]; then
@ -223,27 +222,19 @@ shutdownmenu() {
xstart() { xstart() {
# Start X # 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))" serverargs=":${display} ${serverargs} vt$((xtty+display))"
if $(checkyesno loginshell); then if $(checkyesno loginshell); then
if [[ ${wm_bin} == "gnome-session" ]]; 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 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 fi
else else
if [[ ${wm_bin} == "gnome-session" ]]; then 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 else
exec startx $wm_bin -- ${serverargs} &> /dev/null & exec startx /usr/share/cdm/xinitrc $wm_bin -- ${serverargs} &> /dev/null &
fi fi
fi fi
} }

@ -4,7 +4,7 @@
# Set CDM theme and dialog options # Set CDM theme and dialog options
theme=cdm theme=cdm
countfrom=0 countfrom=1
# List all WM binary names # List all WM binary names
wmbinlist=(awesome openbox-session) wmbinlist=(awesome openbox-session)
@ -23,7 +23,7 @@ rebootcommand='sudo shutdown -r now'
# Allow suspend? # Allow suspend?
# Note that this option requires pm-utils # Note that this option requires pm-utils
# to be installed and properly configured. # to be installed and properly configured.
allowsuspend=yes allowsuspend=no
suspendcommand='sudo pm-suspend' suspendcommand='sudo pm-suspend'
# Set configuration for specific users? # Set configuration for specific users?
@ -50,7 +50,7 @@ courtney() {
allowshutdown=no allowshutdown=no
# Set specific display for user # Set specific display for user
# (Not honored unless locktty=yes) # (Not used unless locktty=yes)
# display=1 # display=1
} }
@ -61,7 +61,7 @@ courtney() {
# Set default display # Set default display
display=0 display=0
# Where should first X tty be spawned? # Where should first X tty be spawned
xtty=7 xtty=7
# Restrict tty? (By default, cdm increments X tty, this setting # 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) # Enable login shell (fixes issues with some keymaps, uses bash)
loginshell=no loginshell=no
# Use ~/.xinitrc when it exists, or /etc/X11/xinit/xinitrc when # Additional arguments to pass to X server
# 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))
serverargs="-nolisten tcp -dpi 96" serverargs="-nolisten tcp -dpi 96"

@ -0,0 +1,4 @@
#!/bin/sh
wm_bin="$1"
exec ${wm_bin}

@ -1,7 +1,8 @@
if [[ -z "$DISPLAY" ]]; then #&& [[ $(tty) = /dev/tty1 ]]; then if [[ -z "$DISPLAY" ]]; then
# Drop root to console # Drop root to console
if [[ $EUID -eq 0 ]]; then if [[ $EUID -eq 0 ]]; then
exec ${SHELL} exec ${SHELL}
fi fi
exec cdm cdm
exit 0
fi fi

Loading…
Cancel
Save