Skip to content

Commit

Permalink
Testing
Browse files Browse the repository at this point in the history
  • Loading branch information
Ghost1227 committed Jan 9, 2010
1 parent 15e91df commit b305f04
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 22 deletions.
49 changes: 34 additions & 15 deletions src/cdm
Expand Up @@ -33,6 +33,10 @@ 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
Expand Down Expand Up @@ -69,15 +73,14 @@ 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
Expand Down Expand Up @@ -118,7 +121,10 @@ else
# Get the first empty display
display=0
while [[ ${display} -lt 7 ]]; do
if xdpyinfo -display :${display}.0 &> /dev/null; then
if info=$(xdpyinfo -display :${display}.0 2>&1 1>/dev/null); then
let display=display+1
elif [[ $info = No\ protocol\ specified* ]]; then
# Display is in use by another user
let display=display+1
else
break
Expand Down Expand Up @@ -222,20 +228,33 @@ 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
else
wm_bin="/usr/share/cdm/xinitrc $wm_bin"
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 /usr/share/cdm/xinirc "$wm_bin" -- ${serverargs} &> /dev/null" &
else
exec bash --login -c "startx /usr/share/cdm/xinitrc "$wm_bin" -- ${serverargs} &> /dev/null" &
fi
# if [[ ${wm_bin} == "gnome-session" ]]; then
nohup ck-launch-session bash --login -c "startx $wm_bin -- ${serverargs}" &> /dev/null &
# else
# nohup bash --login -c "startx $wm_bin -- ${serverargs}" &> /dev/null &
# fi
else
if [[ ${wm_bin} == "gnome-session" ]]; then
exec ck-launch-session startx /usr/share/cdm/xinitrc $wm_bin -- ${serverargs} &> /dev/null &
else
exec startx /usr/share/cdm/xinitrc $wm_bin -- ${serverargs} &> /dev/null &
fi
# if [[ ${wm_bin} == "gnome-session" ]]; then
nohup ck-launch-session startx $wm_bin -- ${serverargs} &> /dev/null &
# else
# nohup startx $wm_bin -- ${serverargs} &> /dev/null &
# fi
fi
# There's some kind of race condition:
# despite the nohup, if we exit too quickly the session is killed.
sleep 2
}
mainmenu
27 changes: 21 additions & 6 deletions src/cdmrc
Expand Up @@ -7,10 +7,10 @@ theme=cdm
countfrom=1

# List all WM binary names
wmbinlist=(awesome openbox-session)
wmbinlist=(awesome)

# List all WM display names
wmdisplist=(Awesome Openbox)
wmdisplist=(Awesome)

# Allow console login?
allowconsole=yes
Expand Down Expand Up @@ -50,7 +50,7 @@ courtney() {
allowshutdown=no

# Set specific display for user
# (Not used unless locktty=yes)
# (Not honored unless locktty=yes)
# display=1
}

Expand All @@ -61,16 +61,31 @@ 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
# allows administrators to lock users into one specific tty by
# setting the display=N option on a per-user basis.)
locktty=no

# Enable login shell (fixes issues with some keymaps, uses bash)
# Enable login shell (fixes issues with some keymaps, uses bash).
# Note that your bash scripts won't have any terminal as stdin when
# started in this way. This may break some commands, including stty,
# unless you explicitly check for [ -t 0 ] or that every login shell
# is also interactive. However, we're sending stdout and stderr to
# /dev/null, so you won't see the complaints.
loginshell=no

# Additional arguments to pass to X server
# When usexinit=yes, we use ~/.xinitrc when it exists or
# /etc/X11/xinit/xinitrc when it doesn't. These are passed the
# chosen window manager as $1; note that the stock xinitrc
# ignores this and always starts twm and three xterms. Your
# custom xinitrc should start the window manager supplied as
# $1 instead. If usexinit=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"
2 changes: 1 addition & 1 deletion src/zzz-cdm-profile.sh
@@ -1,4 +1,4 @@
if [[ -z "$DISPLAY" ]]; then
if [[ -z "$DISPLAY" && -z "$SSH_TTY" && $(tty) = /dev/tty* ]]; then
# Drop root to console
if [[ $EUID -eq 0 ]]; then
exec ${SHELL}
Expand Down

0 comments on commit b305f04

Please sign in to comment.