Last modified: 09-NOV-98 @ 15:57 ----------------------------------------------------------------------- Plug and Play POSIX ---or--- How To Make POSIX Work on MPE/iX 5.5 ----------------------------------------------------------------------- By: Michael D. Hensley Date written: January 1997 Credits: A *lot* of this was stolen from HP3000-L posters; I tried to give credit where due -- but I'm willing to take the blame for any errors. Use at your own risk. Batteries not included. ----------------------------------------------------------------------- ====================================================================== Conventions: commands preceeded by a ":" should be typed at the MPE/iX prompt; commands preceeded by a "$ " should be typed in the posix shell. ====================================================================== Contents A) Restore the HP-supplied HFS files, if they are missing B) Incorrect file permissions C) More incorrect file permissions D) Arrow keys in vi E) Modify your HPPATH F) Fix up your /etc/profile file Note: A,B,C, and F are all fixed by MPE/iX 6.0; D and E are suggested changes, not fixes. ====================================================================== [This tip was supplied by John Dunlop] A) Some sites are completely missing all of the HFS files (this is usually caused by an "incorrect" reload). From the MPE CI, try ":LISTFILE /bin/"; if no files are found, you will need to restore them from the FOS tape. 1. Restore the following from the FOS tape: restore *t;@.hp36431.support,i0036431.usl.sys;create;show 2. :STREAM I0036431.USL.SYS 3. After I0036431 finishes, :STREAM SUPACCT.PUB.SYS All of the HP-supplied hfs files will be restored, and the directory structure and permissions set to the defaults. Note: if you just want to restore all hfs files on a backup tape, try ":RESTORE /-@.@.@;SHOW;KEEP;OLDDATE;CREATE". [Thanks to Gilles Schipper.] ====================================================================== B) The file permissions are wrong on a *lot* of files. The first thing you will probably run into is the message Unknown terminal "hp2392a" in response to various commands (tput, tabs, vi...). To fix this, log on with SM capability and do: :sh $ chmod -R 555 /usr/lib/terminfo ====================================================================== [The following was posted by Lars, used without permission] C) There are still more, e.g. /usr/man for non-SM users... Here is a workaround (I stole it from the respective SR), that can be used to fixup those odd 5.5 permissions. 1. Restore hfsfiles.hp36431.support from the FOS tape. (This file will be used just to get a list of the files which we need to modify). 2. :tobyte.hpbin.sys "hfsfiles.hp36431.support /tmp/tarfile" 3. :SH.HPBIN.SYS -L shell/iX> for file in `tar tvf /tmp/tarfile 2>/dev/null | > grep -v '^d' | cut -c 57- ` > do > chmod 444 $file > done shell/iX> exit NOTE: The quote which preceeds tar and follows 57- in the above command is the "backward" quote usually found as the top-left key on a keyboard and those surrounding the ^d are normal single quotes. 4. :purge /tmp/tarfile :purge hfsfiles.hp36431.support [Thanks, Lars!] ====================================================================== D) Ok, now how about those pesky arrow keys in vi? [I stole this answer from Danny A. van Delft] Create a file named .exrc, which contains the following: :map ^V^[U ^V^F :map ^V^[V ^V^B :map ^V^[B j :map ^V^[A k :map ^V^[C l :map ^V^[D h :map ^V^[h 1G :map ^V^[F G :map ^V^[Q i :map ^V^[P x Note that ^V stands for V and ^[ for , all literal. You need the ^V to tell ex that the next character should taken literal, not interpreted. (And the leading ":" has nothing to do with MPE here.) [Thanks, Danny!] ====================================================================== E) Add "HPBIN.SYS" to your path: :SETVAR HPPATH=HPPATH+",HPBIN.SYS" (You need to add this to your OPTION LOGON UDC.) Also, optionally :SETCATALOG HPPXUDC.PUB.SYS;SYSTEM;APPEND for a few handy UDC's. ====================================================================== F) Finally, fix up your /etc/profile file (which gets executed automatically whenever anyone invokes the shell): [The attributions on this one are complex, but I stole it from Jeff Kell; on 24-SEP-98,] All of this is fixed (and even improved) in MPE/iX 6.0. If you implement the changes as shown, and put any additional local customizations you like in /etc/profile.local, then after the installation of MPE/iX 6.0 overwrites your /etc/profile, it will still continue to work! If you don't own QEDIT (why not?), I hope you can use 'vi' to edit bytestream files (if not, that's an experience in itself)... anyway... First, the revised /etc/profile, suitable for cut-and-pasting into your favourite text editor: ------------------------------------------------------------------------ export PATH=/usr/local/bin:/bin # (Change #1) export MANPATH=${MANPATH:-/usr/local/man:/usr/man:} # (Change #7) export PS1='shell/iX> ' # (Change #2) export TERM=${TERM:-hp2392a} # (Change #3) export ENV=$HOME/.environ export LOGNAME=`logname` export TZ=${TZ:-EST5EDT} export MAILPATH=/usr/mail/$LOGNAME export MAILCHECK=180 if [ "$HPHGROUP" = "" ] ; then export HISTFILE=${HISTFILE:-/$HPACCOUNT/$HPGROUP/.sh_history} else export HISTFILE=${HISTFILE:-/$HPACCOUNT/$HPHGROUP/.sh_history} fi #export HOME=$PWD if [ "$HPHGROUP" = "" ] ; then export HOME=${HOME:-/$HPACCOUNT/$HPGROUP} else export HOME=${HOME:-/$HPACCOUNT/$HPHGROUP} fi # (Change #8) alias -x copy="callci copy" alias -x listf="callci listfile" alias -x listgroup="callci listgroup" alias -x listuser="callci listuser" alias -x df="callci discfree d" alias -x ll="ls -l" # (Change #5) #tput clear tabs cat /etc/motd # (Change #6) umask 7 set -o ignoreeof export HPSHELLINT=1 # (Change #8) if [ -r /etc/profile.local ] ; then . /etc/profile.local fi # (Change #9) ------------------------------------------------------------------------ Here are the contents of /etc/profile.local: ------------------------------------------------------------------------ export PS1='$PWD $ ' # (see Change #2 note) # No need to set TZ; we do a :SETVAR TZ "PST8PDT" in a system-wide # OPTION LOGON UDC and the shell picks it up automagically. alias qedit="/ROBELLE/PUB/QEDIT" alias lclint="/usr/local/bin/lclint" # 97/08/22 mdh added for GNU #alias -x make="/usr/local/bin/make" #export CC=gcc #export MAKE=/usr/local/bin/make # 97/09/24 mdh added for JAVA export SYSNAME="hp3000" export MANPATH="/usr/man:/usr/contrib/man:/usr/local/man" export PATH=$PATH:/usr/local/java/latest/bin export THREADS_FLAG=green export CLASSPATH=.:/usr/local/java/latest/lib/classes.zip export LD_LIBRARY_PATH=/usr/local/java/latest/lib/PA-RISC/green_threads ------------------------------------------------------------------------ Here are the details on the changes noted above: -----change #1----- # set up the default path to include only the .2 utilities and the # current directory export PATH='/bin:.' ^^^^^^ If you are using Gnu/gcc/perl/etc., you can take Mark Klein's earlier suggestion of aliasing make to the Gnu make and adding /usr/local/bin after /bin above yielding export PATH='/bin:/usr/local/bin:.' or you can avoid the alias by putting /usr/local/bin first (sort of the HPPATH idea of system stuff last, not first -- this is what MPE/iX 6.0 does) for export PATH='/usr/local/bin:/bin:.' Many would argue that the trailing '.' is unnecessary/dangerous, and I rather agree (if you want to execute something locally, you have to './foo' instead of 'foo' but so what). Let's go on... -----Change #2----- # Set up the default user prompt. export PS1='shell/iX> ' ^^^ Stan (I think) previously pointed out that a '>' in the prompt string can bite you with an HP terminal should you hit 'enter' rather than 'return' :-) If you leave it, at least add a set -o noclobber to avoid messes. -----Change #3----- # default for the term variable is the supported HP terminal # definition. NOTE: the only supported terminal definitions are # 'hp2392a' and 'ansi'. All other definitions are provided as # user-supported software only! export TERM='hp2392a' Gee, what if you are a vt100? Our logon UDC determines TERM (well, it can find an HP terminal; if that test fails we assume vt100) so I would change this line to: export TERM=${TERM:-hp2392a} This will retain the current value of TERM if it is defined, otherwise it takes the default value of 'hp2392a'. -----Change #4----- # Set the following variable to the appropriate value for the timezone # you are in. Refer to the timezone manual page in section 5 of the # reference manual for more information. export TZ=GMT0 ^^^^ I dislike that one terribly. Most of you 'should' be setting TZ already since C/iX used this for times, and now COBOL post85 functions do also. Using the same logic as #3, change to: export TZ=${TZ:-EST5EDT} Since the MPE routines dependent on TZ now 'default' to EST if TZ isn't set this mimics MPE behavior (but of course you'd want to use your own timezone). I'm trying to keep this "generic" enough for HP to apply to the FOS (hint...) -----Change #5----- # Define a number of aliases for common MPE/iX commands alias -x copy="callci copy" alias -x listf="callci listfile" alias -x listgroup="callci listgroup" alias -x listuser="callci listuser" alias -x df="callci discfree d" These are useful I guess, and you can expand as much as you like; but what is really missing is: alias -x telnet="/SYS/ARPA/TELNET" alias -x ftp="/SYS/ARPA/FTP" alias -x mover="/TELESUP/PRVXL/MOVER" (or where ever you put your copy) [from Michael Hensley] And another one that Unix users are really irritated not to have is: alias -x ll="ls -l" -----Change #6----- # Clear the screen, set the tab stops and print out the message of the # day Note - if your system is using terminal types other than the # default HP2392a, the clear will not work properly since sends codes # to clear the screen based on the setting of TERM tput clear tabs cat /etc/motd OK, for those of you that don't like the screen cleared, delete or comment out the 'tput clear'. You pretty much need the tabs. If you don't like that banner remove or comment out 'cat /etc/motd'. And if you want a banner but would like to make your own, edit /etc/motd and put in whatever you like. -----Change #7----- This is an additional line; you can put it up with #1 or anywhere else in the file. If you're using Gnu/perl/etc, you will need to set MANPATH to look in the man pages directory for Gnu. Add the line: export MANPATH=${MANPATH:-/usr/local/man:/usr/man:} -----Change #8----- [Added by me, Michael Hensley] The following are all from the MPE/iX 6.0 /etc/profile: umask 7 set -o ignoreeof export HPSHELLINT=1 export ENV=$HOME/.environ export LOGNAME=`logname` # Set up variables so that the shell will check for mail in # /usr/mail/$LOGNAME every 3 minutes export MAILPATH=/usr/mail/$LOGNAME export MAILCHECK=180 #export HOME=$PWD #The line above is being replaced with the following (don't ask -- if #you must know, wait and read the comments in the MPE/iX 6.0 #/etc/profile). if [ "$HPHGROUP" = "" ] ; then export HISTFILE=${HISTFILE:-/$HPACCOUNT/$HPGROUP/.sh_history} else export HISTFILE=${HISTFILE:-/$HPACCOUNT/$HPHGROUP/.sh_history} fi if [ "$HPHGROUP" = "" ] ; then export HOME=${HOME:-/$HPACCOUNT/$HPGROUP} else export HOME=${HOME:-/$HPACCOUNT/$HPHGROUP} fi export ENV=$HOME/.environ -----Change #9----- Finally, the neat new thing (which also comes from MPE/iX 6.0): # (new) if /etc/profile.local exists then execute it. This file should # only contain site specific profile changes. if [ -r /etc/profile.local ] ; then . /etc/profile.local fi The idea is that, starting with MPE/iX 6.0, you shouldn't make changes to /etc/profile anymore; instead, put your local customizations into the file /etc/profile.local. This way, HP can replace /etc/profile without wiping out your local customizations! ====================================================================== ====================================================================== Now pick up copies of GNU C++, Perl, Python, Java, and on of the WWW servers and have fun! ======================================================================