on Thu, 29 Oct 1992 03:28:57 GMT, rc...@fraser.sfu.ca (Robert Chen) said:
[...]
Robert> I have put a line:
Robert> /usr/X386/bin/xdm
Robert> at the end of my rc.local file. I have also commented out the
Robert> getty line in inittab for ttys1. Xdm starts up just fine and
Robert> gives me a login prompt. I enter account name and password, the
Robert> screen clears, lots of disk activity, and then the xdm login screen
Robert> is put pack up (ie, it won't let me past the login screen).
[...]
Robert> Any suggestions?
I'd say it's because you're not running it under /dev/tty1
(/dev/console), my fix consists of a small script that's executed in
rc.local that puts up a prompt *before* /etc/rc is over, and if the
user hits RETURN, it will start XDM. If nothing happens (ie, the user
doesn't hit RETURN) for 5 seconds, it simply skips XDM.
In fact, the script can be more generally used to get a "smarter"
behaviour without blocking the machine:
# ask "Question" | read ANSWER
will set ANSWER to either START or SKIP depending on whether the user
hit RETURN or the timeout period (default 5 seconds) expired.
Note that this requires /bin/sleep to exist, which it "normally"
doesn't, just make a copy of /usr/bin/sleep (so it can be used before
/usr is mounted).
Caveat: the stuff that follows is my /etc/rc{,.local,xdm} and
/etc/inittab. Do *NOT* blindly copy them over to /etc or you may
regret it.
enjoy,
./salvador
--------snip---------------------snip--------------------snip----------------
#!/bin/sh
# This is a shell archive (produced by shar 3.49)
# To extract the files from this archive, save it to a file, remove
# everything above the "!/bin/sh" line above, and type "sh file_name".
#
# made 10/30/1992 13:18 UTC by spa@toto
# Source directory /a/zen/home/spa/spool/lx
#
# existing files will NOT be overwritten unless -c is specified
#
# This shar contains:
# length mode name
# ------ ---------- ------------------------------------------
# 328 -rw-r--r-- etc/inittab.noxdm
# 330 -rw-r--r-- etc/inittab.xdm
# 1308 -rw-r--r-- etc/rc
# 764 -rw-r--r-- etc/rc.ask
# 594 -rw-r--r-- etc/rc.local
# 316 -rw-r--r-- etc/rc.xdm
#
# ============= etc/inittab.noxdm ==============
if test ! -d 'etc'; then
echo 'x - creating directory etc'
mkdir 'etc'
fi
if test -f 'etc/inittab.noxdm' -a X"$1" != X"-c"; then
echo 'x - skipping etc/inittab.noxdm (File already exists)'
else
echo 'x - extracting etc/inittab.noxdm (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'etc/inittab.noxdm' &&
# inittab for linux, poeigl 1.6
# Format: ttyline:termcap-entry:getty-command
tty1:console:/etc/getty 9600 tty1
tty2:console:/etc/getty 9600 tty2
tty3:console:/etc/getty 9600 tty3
tty4:console:/etc/getty 9600 tty4
# tty5:console:/etc/getty 9600 tty5
# ttys1:dumb:/etc/getty 9600 ttys1
# ttys2:dumb:/etc/getty -m -t60 2400 ttys2
SHAR_EOF
chmod 0644 etc/inittab.noxdm ||
echo 'restore of etc/inittab.noxdm failed'
Wc_c="`wc -c < 'etc/inittab.noxdm'`"
test 328 -eq "$Wc_c" ||
echo 'etc/inittab.noxdm: original size 328, current size' "$Wc_c"
fi
# ============= etc/inittab.xdm ==============
if test -f 'etc/inittab.xdm' -a X"$1" != X"-c"; then
echo 'x - skipping etc/inittab.xdm (File already exists)'
else
echo 'x - extracting etc/inittab.xdm (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'etc/inittab.xdm' &&
# inittab for linux, poeigl 1.6
# Format: ttyline:termcap-entry:getty-command
# tty1:console:/usr/bin/X11/xdm
tty2:console:/etc/getty 9600 tty2
# tty3:console:/etc/getty 9600 tty3
# tty4:console:/etc/getty 9600 tty4
# tty5:console:/etc/getty 9600 tty5
# ttys1:dumb:/etc/getty 9600 ttys1
# ttys2:dumb:/etc/getty -m -t60 2400 ttys2
SHAR_EOF
chmod 0644 etc/inittab.xdm ||
echo 'restore of etc/inittab.xdm failed'
Wc_c="`wc -c < 'etc/inittab.xdm'`"
test 330 -eq "$Wc_c" ||
echo 'etc/inittab.xdm: original size 330, current size' "$Wc_c"
fi
# ============= etc/rc ==============
if test -f 'etc/rc' -a X"$1" != X"-c"; then
echo 'x - skipping etc/rc (File already exists)'
else
echo 'x - extracting etc/rc (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'etc/rc' &&
# -- /etc/rc - generic system configuration script ----------------------------
X
export PATH=/usr/bin:/bin:/etc
[ -f /etc/rc.ask ] && . /etc/rc.ask
X
# update syncs the filesystems every 30 seconds
echo "Starting update daemon."
update &
X
# make sure we want to start it all
if [ $(ask "Multiuser startup") = SKIP ]; then
X # remove /etc/mtab* so mount creates the /etc/mtab file
X rm -f /etc/mtab*
X /bin/doshell /dev/tty1 /bin/bash
else
X echo "Mounting filesystems."
X # remove /etc/mtab* so mount creates the /etc/mtab file
X rm -f /etc/mtab* /etc/nologin
X # mount all partitions specified in /etc/fstab
X mount -av
X
X # format and mount swap partition specified in /etc/fstab
X echo "Formatting and mounting swap partitions."
X SWAPDEVS=$(sed 's/#.*//' < /etc/fstab | awk '$3 == "swap" { print $1 }')
X for SWAPDEV in $SWAPDEVS; do
X SWAPBOOTDEV=${SWAPDEV%[0-9]}
X SWAPSIZ=$( (echo p; echo q) | fdisk $SWAPBOOTDEV | \
X awk '$1=="'$SWAPDEV'" { print $5 }')
X echo -n "$SWAPDEV (${SWAPSIZ}K): "; mkswap $SWAPDEV $SWAPSIZ
X done
X swapon -a
X
X # tmp and usr may be mounted, so we do these rm's after mount
X echo "Cleaning up /usr/spool/uucp and /tmp."
X rm -f /usr/spool/uucp/LCK*
X rm -rf /tmp/*
X
X # remove /etc/utmp and touch it
X rm -f /etc/utmp
X touch /etc/utmp
X
X sh /etc/rc.local
X
fi
SHAR_EOF
chmod 0644 etc/rc ||
echo 'restore of etc/rc failed'
Wc_c="`wc -c < 'etc/rc'`"
test 1308 -eq "$Wc_c" ||
echo 'etc/rc: original size 1308, current size' "$Wc_c"
fi
# ============= etc/rc.ask ==============
if test -f 'etc/rc.ask' -a X"$1" != X"-c"; then
echo 'x - skipping etc/rc.ask (File already exists)'
else
echo 'x - extracting etc/rc.ask (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'etc/rc.ask' &&
# -----------------------------------------------------------------------------
# usage: ask PROMPT [START/SKIP] [TIMEOUT]
#
X
TTY=/dev/console
X
SLEEP=/bin/sleep
X
function ask {
X local PROMPT=$1 # what to prompt for
X local TIMEOUT=${3-5} # default timeout to 5 seconds
X local CR_ACTION=${2-START} # default action is START
X local TO_ACTION=SKIP # default CR action is SKIP
X local PID_1 PID_2
X
X [ $CR_ACTION = START ] || { TO_ACTION=START }
X
X ( echo >$TTY -ne "\7Hit RETURN to $CR_ACTION $PROMPT... [$TIMEOUT seconds]"
X ( read <$TTY -r SOME_JUNK; echo $CR_ACTION ) & echo $!
X ( $SLEEP $TIMEOUT; echo '' >$TTY; echo $TO_ACTION ) & echo $! ) | \
X ( read PID_1; read PID_2; read ANSWER
X kill -9 $PID_1 $PID_2 2> /dev/null 1>&2
X echo $ANSWER )
}
SHAR_EOF
chmod 0644 etc/rc.ask ||
echo 'restore of etc/rc.ask failed'
Wc_c="`wc -c < 'etc/rc.ask'`"
test 764 -eq "$Wc_c" ||
echo 'etc/rc.ask: original size 764, current size' "$Wc_c"
fi
# ============= etc/rc.local ==============
if test -f 'etc/rc.local' -a X"$1" != X"-c"; then
echo 'x - skipping etc/rc.local (File already exists)'
else
echo 'x - extracting etc/rc.local (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'etc/rc.local' &&
# set hostname
echo "Setting hostname to 'khoco'."
hostname khoco
X
# make Ctrl-Alt-Del send a signal to init
# echo "Setting Ctrl-Alt-Del to send a signal to init."
# ctrlaltdel soft
X
# prepare virtual consoles's look
echo "Setting virtual consoles attributes."
for CONS in 1 2 3 4 5 6 7 8; do
X setterm -blank 10 -foreground green -background black -store > /dev/tty$CONS
done
X
# create new /etc/motd
if [ /vmlinux -nt /etc/motd ]; then
X echo "New /vmlinux: creating /etc/motd."
X ( strings /vmlinux | fgrep 'Linux version'; echo '' ) > /etc/motd
fi
X
# start (or maybe not) XDM
. /etc/rc.xdm
SHAR_EOF
chmod 0644 etc/rc.local ||
echo 'restore of etc/rc.local failed'
Wc_c="`wc -c < 'etc/rc.local'`"
test 594 -eq "$Wc_c" ||
echo 'etc/rc.local: original size 594, current size' "$Wc_c"
fi
# ============= etc/rc.xdm ==============
if test -f 'etc/rc.xdm' -a X"$1" != X"-c"; then
echo 'x - skipping etc/rc.xdm (File already exists)'
else
echo 'x - extracting etc/rc.xdm (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'etc/rc.xdm' &&
#! /bin/sh
X
[ "$(type -type ask)" = "function" ] || . /etc/rc.ask # define "ask"
X
INITTAB=/etc/inittab
X
if [ $(ask XDM) = START ]; then
X echo -e "\r\33[JStarting XDM."
X cp -f $INITTAB.xdm $INITTAB
X /bin/doshell /dev/tty1 /usr/bin/X11/xdm &
else
X echo -e "\r\33[JSkipping XDM."
X cp -f $INITTAB.noxdm $INITTAB
fi
SHAR_EOF
chmod 0644 etc/rc.xdm ||
echo 'restore of etc/rc.xdm failed'
Wc_c="`wc -c < 'etc/rc.xdm'`"
test 316 -eq "$Wc_c" ||
echo 'etc/rc.xdm: original size 316, current size' "$Wc_c"
fi
exit 0
-----------------------------------------------------------------------------
--