[comp.mail.elm] elm 2.1PL1 - general comments Re. undefined MAILDIR

jeff@cjsa.WA.COM (Jeffery Small) (12/25/88)

In article <79@titania.warwick.ac.uk>, cudcv@warwick.ac.uk (Rob McMahon) writes:
> 
> Having the default save filename be `=sender', and having elm come back with
> `MAILDIR not defined.  Can't expand '='' when you try to accept it is not
> encouraging to the first time user.  I've had one person who was completely
> put off elm by this.  MAILDIR should have a sensible default ($HOME ?).  Also
> if the message is from e.g. `R.J.McMahon', the default will be `=r', couldn't
> this be `=r.j.mcmahon' ?
> 

Yes, this has been confusing for novice users.  Also, when you want to C)hange
to a new mailbox, and ask [?] for a list, you need to type "=newmailbox" rather
than just "newmailbox" (as is displayed on the screen) if you aren't in your
current mail directory when you fired ELM up.

All of our novice users access ELM from a window-based menu selection (the
User Agent on AT&T 3B1's) rather than from a shell command and they never
even see their .elm directory!  What I did was put a shell script wrapper
around elm (called elm.sh) which does the following:

  - If the $ELMDIR  ($HOME/.elm) directory or the $MAILDIR (default on our
    system is $HOME/Filecabinet/Mail) is missing, this means that this must
    be the first time the user is using ELM.  We create both of these
    directories for them.

  - Next, we copy our customized "elmrc-template" file to their .elm directory.
    This template has the following which expand properly for everyone:
	maildir = ~/Filecabinet/Mail
	mailbox = ~/Filecabinet/Mail/mbox
	calendar = ~/calendar
	localsignature = ~/.elm/.localsig
	remotesignature = ~/.elm/.remotesig
  
  - We get the user's full name from our passwd file and splice that into
    their elmrc file and automatically generate default signature files.

  - We then cd to $MAILDIR so that all the mailbox files are local (don't
    need to use =) and finally fire elm up.

This seems to work reasonably well for the novice users.  More experienced
people use ELM directly from the shell and can ignore any or all of the
default behavior imposed by the shell script.

For anyone who is interested, I have attached our elm.sh file below which
could be used as a starting point for a similar effort on other systems.
--
Jeffery Small    (206) 485-5596            uw-beaver!uw-nsr!uw-warp
C. Jeffery Small and Associates                                    !cjsa!jeff
19112 152nd Ave NE - Woodinville, WA  98072           uunet!nwnexus

------- elm.sh ----------------------------------------------------------

#########################################################################
#									#
# Program:		elm.sh			(Bourne Shell Script)	#
# Version:		1.1						#
#									#
# Original Coding:	C. Jeffery Small		Date: 08-21-87  #
# Latest Revision:	C. Jeffery Small 		Date: 12-20-88  #
#									#
# DSCRIPTION								#
#	A shell script used to interface with the User Agent ELM_Mail 	#
#	script to drive the elm mail program.				#
#									#
#########################################################################

# If user defines and exports these variables, they will override the
# built-in defaults.

MAILDIR=${MAILDIR:-$HOME/Filecabinet/Mail}
ELMDIR=${ELMDIR:-$HOME/.elm}

#########################################################################
# If the ELM or MAIL dirs. do not exist, then we assume that this is 	#
# first time to use elm by this user and we set up the required files.	#
#########################################################################

if [ ! -d $ELMDIR  -o ! -d $MAILDIR ] 	   # If true, then ELM not setup
then
    USERNAME=`grep "^$LOGNAME:" /etc/passwd | cut -d: -f5`

    if [ ! -d $MAILDIR ]
    then
	mkdir $MAILDIR
	touch $MAILDIR/mbox
	
	chmod 755      $MAILDIR
	chmod 664      $MAILDIR/mbox
	chgrp mail     $MAILDIR $MAILDIR/mbox
	chown $LOGNAME $MAILDIR $MAILDIR/mbox
    fi
    
    if [ ! -d $ELMDIR ]
    then
      mkdir $ELMDIR
      echo  "$LOGNAME" > $ELMDIR/.localsig
      echo  "$USERNAME  at  ...!`uuname -l`!$LOGNAME" > $ELMDIR/.remotesig
      cp    /usr/llib/elm/elmrc-template  $ELMDIR/elmrc
      chmod 755      $ELMDIR $ELMDIR/elmrc
      chmod 664      $ELMDIR/.localsig $ELMDIR/.remotesig $ELMDIR/elmrc
      chgrp mail     $ELMDIR $ELMDIR/.localsig $ELMDIR/.remotesig $ELMDIR/elmrc
      chown $LOGNAME $ELMDIR $ELMDIR/.localsig $ELMDIR/.remotesig $ELMDIR/elmrc
      ed - $ELMDIR/elmrc <<-ENDofEDIT
	s/^fullname.*$/fullname = $USERNAME/
	w
	q
	ENDofEDIT
    fi
fi

if [ $# -ge 2  -a  "$1" = "-f" ]
then
    if [ ! -f $2 ]
    then
	echo "There is no mail currently saved in:  `basename $2`.\n"
	echo "If you wish to examine mail saved in other mailboxes, then use"
	echo "menu selection  1:  and then  C)hange to the desired mailbox.\n"
	echo "\nPress  RETURN  to continue: \c"
	read ANS
	exit 0
    fi
fi
    
cd $MAILDIR
/usr/lbin/elm $*

exit 0
-----------------------------------------------------------------------------