It looks like time to post this again! (originally posted 7 Mar 1997). Still works for Debian 2.0 so far as I am aware.
My scripts are based on those posted to this list by Philippe Troin <[EMAIL PROTECTED]> on Monday 7th October 1996 (subject: " Re: Ctrl-Alt-Del doesn't work under X?"). I've modified them considerably for use at our site, where one of the requirements for our linux machines is to be able to emulate an X terminal on an HP-UX server machine. It (almost) goes without saying that you need tcl and tk packages installed - only the runtime parts are needed, and I am not aware of a need for any particular version. Assuming you have xdm running, you need to do the following: Modify /etc/X11/xdm/Xsetup_0 - this script is run when xdm is (re)initialising the login screen. Mine is now: ======================================================================= #!/bin/sh # $XConsortium: Xsetup_0,v 1.3 93/09/28 14:30:31 gildea Exp $ if grep -q ^run-xconsole /etc/X11/config then xconsole -geometry 480x130-0-0 -daemon -notify -verbose -fn fixed \ -exitOnFail -file /dev/xconsole fi xsetroot -solid grey50 # Start the rebooter etc... /usr/local/bin/tkmgr & echo $! > /var/run/tkmgr-pid ======================================================================= Modify /etc/X11/xdm/Xstartup_0 - this script is run after a user has successfully logged in at the xdm login prompt. Mine is now: ======================================================================= #! /bin/sh # # This script is run as root after a user starts a session on :0. # Call the global Xstartup script, if it exists if [ -x /etc/X11/xdm/Xstartup ] ; then /etc/X11/xdm/Xstartup fi # :0 specific startup commands go here # Kill the mgr if [ -f /var/run/tkmgr-pid ] then kill `cat /var/run/tkmgr-pid` rm /var/run/tkmgr-pid fi exit 0 ======================================================================= The Tk script is /usr/local/bin/tkmgr. Mine is modified to give three choices. The first is to connect to one of our server machines acting as an xterm, the second to reboot the system and the third to halt it. The script determines the location of the xdm login window and places itself centrally below it. It will obviously need customising, to either remove the xterm reference or make it applicable to a particular site. /usr/local/bin/tkmgr contains: ======================================================================= #!/usr/bin/wish # Init stuff wm title . Chooser wm protocol . WM_DELETE_WINDOW Quit # Place this below bottom LH corner of login window set info [split [exec xwininfo -name xlogin] "\n"] set LoginGeom [split [lindex [split [lindex $info 21] " "] 3] +] set LoginH [lindex [split [lindex $LoginGeom 0] x] 1] set NewX [expr [lindex $LoginGeom 1] + 1] set NewY [expr [lindex $LoginGeom 2] + $LoginH + 6] wm geometry . +$NewX+$NewY # The buttons frame .buttons button .buttons.xterm \ -text "Start xterm on ..." \ -width 19 \ -relief raised \ -command Xterm button .buttons.reboot \ -text "Reboot the system" \ -width 19 \ -command Reboot button .buttons.halt \ -text "Halt the system" \ -width 19 \ -command Halt pack append .buttons \ .buttons.xterm {left expand fill} \ .buttons.halt {left expand fill} \ .buttons.reboot {left expand fill} menu .buttons.xterm.menu .buttons.xterm.menu add command -label "sleepy" -command {Xterm "sleepy"} .buttons.xterm.menu add command -label "sneezy" -command {Xterm "sneezy"} .buttons.xterm.menu add command -label "bashful" -command {Xterm "bashful"} .buttons.xterm.menu add command -label "dopey" -command {Xterm "dopey"} .buttons.xterm.menu add command -label "grumpy" -command {Xterm "grumpy"} .buttons.xterm.menu add command -label "happy" -command {Xterm "happy"} pack .buttons -side top -fill x -expand true # The Functions proc Quit {} { exit 0 } proc Reboot {} { exec /sbin/shutdown -rt 15 now < /dev/tty1 > /dev/tty1 2> /dev/tty1 & } proc Halt {} { exec /sbin/shutdown -ht 15 now < /dev/tty1 > /dev/tty1 2> /dev/tty1 & } proc Xterm {} { catch "destroy .xtlist" toplevel .xtlist # Place this below chooser window set MainGeom [split [ wm geometry . ] +] set MainH [lindex [split [lindex $MainGeom 0] x] 1] set NewX [lindex $MainGeom 1] set NewY [expr [lindex $MainGeom 2] + $MainH] wm geometry .xtlist +$NewX+$NewY frame .xtlist.list button .xtlist.list.sleepy \ -text "sleepy" \ -padx 10 \ -width 7 \ -command {exec /usr/local/bin/tkxterm sleepy &} button .xtlist.list.sneezy \ -text "sneezy" \ -padx 11 \ -width 7 \ -command {exec /usr/local/bin/tkxterm sneezy &} button .xtlist.list.bashful \ -text "bashful" \ -padx 11 \ -width 7 \ -command {exec /usr/local/bin/tkxterm bashful &} button .xtlist.list.dopey \ -text "dopey" \ -padx 11 \ -width 7 \ -command {exec /usr/local/bin/tkxterm dopey &} button .xtlist.list.grumpy \ -text "grumpy" \ -padx 11 \ -width 7 \ -command {exec /usr/local/bin/tkxterm grumpy &} button .xtlist.list.happy \ -text "happy" \ -padx 10 \ -width 7 \ -command {exec /usr/local/bin/tkxterm happy &} pack append .xtlist.list \ .xtlist.list.sleepy {left expand fill} \ .xtlist.list.sneezy {left expand fill} \ .xtlist.list.bashful {left expand fill} \ .xtlist.list.dopey {left expand fill} \ .xtlist.list.grumpy {left expand fill} \ .xtlist.list.happy {left expand fill} pack .xtlist.list -side top -fill x -expand true } ======================================================================= It references a script /usr/local/bin/tkxterm, which does the following: 1. Stops xdm, and waits for the X server to die 2. Starts up as an xterm connected to the required machine (using XDMCP) 3. Restarts xdm when the xterm session finishes. This script should be quite general. It contains: ======================================================================= #!/bin/sh # # Script called from tkmgr. It kills xdm and runs a remote X session # on a given machine. When this terminates, xdm is restarted. # if [ $# != 1 ] then echo "Usage: $0 machine" else /etc/init.d/xdm stop while [ -f /tmp/.X0-lock ] do sleep 1 done /usr/bin/X11/X -query $1 -once /etc/init.d/xdm start fi ======================================================================= Hope this is all useful! Kevin -- Dr Kevin Scott Philips Electronics UK Limited Patents and Trade Marks Department Tel: +44 1293 815281 Cross Oak Lane, Redhill Fax: +44 1293 815060 Surrey RH1 5HA, UK E-mail: [EMAIL PROTECTED]