klm@cme.nist.gov (Ken Manheimer) (09/21/90)
In article <FPB.90Sep20205953@ittc.ittc.wec.com> fpb@ittc.wec.com (Frank P. Bresz) writes: > I too find FRAME obtrusive. I hate having that stupid FMHOME env >lying around but it just won't work without it, and I can't create a >symlink to it because it checks how it was called (what a crock). I had to >take the extra step of informing every single user on the system that if >they want FRAME they must use 'fmusersetup' first (Something left untaught >in FRAME class). New accounts that are created I handle by throwing this >into their .cshrc. Anyway [...] I agree. While the FrameMaker package does some things more nicely than a lot of other packages (of any ilk) that i've seen, requiring all users to change their environment in order to use a software package seems unmanageably intrusive. That's particularly so considering that other packages account for the same things without intruding that way. We have been using a wrapper for FrameMaker invocation that circumvents this problem (though it was implemented primarily for a rather different purpose). The different purpose is support for different entire versions of maker. While each version of maker automatically accomodates a variety of platforms there's currently no nifty provisions for accomodating different versions of the FrameMaker software software itself at a single installation. We support both X and sunview window environments, and hence have around at least one version of maker for each window system. In order to clean up a proliferation of invocation interfaces, we put together a single script that starts up the suitable version of maker according to the script's invocation name (which can vary depending on the symbolic link by which it is invoked) and environment variable settings that distinguish X and sunview environments. There are two side benefits implemented in the script. One is setting of the FMHOME and shell 'path' environment for the user by the script so the user need not worry about the location of or suitable environment settings for the different maker versions, but only needs know where to access to the script itself, which can be located wherever the administrator wants. The other benefit is a nifty hack (which Scott Paisley dreamed up) that pseudo-randomly selects between one of two frame license servers that we have available, thereby balancing the consumption of licenses between the two and virtually eliminating the need for users to explicitly select one license server or the other. Here is the script. Some of the defaulting choices are arbitrary and adjusted to suit the balance of usage we happen to have at my installation. I think it's ok to mention that, due to a non-disclosure agreement, i've excised references to one of the versions we support. I think the script is still useful for just the two versions. I think the comments (and the simplicity of the thing) make it fairly self-explanatory. Ken Manheimer Nat'l Inst of Standards and Technology klm@cme.nist.gov (301)975-3539 (Formerly Nat'l Bureau of Standards) Factory Automation Systems Division Unix Systems Support Manager I like time. It's one of my favorites. 8<--------------------- script below ------------------------>8 #!/bin/sh -f # Script to invoke various versions of maker. See definitation of the # usageMessage below for a description of variations. I'm whipping # this up from the slew of different commands that have been created # in a slew of different places. KLM 14-Aug-1990 # Establish tail of script invocation name. Script behaviors are dictated to # a large degree by pseudonym used: # ($IFS is used by shell to determine field seperators. By including the # path component delimiter "/" we can use 'for' to parse the components.) wasIFS=$IFS; IFS="/$IFS" for component in $0 ; do scriptName="$component"; done # Restore IFS to unfinagled state: IFS=$wasIFS ### # Different maker versions' startup scripts: ### XVersion13=/depot/xframe/bin/maker SviewVersion21=/depot/frame/bin/maker ### # Help message for "-help" option or for unimplemented or retired pseudonyms. ### usageMessage=\ "'maker': from X or with '-display' arg, starts X version of maker 1.3, else from Sunview, starts Sunview maker 2.1; 'maker2': from X or Sunview, starts Sunview maker 2.1 if possible; if echo "$1" | grep -s "-help"; then echo "$usageMessage" fi ### # Do check to establish windowing environment where script was invoked. ### if test -n "$DISPLAY" || echo "$*" | grep -se "-display"; then environ=x elif test -n "$WINDOW_PARENT"; then environ=sview elif test "$scriptName" != maker2; then echo "($scriptName: Can't determine windowing environment, trying X...)" environ=x DISPLAY=unix:0.0; export DISPLAY else environ="" fi ### # Use modulo 2 math on PID to select randomly between two license servers: # (Adapted from a nifty csh method of Scott Paisley's) ### if test `echo "($$ / 2) * 2" | bc` = $$; then FRAMEUSERSD_HOST=imp; export FRAMEUSERSD_HOST else FRAMEUSERSD_HOST=dip; export FRAMEUSERSD_HOST fi echo "Using $FRAMEUSERSD_HOST as default license server," ### # Okay, here's the dirty work: ### # Default 'maker' and undocumented 'maker.all' versions: if test "$scriptName" = maker -o "$scriptName" = maker.all; then # Start 1.3 X for x invocation or 2.1 sview for sunview invocation if test "$environ" = x; then echo "Trying X version 1.3 maker," exec $XVersion13 $* elif test "$environ" = sview; then echo "Trying Sunview version 2.1 maker," exec $SviewVersion21 $* else echo "Unimplemented version $version - report to <system administrator>" fi # 'maker2' version: elif test "$scriptName" = maker2; then echo "Trying Sunview version 2.1 maker," # Start sunview 2.1 version if test -z "$WINDOW_PARENT"; then echo "'WINDOW_PARENT' environment variable not defined, so sunview maker" echo "probably can't find where to display and won't start." echo "Trying, anyway..." fi exec $SviewVersion21 $* # unrecognized or retired version - give user options and exit: else echo -n "'$scriptName'" if test "$scriptName" = maker21; then # Retired - tell user and make 'em use different command: echo " maker-startup command is being retired." else echo " is not a properly implemented maker-startup command." fi echo "" echo "Here are the alternatives:" echo "" echo "$usageMessage" echo "" echo "Exiting..." fi