[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: annoucement: auto-login patch for xdm



> > I agree, we could start xdm in rnlevel 3 and "su someuser startx" in runlevel
> > 4.
> > 
> Great,I'll keep an eye and try it as soon as it's done.Thanks.
> 
why do you want to wait? ;-)

i attached my auto-login script again. now it has the auto-relogin problem
nicely solved. if the server crashes, then the session will be restarted
immediately. if you exit cleanly, then you have to press enter to log in
again (it is done by a read command. so you could even use this input to
perform a command, eg, you could make it accept "halt", if you want).

put the script in /etc/init.d
then run:
update-rc.d -f xdm remove
update-rc.d -f xdm start 99 3 . stop 01 0 1 2 4 5 6 .
update-rc.d -f autologon start 99 4 . stop 01 0 1 2 3 5 6 .

this way you get the following runlevels:
1: normal single-user
2: multi-user without x login
3: multi-user with xdm login
4: multi-user with x auto-login
5: ?


and here is, how to make it with my xdm patch
(http://www.inf.tu-dresden.de/~ob6/unix/xautolog.html):
cd /etc/X11/xdm
cp xdm-config xdm-config-al
edit xdm-config-al
 -> add the auto-login options (see home page)
cd /etc/init.d
cp xdm xdm-al
edit xdm-al:
 -> change
    start-stop-daemon --start --quiet --pid $PIDFILE --exec $DAEMON || echo -n " already running"
  to
    start-stop-daemon --start --quiet --pid $PIDFILE --exec $DAEMON -- -config /etc/X11/xdm/xdm-config-al || echo -n " already running"
the following hack is necessary, because we must give xdm enough time to
exit before it is started again (with the different config):
edit rc:
 -> add "sleep 1" before the line 
    "# Now run the START scripts for this runlevel." 
    (line 72 on my system)
update-rc.d -f xdm remove
update-rc.d -f xdm start 99 3 . stop 01 0 1 2 4 5 6 .
update-rc.d -f xdm-al start 99 4 . stop 01 0 1 2 3 5 6 .


have fun! :-)

-- 
Hi! I'm a .signature virus! Copy me into your ~/.signature, please!
--
If Windows is the answer, I want the problems back!
#!/bin/sh
# /etc/init.d/autologon
#
#   log on the first regular user in the passwd file automatically

PATH=/bin:/usr/bin:/sbin:/usr/sbin
PIDFILE=/var/run/autologon.pid

case "$1" in
  start)
    echo -n "Starting auto-login daemon: "
    if test -f $PIDFILE; then
      PID=$(<$PIDFILE)
      kill -CONT $PID 2>/dev/null && { echo "already running."; exit 1; } ||
        { echo -n "(warning: stale PID file found) "; }
    fi
    { test -d /etc/X11/kdm && DISPMAN=kdm; } ||
      { test -d /etc/X11/gdm && DISPMAN=gdm; } ||
      { test -d /etc/X11/xdm && DISPMAN=xdm; } ||
      { echo no display manager configuration found; exit 1; }
    eval `awk '
/^DisplayManager._0.startup/ {print "XSTRTUP=" $2 ";"}
/^DisplayManager._0.reset/ {print "XRSET=" $2 ";"}
/^DisplayManager\*userPath/ {print "export PATH=" $2 ";"}
' /etc/X11/$DISPMAN/$DISPMAN-config`
    export DISPLAY=:0
    . /etc/adduser.conf
    eval `awk -F: '$3=='$FIRST_UID' {print "export USER=" $1 ";export HOME=" $6}' /etc/passwd`
    (
      while :; do
        $XSTRTUP
	su - $USER -c 'exec startx $(<$HOME/.wmrc) >$HOME/.X.err 2>&1'
	$XRSET
	grep -q '^xinit:  connection to X server lost.' $HOME/.X.err || 
	  { chvt 10; read -p "Press <enter> to restart X session: " <>/dev/tty10 >&0 2>&1; }
      done
    ) &
    echo $! >$PIDFILE
    echo "done."
    ;;
  stop)
    echo -n "stopping auto-login daemon: "
    test -f $PIDFILE || { echo "not running."; exit 1; }
    PID=$(<$PIDFILE); rm -f $PIDFILE
    kill $PID 2>/dev/null || { echo "stale PID file found."; exit 1; }
    echo "done."
    ;;
  *)
    echo "Usage: /etc/init.d/autologon {start|stop}"
    exit 1
    ;;
esac

exit 0

Reply to: