Path: utzoo!utgpu!jarvis.csri.toronto.edu!clyde.concordia.ca!uunet!samsung!usc!apple!motcsd!hpda!hpcuhb!hpcllla!hpclisp!hpclcac!cary From: cary@hpclcac.HP.COM (Cary Coutant) Newsgroups: comp.sys.hp Subject: Re: running X from init Message-ID: <1340092@hpclcac.HP.COM> Date: 22 Dec 89 01:00:38 GMT References: <1541@gwusun.gwu.edu> Organization: Hewlett-Packard Calif. Language Lab Lines: 63 Here's what I did to login to X: 1. I added the following line to /etc/inittab. Rather than running hpterm directly, I run a script that does a few other things as well. X0 : 2 :respawn:env PATH=/usr/bin/X11:/bin:/usr/bin xinit \ /users/cary/bin/xstart.init ttyqf \ -- :0 >>/tmp/xinit.log 2>&1 2. I linked the ttyqf and ptyqf device files from the /dev/pty and /dev/ptym directories into /dev, because older hpterms couldn't find them otherwise: ln /dev/pty*/*qf /dev (I picked ttyqf arbitrarily.) 3. I added the following line to /etc/gettydefs. When hpterm runs getty, it uses an argument of "Xwindow". Xwindow# B9600 HUPCL PARENB CS7 # B9600 SANE PARENB CS7 ISTRIP IXANY TAB3 #X login: #9600 4. The script /users/cary/bin/xstart.init starts up the clock and login window, and also loads my X defaults and sets the root window pattern: MYHOME=/users/cary : ${DISPLAY:=unix:0.0}; export DISPLAY TZ=PST8PDT export TZ xset b 60 880 100 s 1200 xrdb -load $MYHOME/.X11defaults xsetroot -bg SeaGreen -fg Grey -mod 16 16 xclock -geometry 128x128+10+10 & exec hpterm =80x24+10-10 -L "$@" The final argument to hpterm comes from the inittab line ("ttyqf"). 5. In my .profile, I test the tty to start up the rest of my clients. if [ `tty` = "/dev/ttyqf" ] then PATH=$HOME/X11/bin:/usr/local/bin/X11:/usr/contrib/X11Programs:/usr/bin/X11:$PATH export PATH : ${DISPLAY:=unix:0.0} export DISPLAY xsetup fi Be careful! When you logout of the initial login window, X will terminate (and all the clients along with it), then init will respawn the whole thing. This sure makes it easy to shut down at the end of the day, though. If you want to login on the console without running X, you'll need to change the run level to 1 (type "init 1" as root). I considered setting up the X stuff as run-level 3, and making that the default, but it hasn't yet seemed necessary. Cary Coutant, HP Systems Technology Division