home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / unix / volume9 / elm2 / patch01 / Configure.sh
Text File  |  1987-03-12  |  20KB  |  967 lines

  1. : Use /bin/sh
  2. #
  3. # Configure.sh, a shell script for configuring the Elm mail system for
  4. #     your site and desires.  This script uses some ideas ripped out
  5. #    of the 'rn' install script.  Thanks Larry!
  6. #
  7.  
  8. export PATH || (sh $0 ; kill $$)
  9.  
  10. SHELL=/bin/sh
  11.  
  12. SED1=/tmp/Elm.sed1
  13. SED2=/tmp/Elm.sed2
  14.  
  15. if [ -f /bin/rm ]
  16. then
  17.   rm=/bin/rm
  18. else
  19.   rm=rm
  20. fi
  21.  
  22. $rm -f $SED1 $SED2
  23. touch $SED1 $SED2
  24. chmod 777 $SED1 $SED2
  25.  
  26. # first test - is stdin still free for answering questions??
  27. if [ ! -t 0 ]
  28. then
  29.   echo "Please use 'sh Configure.sh' rather than 'sh < Configure.sh'"
  30.   exit 1
  31. fi
  32.  
  33. # next let's see what sorta echo flag we have here...
  34.  
  35. if [ "`echo -n`" = "-n" ]
  36. then
  37.   nflag=""
  38.   cflag="\\c" 
  39. else
  40.   nflag="-n"
  41.   cflag=""
  42. fi
  43.  
  44. # now the intro blurb
  45.  
  46. cat << END_OF_INTRO
  47.  
  48.                    Elm Configuration Script, v4
  49.        
  50.       
  51.     This is the configuration script for the Elm mail system.  By using
  52.     it rather than editing the "hdrs/sysdefs.h" file, it is hoped that
  53.     the installation process will be considerably easier.
  54.  
  55.     On all questions, the value in [square brackets] is the default that 
  56.     will be used if you just press RETURN...
  57.  
  58.  
  59. END_OF_INTRO
  60.  
  61. echo "Trying to figure out what sort of OS you're on..."
  62.  
  63. # next interesting part - figure out what OS we're on
  64.  
  65. os_name=""
  66.  
  67. $rm -f .osname
  68. touch .osname
  69.  
  70. cat << 'EOF' > .get_osname
  71.  
  72. uname
  73.  
  74. if [ $? != 0 ] 
  75. then
  76.   if [ -f /vmunix ]
  77.   then
  78.     echo "bsd" > .osname
  79.   else
  80.     exit 0
  81.   fi
  82. fi
  83.  
  84. if [ "`uname -s`" != "" ]
  85. then
  86.    uname -s | tr '[A-Z]' '[a-z]' > .osname
  87. fi
  88.  
  89. exit 0
  90.  
  91. EOF
  92.  
  93. sh .get_osname > /dev/null 2>&1
  94.  
  95. if [ -f .osname ] 
  96. then
  97.   os_name="`cat .osname`"
  98.   $rm -f .osname
  99. fi
  100.  
  101. $rm -f .get_osname
  102.  
  103. if [ "$os_name" = "" ] 
  104. then
  105.   cat << THE_END
  106.  
  107. I cannot figure out what sort of operating system you're running here.  Please
  108. type in the NAME of the OS you're running or the name of the machine you're
  109. THE_END
  110.  
  111.   echo $nflag "running on.  I'll check the name in a minute : " $cflag
  112.  
  113.   read junk morejunk
  114.   
  115.   os_name=`echo $junk | tr '[A-Z]' '[a-z]'`
  116. fi
  117.  
  118. OS_FLAG="HUH??"
  119.  
  120. while [ "$OS_FLAG" = "HUH??" ]
  121. do
  122.  
  123.   case $os_name in
  124.     hp)        NAME="HP-UX"; OS_FLAG=""        ;;
  125.     hp-ux)     NAME="HP-UX"; OS_FLAG="";           ;;
  126.     vax)    NAME="BSD"; OS_FLAG="BSD";      ;;
  127.     vaxen)    NAME="BSD"; OS_FLAG="BSD";      ;;
  128.     bsd)    NAME="BSD"; OS_FLAG="BSD";      ;;
  129.     uts)    NAME="UTS"; OS_FLAG="UTS";      ;;
  130.     sun)    NAME="BSD"; OS_FLAG="";        ;;
  131.     pyramid)    NAME="Pyramid BSD"; OS_FLAG="PYRAMID";    ;;
  132.     amdahl)    NAME="UTS"; OS_FLAG="UTS";      ;;
  133.     sv_*)    NAME="System V"; OS_FLAG="";        ;;
  134.     svii_*)    NAME="System VII"; OS_FLAG="";        ;;
  135.     v5)        NAME="System V"; OS_FLAG="";        ;;
  136.     v7)        NAME="System VII"; OS_FLAG="";        ;;
  137.     eunice)    NAME="Eunice"; OS_FLAG="";        ;;
  138.     convergent)    NAME="Convergent BSD"; OS_FLAG="BSD";        ;;
  139.     berkeley)    NAME="BSD"; OS_FLAG="BSD";        ;;
  140.     ultrix)    cat << THE_END
  141.  
  142. I know that this is a breed of Unix, but I don't know what TYPE of OS it
  143. is like.  Please enter the NAME of the OS that this is most like (e.g. "BSD")
  144. and we'll go from there.
  145.  
  146. THE_END
  147.                     ;;
  148.     xenix)    cat << THE_END
  149.  
  150. You're outta luck.  Xenix (dumb OS that it is only allows 6 character 
  151. identifier names.  You'll need to go in and LABORIOUSLY translate all the
  152. VERY LONG identifier names to the right length.   The correct response to 
  153. seeing this message is to call your vendor and get ANGRY!!!!
  154.  
  155. Meanwhile, we might as well just quit here.  Sorry.
  156. THE_END
  157. exit 1
  158.                     ;;
  159.     *)        cat << THE_END
  160.  
  161. I don't know what OS you're specifying!  The only one's I know of are;
  162.  
  163.   HP-UX, BSD, UTS, Eunice, Xenix, Ultrix, V5, and V7
  164.  
  165. I also know the machines
  166.  
  167.   HP, Amdahl, Sun, Vaxen, Convergent and Pyramid
  168.  
  169. If you're not among this list, you'll need to pick the closest OS name.  
  170. THE_END
  171.  
  172.     echo " "
  173.     echo $nflag "Please choose again: " $cflag
  174.     read os_name
  175.     ;;
  176.   esac
  177.  
  178. done
  179.  
  180. echo " "
  181. echo " "
  182. echo you\'re on the following version of Unix: $NAME
  183.  
  184. echo " "
  185. echo "Now we can get down to those questions..."
  186. echo " "
  187.  
  188. cat << THE_END
  189.  
  190. First off, should the program use "uuname" rather than trying to read 
  191. THE_END
  192.  
  193. not_using_lsys_file=0
  194.  
  195. answer="yes"
  196. echo $nflag "the L.sys file (y/n) [yes] ? "  $cflag
  197. read answer
  198.  
  199. if [ "$answer" = "n" -o "$answer" = "no" ]
  200. then
  201.   not_using_lsys_file=1
  202.   echo "s/#define USE_UUNAME/\/** #define USE_UUNAME **\//" >> $SED1
  203. fi
  204.  
  205. cat << THE_END
  206.  
  207. Next, are you running smail, a "gateway" configuration of sendmail, or some 
  208. other program that means the program shouldn't touch any of the addresses 
  209. THE_END
  210.  
  211. answer="no"
  212. dont_touch_addresses=0
  213. echo $nflag "that users type in (y/n) [no] ? " $cflag
  214. read answer
  215.  
  216. if [ "$answer" = "y" -o "$answer" = "yes" ]
  217. then
  218.   dont_touch_addresses=1
  219.   echo \
  220. "s/\/\*\* #define DONT_TOUCH_ADDRESSES \*\*\//#define DONT_TOUCH_ADDRESSES /" \
  221.   >> $SED1
  222.   echo \
  223. "s/\/\*\* #define DONT_OPTIMIZE_RETURN \*\*\//#define DONT_OPTIMIZE_RETURN /" \
  224.   >> $SED1
  225. fi
  226.  
  227. cat << THE_END
  228.  
  229. Does your site receive mail with valid "Reply-To:" and "From:" fields in
  230. THE_END
  231.  
  232. answer="no"
  233. echo $nflag "the headers (y/n) [no] ? " $cflag
  234. read answer
  235.  
  236. if [ "$answer" != "y" -a "$answer" != "yes" ]
  237. then
  238.   echo \
  239. "s/#define USE_EMBEDDED_ADDRESSES/\/** #define USE_EMBEDDED_ADDRESSES **\//" \
  240.   >> $SED1
  241. fi
  242.  
  243. cat << THE_END
  244.  
  245. -------------------------------------------------------------------------------
  246.  
  247. How about memory?  If you have a lot, you can enter a fairly large number
  248. for the next few questions...if not, you'll probably want to enter the
  249. suggested small-system values.  (This applies to the speed of the swapping
  250. on your system too - if you're on a FAST system, use the big values!)
  251.  
  252. First, how many aliases should be allowed for an individual user? The suggested
  253. values are 503 for blindly fast systems, 251 for average systems and 127 for
  254. THE_END
  255.  
  256. max_ualiases="NONE"
  257.  
  258. while [ "$max_ualiases" = "NONE" ] 
  259. do 
  260.  
  261.   echo $nflag "slow systems.  Number of aliases [251] ? " $cflag 
  262.  
  263.   read junk
  264.  
  265.   if [ "$junk" = "" ] 
  266.   then
  267.     junk=251
  268.   fi
  269.  
  270.   if [ $junk -lt 50 -o $junk -gt 1000 ] 
  271.   then
  272.     echo \
  273. "Pretty strange answer!  I think you should reconsider and try this question "\
  274.     echo "again..."
  275.     echo " "
  276.   else
  277.     max_ualiases=$junk
  278.     echo "s/>251</$max_ualiases/" >> $SED1
  279.     case $junk in
  280.     127) default=223    ;;
  281.     503) default=739    ;;
  282.     *  ) default=503    ;;
  283.     esac
  284.   fi
  285. done
  286.  
  287. max_saliases="NONE"
  288.  
  289. while [ "$max_saliases" = "NONE" ] 
  290. do 
  291.  
  292.   echo $nflag "Max number of system aliases available  [$default] ? " $cflag
  293.  
  294.   read junk
  295.  
  296.   if [ "$junk" = "" ] 
  297.   then
  298.    junk=$default
  299.   fi
  300.  
  301.   if [ $junk -lt 50 -o $junk -gt 1000 ] 
  302.   then
  303.     echo "Pretty far out value for this question!  I think you should reconsider"
  304.     echo "your answer and try this question again..."
  305.     echo " "
  306.   else
  307.     max_saliases=$junk
  308.     echo "s/>503</$max_saliases/" >> $SED1
  309.   fi
  310. done
  311.  
  312. cat << THE_END
  313.  
  314. The next pair of questions have to do with what to do when another program has 
  315. locked a mailbox...
  316.  
  317. First, how many times should the program check for the removal of the lock
  318. THE_END
  319.  
  320. default=6
  321.  
  322. max_attempts="NONE"
  323.  
  324. while [ "$max_attempts" = "NONE" ] 
  325. do 
  326.  
  327.   echo $nflag "file before giving up? [6] " $cflag
  328.  
  329.   read junk
  330.  
  331.   if [ "$junk" = "" ] 
  332.   then
  333.    junk=$default
  334.   fi
  335.  
  336.   if [ $junk -lt 3 -o $junk -gt 10 ] 
  337.   then
  338.     echo \
  339. "The recommended range is 3-10   ...Number of times to check lock"
  340.   else
  341.     max_attempts=$junk
  342.     echo "s/>6</$max_attempts/" >> $SED1
  343.   fi
  344. done
  345.  
  346. echo " "
  347. answer="no"
  348. echo $nflag "Should it REMOVE the lockfile after $max_attempts checks [no] ?" \
  349.      $cflag
  350. read answer
  351.  
  352. if [ "$answer" != "y" -a "$answer" != "yes" ]
  353. then
  354.   echo \
  355. "s/#define REMOVE_AT_LAST/\/** #define REMOVE_AT_LAST **\//" \
  356.   >> $SED1
  357. fi
  358.  
  359. if [ "$NAME" = "BSD" ]
  360. then 
  361.   ps="ps -cax"
  362. else
  363.   ps="ps -ef"
  364. fi
  365.  
  366. echo " "
  367. echo " "
  368. echo "poking about a bit.."
  369.  
  370. result="`$ps | grep sendmail | grep -v grep`"
  371.  
  372. if [ "$result" = "" ]
  373. then
  374.   if [ -f /usr/lib/sendmail -a -f /usr/lib/sendmail.cf ]
  375.   then
  376.     echo \(sendmail available - assuming you don\'t run it as a daemon\)
  377.     result="ok"
  378.   fi
  379. fi
  380.  
  381. if [ "$result" != "" ]
  382. then
  383.   echo "You're running sendmail.  Well done, I guess..."
  384.   echo "s/\/\*\* #define ALLOW_BCC \*\*\//#define ALLOW_BCC/" \
  385.     >> $SED1
  386.   echo "s/\/\*\* #define DONT_ADD_FROM \*\*\//#define DONT_ADD_FROM/" \
  387.     >> $SED1
  388.     echo \
  389.  "s/#define USE_DOMAIN/\/** #define USE_DOMAIN **\//" \
  390.     >> $SED1
  391. else
  392.  
  393.   cat << THE_END
  394.  
  395. Since you're not running sendmail, should I check local user entered addresses
  396. THE_END
  397.  
  398. answer="yes"
  399. echo $nflag "against the valid mailboxes on this system [yes] ? " $cflag
  400. read answer
  401.  
  402. if [ "$answer" != "y" -a "$answer" != "yes" -a "$answer" != "" ]
  403. then
  404.   echo \
  405. "s/#define NOCHECK_VALIDNAME/\/** #define NOCHECK_VALIDNAME **\//" \
  406.   >> $SED1
  407. fi
  408.  
  409. cat << THE_END
  410.  
  411. Are you running a machine where you want to have a domain name appended to the
  412. THE_END
  413.  
  414. answer="yes"
  415. echo $nflag "hostname on outbound mail [no] ? " $cflag
  416. read answer
  417.  
  418. if [ "$answer" != "y" -a "$answer" != "yes" ]
  419. then
  420.     echo \
  421.  "s/#define USE_DOMAIN/\/** #define USE_DOMAIN **\//" \
  422.     >> $SED1
  423. else
  424.   echo " "
  425.   echo $nflag "Enter the domain name (include leading '.') : " $cflag
  426.   read answer
  427.   echo "s/<enter your domain here>/$answer/" >> $SED1
  428. fi
  429.  
  430. fi
  431.  
  432. # next let's see if we can find the vfork command on this system..
  433.  
  434. cat << EOF > .test.c
  435. main()
  436. {
  437.     (void) vfork();
  438. }
  439. EOF
  440.  
  441. if [ "$NAME" = "UTS" ]
  442. then
  443. cat << EOF > .vfork
  444. cc -la .test.c
  445. EOF
  446. else
  447. cat << EOF > .vfork
  448. cc .test.c
  449. EOF
  450. fi
  451.  
  452. sh .vfork > .log 2>& 1
  453.  
  454. if [ "`cat .log | wc -l`" -eq "0" ]
  455. then
  456.   echo "You have virtual memory system calls available.  Cool..."
  457. else
  458.   cat << THE_END
  459.  
  460. Your machine doesn't seem to have the vfork command available.  Should I assume
  461. THE_END
  462.  
  463.   answer="no"
  464.   echo $nflag "you have it, anyway [no] ? " $cflag
  465.   read answer
  466.  
  467. if [ "$answer" != "y" -a "$answer" != "yes" ]
  468.   then
  469.     echo "s/\/\*\* #define NO_VM \*\*\//#define NO_VM/" >> $SED1
  470.   fi
  471. fi
  472.  
  473. $rm -f a.out .test.c .vfork .log
  474.  
  475. # next let's see if we have the gethostname() system call...
  476.  
  477. cat << EOF > .test.c
  478. main()
  479. {
  480.     (void) gethostname();
  481. }
  482. EOF
  483.  
  484. cat << EOF > .hostname
  485. cc .test.c
  486. EOF
  487.  
  488. sh .hostname > .log 2>& 1
  489.  
  490. if [ "`cat log | wc -l`" -eq "0" ]
  491. then
  492.   echo "You have the 'gethostname()' system call..."
  493. else
  494.   echo "s/\/\*\* #define NEED_GETHOSTNAME \*\*\//#define NEED_GETHOSTNAME/" \
  495.   >> $SED1
  496. fi
  497.  
  498. $rm -f a.out .test.c .hostname .log
  499.  
  500. # next let's see if we have long variable names...
  501.  
  502. cat << EOF > .test.c
  503. main()
  504. {
  505.     int this_is_a_long_variable=0;
  506.  
  507.     (void) this_is_a_long_variable_routine_name(this_is_a_long_variable);
  508.     
  509. }
  510. this_is_a_long_variable_routine_name() { }
  511. EOF
  512.  
  513. cat << EOF > .varname
  514. cc .test.c
  515. EOF
  516.  
  517. sh .varname > .log 2>& 1
  518.  
  519. if [ "`cat .log | wc -l`" -eq "0" ]
  520. then
  521.   echo "You have long variable names.  Well done!!!!!"
  522. else
  523.   echo "How embarassing.  Your C compiler doesn't support long variables..."
  524.   echo "s/\/\*\* #define SHORTNAMES \*\*\//#define SHORTNAMES/" \
  525.   >> $SED1
  526. fi
  527.  
  528. $rm -f a.out .test.c .varname .log
  529.  
  530. if [ $dont_touch_addresses = 0 ]
  531. then
  532. cat << THE_END
  533.  
  534. When given a machine that you talk to directly, should the 'pathalias' route to
  535. THE_END
  536.  
  537.  answer="no"
  538.  echo $nflag "the machine be used instead [no] ? " $cflag
  539.  read answer
  540.  
  541.  if [ "$answer" != "y" -a "$answer" != "yes" ]
  542.  then
  543.     echo \
  544.  "s/#define LOOK_CLOSE_AFTER_SEARCH/\/** #define LOOK_CLOSE_AFTER_SEARCH **\//"\
  545.     >> $SED1
  546.  fi
  547. fi
  548.  
  549. answer="yes"
  550. echo " "
  551. echo $nflag "Is the preferred address notation 'user@host' [yes] ?" $cflag
  552. read answer
  553.  
  554. if [ "$answer" != "y" -a "$answer" != "yes" -a  "$answer" != "" ]
  555. then
  556.     echo \
  557.  "s/#define INTERNET_ADDRESS_FORMAT/\/** #define INTERNET_ADDRESS_FORMAT **\//" \
  558.     >> $SED1
  559. fi
  560.  
  561. echo " "
  562. answer="yes"
  563. echo $nflag "Am I going to be running as a setgid program [yes] ? "$cflag
  564. read answer
  565.  
  566. if [ "$answer" != "y" -a "$answer" != "yes" -a "$answer" != "" ]
  567. then
  568.   echo answer is currently equal to \"$answer\"
  569.   echo \
  570.  "s/#define SAVE_GROUP_MAILBOX_ID/\/** #define SAVE_GROUP_MAILBOX_ID **\//" \
  571.     >> $SED1
  572. fi
  573.     
  574. cat << THE_END
  575.  
  576.  
  577. For any of the questions after this point, you can press RETURN if the 
  578. questions doesn't apply, or there's no reasonable answer...
  579.  
  580. THE_END
  581.  
  582. if [ $dont_touch_addresses = 0 ]
  583. then 
  584.  if [ ! -f /usr/lib/nmail.paths ] 
  585.  then
  586.    echo $nflag "Where does the output of pathalias live ? " $cflag
  587.    read answer
  588.  
  589.    if [ "$answer" != "" ]
  590.    then
  591.      echo "s^/usr/lib/nmail.paths^$answer^" >> $SED1
  592.    fi
  593.  fi
  594. fi
  595.  
  596. use_dbm=0
  597.  
  598. if [ $dont_touch_addresses = 0 ]
  599. then
  600.   if [ -f $answer.pag -a -f $answer.dir ]
  601.   then
  602.     echo "You have pathalias as a DBM file...I'll use that instead."
  603.     echo "s^/\*\* #define USE_DBM \*\*/^#define USE_DBM^" >> $SED1
  604.     use_dbm=1
  605.   fi
  606. fi
  607.  
  608. case $OS_FLAG in 
  609.   BSD) echo "s/>os-define</-DBSD/"    >> $SED2
  610.        echo "s/>lib2</-lcurses/"      >> $SED2
  611.        if [ $use_dbm = 1 ]
  612.        then
  613.          echo "s/>libs</-ltermcap -ldbm/" >> $SED2
  614.        else
  615.          echo "s/>libs</-ltermcap/"       >> $SED2
  616.        fi
  617.        ;;
  618.  
  619.   PYRAMID) echo "s/>os-define</"-DBSD -DNO_VAR_ARGS"/" >> $SED2
  620.        echo "s/>lib2</-lcurses/"      >> $SED2
  621.        if [ $use_dbm = 1 ]
  622.        then
  623.          echo "s/>libs</-ltermcap -ldbm/"     >> $SED2
  624.        else
  625.          echo "s/>libs</-ltermcap/"     >> $SED2
  626.        fi
  627.        ;;
  628.  
  629.   UTS) echo "s/>os-define</-DUTS/"    >> $SED2
  630.        echo "s/>lib2</-la -lq/"       >> $SED2
  631.        if [ $use_dbm = 1 ]
  632.        then
  633.          echo "s/>libs</-lcurses -ldbm/" >> $SED2
  634.        else
  635.          echo "s/>libs</-lcurses/"       >> $SED2
  636.        fi
  637.        ;;
  638.  
  639.   *)   echo "s/>os-define<//"         >> $SED2
  640.        echo "s/>lib2<//"              >> $SED2
  641.        if [ $use_dbm = 1 ] 
  642.        then
  643.          echo "s/>libs</-ltermcap -ldbm/" >> $SED2
  644.        else
  645.          echo "s/>libs</-ltermcap/"       >> $SED2
  646.        fi
  647.        ;;
  648.  
  649. esac
  650.  
  651.  
  652. if [ $dont_touch_addresses = 0 ]
  653. then
  654.  if [ ! -f /usr/lib/domains ] 
  655.  then
  656.    echo $nflag "Where does the 'domains' file live ? " $cflag
  657.    read answer
  658.  
  659.    if [ "$answer" != "" ]
  660.    then
  661.      echo "s^/usr/lib/domains^$answer^" >> $SED1
  662.    fi
  663.  fi
  664. fi
  665.  
  666. if [ $not_using_lsys_file = 1 ]
  667. then
  668.   if [ ! -f /usr/lib/uucp/L.sys ]
  669.   then
  670.     echo $nflag "Where does the 'L.sys' file live ? " $cflag
  671.     read answer
  672.  
  673.     if [ "$answer" != "" ]
  674.     then
  675.       echo "s^/usr/lib/uucp/L.sys^$answer^" >> $SED1
  676.     fi
  677.   fi
  678. fi
  679.  
  680. if [ ! -d /tmp ]
  681. then 
  682.   echo $nflag "/tmp isn't a directory!  What should I use?? " $cflag
  683.   read answer
  684.  
  685.   if [ "$answer" != "" ]
  686.   then
  687.     echo "s^/tmp^$answer^" >> $SED1
  688.   fi
  689. fi
  690.  
  691. if [ ! -f /usr/ucb/vi -a "$os_name" = "BSD" ]
  692. then
  693.   echo $nflag "I can't find the 'vi' editor!  Where is it? " $cflag
  694.   read answer
  695.  
  696.   if [ "$answer" != "" ]
  697.   then
  698.     echo "s^/usr/ucb/vi^$answer^" >> $SED1
  699.   fi
  700. elif [ ! -f /usr/bin/vi -a "$os_name" = "" ]
  701. then
  702.   echo $nflag \
  703.     "I can't find the 'vi' editor!  Where is it? " $cflag
  704.   read answer
  705.  
  706.   if [ "$answer" != "" ]
  707.   then
  708.     echo "s^/usr/bin/vi^$answer^" >> $SED1
  709.   fi
  710. fi
  711.  
  712. if [ ! -d /usr/spool/mail -a "$os_name" = "BSD" ]
  713. then
  714.   echo $nflag "I can't find your inbound mail directory!  Where is it? " $cflag
  715.   read answer
  716.  
  717.   if [ "$answer" != "" ]
  718.   then
  719.     echo "s^/usr/spool/mail^$answer^" >> $SED1
  720.   fi
  721. elif [ ! -d /usr/mail -a "$os_name" = "" ]
  722. then
  723.   echo $nflag "I can't find your inbound mail directory!  Where is it? " $cflag
  724.   read answer
  725.  
  726.   if [ "$answer" != "" ]
  727.   then
  728.     echo "s^/usr/mail^$answer^" >> $SED1
  729.   fi
  730. fi
  731.  
  732. if [ ! -f /bin/rm ]
  733. then
  734.   echo $nflag "Where's the 'rm' program? " $cflag
  735.   read answer
  736.  
  737.   if [ "$answer" != "" ]
  738.   then
  739.     echo "s^/bin/rm^$answer^" >> $SED1
  740.   fi
  741. fi
  742.  
  743. if [ ! -f /bin/cat ]
  744. then
  745.   echo $nflag "Where's the 'cat' program? " $cflag
  746.   read answer
  747.  
  748.   if [ "$answer" != "" ]
  749.   then
  750.     echo "s^/bin/rm^$answer^" >> $SED1
  751.   fi
  752. fi
  753.  
  754. if [ ! -c /dev/rct ]
  755. then
  756.   if [ ! -c /dev/rmt ]
  757.   then
  758.     echo $nflag "What's the name of your remote-tape unit? " $cflag
  759.     read answer
  760.  
  761.     if [ "$answer" = "" ]
  762.     then
  763.       echo "s^>tapeunit<^unknown-remote-tape-unit^" >> $SED2
  764.     else
  765.       if [ ! -c $answer ] 
  766.       then
  767.     if [ -c /dev/$answer ]
  768.     then
  769.           echo "s^>tapeunit<^/dev/$answer^" >> $SED2
  770.         else
  771.           echo \
  772.            "I can't find either $answer or /dev/$answer.  I'll set it to junk" 
  773.           echo "s^>tapeunit<^unknown-remote-tape-unit^" >> $SED2
  774.         fi
  775.       else
  776.         echo "s^>tapeunit<^$answer^" >> $SED2
  777.       fi
  778.     fi
  779.   else
  780.     echo "s^>tapeunit<^/dev/rmt^" >> $SED2
  781.   fi
  782. else
  783.   echo "s^>tapeunit<^/dev/rct^" >> $SED2
  784. fi
  785.  
  786. if [ ! -d /usr/local/bin ]
  787. then
  788.   echo $nflag "Where do you want the system software installed? " $cflag
  789.   read answer
  790.  
  791.   if [ "$answer" = "" ]
  792.   then
  793.     echo "s^>dest-dir<^unknown-destination-directory^" >> $SED2
  794.   else
  795.     if [ -d $answer ]
  796.     then
  797.       echo "s^>dest-dir<^$answer^" >> $SED2
  798.     else
  799.       echo "I don't know what you're talking about.  I'll set it to junk" 
  800.       echo "s^>dest-dir<^unknown-destination-directory^" >> $SED2
  801.     fi
  802.   fi
  803. else
  804.   echo "s^>dest-dir<^/usr/local/bin^" >> $SED2
  805. fi
  806.  
  807. if [ ! -f /usr/bin/troff ]
  808. then
  809.   if [ ! -f /usr/local/bin/troff ]
  810.   then
  811.     if [ ! -f /usr/contrib/bin/troff ]
  812.     then
  813.       if [ ! -f /usr/ucb/troff ]
  814.       then
  815.         if [ ! -f /bin/troff ]
  816.         then
  817.           echo $nflag "Where does the 'troff' program live? " $cflag
  818.        read answer
  819.  
  820.       if [ "$answer" = "" ]
  821.       then
  822.             echo "s/>troff</nroff/" >> $SED2
  823.       else
  824.             if [ -f $answer ]
  825.         then
  826.               echo "s^>troff<^$answer^" >> $SED2
  827.               troff=$answer
  828.         else
  829.           echo "Still can't find it.  I'll set it to \"nroff\" instead."
  830.               echo "s/>troff</nroff/" >> $SED2
  831.         fi
  832.       fi
  833.     else
  834.           echo "s^>troff<^/bin/troff^" >> $SED2
  835.           troff=/bin/troff
  836.         fi
  837.       else
  838.         echo "s^>troff<^/usr/ucb/troff^" >> $SED2
  839.         troff=/usr/ucb/troff
  840.       fi
  841.     else
  842.       echo "s^>troff<^/usr/contrib/bin/troff^" >> $SED2
  843.       troff=/usr/contribbin/troff
  844.     fi
  845.   else
  846.     echo "s^>troff<^/usr/local/bin/troff^" >> $SED2
  847.     troff=/usr/local/bin/troff
  848.   fi
  849. else
  850.   echo "s^>troff<^/usr/bin/troff^" >> $SED2
  851.   troff=/usr/bin/troff
  852. fi
  853.  
  854. # phew!
  855.  
  856. troffdir=`dirname $troff`
  857.  
  858. if [ -f $troffdir/tbl ]
  859. then
  860.   echo "s^>tbl<^$troffdir/tbl^" >> $SED2
  861. else
  862.   echo $nflag "Where does the 'tbl' program live? " $cflag
  863.   read answer
  864.  
  865.   if [ "$answer" = "" ]
  866.   then
  867.     echo "s^>tbl<^cat^" >> $SED2
  868.   elif [ -f $answer ]
  869.   then
  870.     echo "s^>tbl<^$answer^" >> $SED2
  871.   else
  872.     echo "I can't find that either.  I'll just set it to junk..."
  873.     echo "s^>tbl<^cat^" >> $SED2
  874.   fi
  875. fi
  876.  
  877. if [ -f /bin/cc ]
  878. then
  879.   echo "s^>cc<^/bin/cc^" >> $SED2
  880. else
  881.   echo $nflag "Where does the 'C' compiler live? " $cflag
  882.   read answer
  883.  
  884.   if [ "$answer" = "" ]
  885.   then
  886.     cat << THE_END
  887.  
  888. I hope you realize that without a "C" compiler there's no point in doing any
  889. of this.  If we can't compile anything then this is just so much disk filler.
  890.  
  891. In fact, thinking about it, let's just quit right now.
  892.  
  893. THE_END
  894.  
  895.     exit 1
  896.   fi
  897.  
  898.   if [ -f $answer ]
  899.   then
  900.     echo "s^>cc<^$answer^" >> $SED2
  901.   else
  902.     cat << THE_END
  903.  
  904. I couldn't find what you specified, pal.  I hope you realize that without a 
  905. "C" compiler there's no point in doing any of this.  If we can't compile 
  906. anything then this system is just so much disk filler.
  907.  
  908. In fact, thinking about it, let's just quit right now.
  909.  
  910. THE_END
  911.     exit 1
  912.   fi
  913. fi
  914.  
  915. echo "s^>rm<^$rm -f^" >> $SED2
  916.  
  917. if [ -f /bin/mv ]
  918. then
  919.   echo "s^>mv<^/bin/mv -f^" >> $SED2
  920. else
  921.   echo "s^>mv<^mv -f^" >> $SED2  
  922. fi
  923.  
  924. if [ -f /bin/cp ]
  925. then
  926.   echo "s^>cp<^/bin/cp^" >> $SED2
  927. else
  928.   echo "s^>cp<^cp^" >> $SED2  
  929. fi
  930.  
  931. cat << END
  932.  
  933. That's it.  Just  have to do some patching up and such...hang loose for a 
  934. minute or two, please...
  935.  
  936. END
  937.  
  938. # process the four Makefiles accordingly...
  939.  
  940. echo "1 - processing the file \"Makefile\"..."
  941. cat Makefile.mstr | sed -f $SED2 > Makefile
  942.  
  943. echo "2 - processing the file \"src/Makefile\"..."
  944. cat src/Makefile.mstr | sed -f $SED2 > src/Makefile
  945.  
  946. echo "3 - processing the file \"utils/Makefile\"..."
  947. cat utils/Makefile.mstr | sed -f $SED2 > utils/Makefile
  948.  
  949. echo "4 - processing the file \"filter/Makefile\"..."
  950. cat filter/Makefile.mstr | sed -f $SED2 > filter/Makefile
  951.  
  952. # then filter the sysdefs file through the sed script we've created!
  953.  
  954. echo "Finally, processing the file \"hdrs/sysdefs.h\"..."
  955.  
  956. if [ -f hdrs/sysdefs.h ]
  957. then
  958.   mv hdrs/sysdefs.h hdrs/sysdefs.old
  959. fi
  960.  
  961. cat hdrs/sysdefs.master | sed -f $SED1 > hdrs/sysdefs.h
  962.  
  963. echo Done\!
  964.  
  965. $rm -f $SED1 $SED2
  966. exit 0
  967.