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

@ -33,6 +33,10 @@ 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
@ -69,15 +73,14 @@ 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
@ -118,7 +121,10 @@ else
# Get the first empty display # Get the first empty display
display=0 display=0
while [[ ${display} -lt 7 ]]; do 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 let display=display+1
else else
break break
@ -222,20 +228,33 @@ 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
else
wm_bin="/usr/share/cdm/xinitrc $wm_bin"
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 /usr/share/cdm/xinirc "$wm_bin" -- ${serverargs} &> /dev/null" & nohup ck-launch-session bash --login -c "startx $wm_bin -- ${serverargs}" &> /dev/null &
else # else
exec bash --login -c "startx /usr/share/cdm/xinitrc "$wm_bin" -- ${serverargs} &> /dev/null" & # nohup bash --login -c "startx $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 /usr/share/cdm/xinitrc $wm_bin -- ${serverargs} &> /dev/null & nohup ck-launch-session startx $wm_bin -- ${serverargs} &> /dev/null &
else # else
exec startx /usr/share/cdm/xinitrc $wm_bin -- ${serverargs} &> /dev/null & # nohup startx $wm_bin -- ${serverargs} &> /dev/null &
fi # fi
fi fi
# There's some kind of race condition:
# despite the nohup, if we exit too quickly the session is killed.
sleep 2
} }
mainmenu mainmenu

@ -7,10 +7,10 @@ theme=cdm
countfrom=1 countfrom=1
# List all WM binary names # List all WM binary names
wmbinlist=(awesome openbox-session) wmbinlist=(awesome)
# List all WM display names # List all WM display names
wmdisplist=(Awesome Openbox) wmdisplist=(Awesome)
# Allow console login? # Allow console login?
allowconsole=yes allowconsole=yes
@ -50,7 +50,7 @@ courtney() {
allowshutdown=no allowshutdown=no
# Set specific display for user # Set specific display for user
# (Not used unless locktty=yes) # (Not honored 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
@ -69,8 +69,23 @@ xtty=7
# setting the display=N option on a per-user basis.) # setting the display=N option on a per-user basis.)
locktty=no 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 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" serverargs="-nolisten tcp -dpi 96"

@ -1,4 +1,4 @@
if [[ -z "$DISPLAY" ]]; then if [[ -z "$DISPLAY" && -z "$SSH_TTY" && $(tty) = /dev/tty* ]]; then
# Drop root to console # Drop root to console
if [[ $EUID -eq 0 ]]; then if [[ $EUID -eq 0 ]]; then
exec ${SHELL} exec ${SHELL}

Loading…
Cancel
Save