home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / unix / volume9 / elm2 / part18 / Configure.sh
Text File  |  1987-03-10  |  19KB  |  924 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 > .varnames
  514. cc .test.c
  515. EOF
  516.  
  517. sh .varnames > .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 .varnames .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. answerX   fi
  550.  fi
  551. fi
  552.  
  553. use_dbm=0
  554.  
  555. if [ $dont_touch_addresses = 0 ]
  556. then
  557.   if [ -f $answer.pag -a -f $answer.dir ]
  558.   then
  559.     echo "You have pathalias as a DBM file...I'll use that instead."
  560.     echo "s^/\*\* #define USE_DBM \*\*/^#define USE_DBM^" >> $SED1
  561.     use_dbm=1
  562.   fi
  563. fi
  564.  
  565. case $OS_FLAG in 
  566.   BSD) echo "s/>os-define</-DBSD/"    >> $SED2
  567.        echo "s/>lib2</-lcurses/"      >> $SED2
  568.        if [ $use_dbm = 1 ]
  569.        then
  570.          echo "s/>libs</-ltermcap -ldbm/" >> $SED2
  571.        else
  572.          echo "s/>libs</-ltermcap/"       >> $SED2
  573.        fi
  574.        ;;
  575.  
  576.   PYRAMID) echo "s/>os-define</"-DBSD -DNO_VAR_ARGS"/" >> $SED2
  577.        echo "s/>lib2</-lcurses/"      >> $SED2
  578.        if [ $use_dbm = 1 ]
  579.        then
  580.          echo "s/>libs</-ltermcap -ldbm/"     >> $SED2
  581.        else
  582.          echo "s/>libs</-ltermcap/"     >> $SED2
  583.        fi
  584.        ;;
  585.  
  586.   UTS) echo "s/>os-define</-DUTS/"    >> $SED2
  587.        echo "s/>lib2</-la -lq/"       >> $SED2
  588.        if [ $use_dbm = 1 ]
  589.        then
  590.          echo "s/>libs</-lcurses -ldbm/" >> $SED2
  591.        else
  592.          echo "s/>libs</-lcurses/"       >> $SED2
  593.        fi
  594.        ;;
  595.  
  596.   *)   echo "s/>os-define<//"         >> $SED2
  597.        echo "s/>lib2<//"              >> $SED2
  598.        if [ $use_dbm = 1 ] 
  599.        then
  600.          echo "s/>libs</-ltermcap -ldbm/" >> $SED2
  601.        else
  602.          echo "s/>libs</-ltermcap/"       >> $SED2
  603.        fi
  604.        ;;
  605.  
  606. esac
  607.  
  608.  
  609. if [ $dont_touch_addresses = 0 ]
  610. then
  611.  if [ ! -f /usr/lib/domains ] 
  612.  then
  613.    echo $nflag "Where does the 'domains' file live ? " $cflag
  614.    read answer
  615.  
  616.    if [ "$answer" != "" ]
  617.    then
  618.      echo "s^/usr/lib/domains^$answer^" >> $SED1
  619.    fi
  620.  fi
  621. fi
  622.  
  623. if [ $not_using_lsys_file = 1 ]
  624. then
  625.   if [ ! -f /usr/lib/uucp/L.sys ]
  626.   then
  627.     echo $nflag "Where does the 'L.sys' file live ? " $cflag
  628.     read answer
  629.  
  630.     if [ "$answer" != "" ]
  631.     then
  632.       echo "s^/usr/lib/uucp/L.sys^$answer^" >> $SED1
  633.     fi
  634.   fi
  635. fi
  636.  
  637. if [ ! -d /tmp ]
  638. then 
  639.   echo $nflag "/tmp isn't a directory!  What should I use?? " $cflag
  640.   read answer
  641.  
  642.   if [ "$answer" != "" ]
  643.   then
  644.     echo "s^/tmp^$answer^" >> $SED1
  645.   fi
  646. fi
  647.  
  648. if [ ! -f /usr/ucb/vi -a "$os_name" = "BSD" ]
  649. then
  650.   echo $nflag "I can't find the 'vi' editor!  Where is it? " $cflag
  651.   read answer
  652.  
  653.   if [ "$answer" != "" ]
  654.   then
  655.     echo "s^/usr/ucb/vi^$answer^" >> $SED1
  656.   fi
  657. elif [ ! -f /usr/bin/vi -a "$os_name" = "" ]
  658. then
  659.   echo $nflag \
  660.     "I can't find the 'vi' editor!  Where is it? " $cflag
  661.   read answer
  662.  
  663.   if [ "$answer" != "" ]
  664.   then
  665.     echo "s^/usr/bin/vi^$answer^" >> $SED1
  666.   fi
  667. fi
  668.  
  669. if [ ! -d /usr/spool/mail -a "$os_name" = "BSD" ]
  670. then
  671.   echo $nflag "I can't find your inbound mail directory!  Where is it? " $cflag
  672.   read answer
  673.  
  674.   if [ "$answer" != "" ]
  675.   then
  676.     echo "s^/usr/spool/mail^$answer^" >> $SED1
  677.   fi
  678. elif [ ! -d /usr/mail -a "$os_name" = "" ]
  679. then
  680.   echo $nflag "I can't find your inbound mail directory!  Where is it? " $cflag
  681.   read answer
  682.  
  683.   if [ "$answer" != "" ]
  684.   then
  685.     echo "s^/usr/mail^$answer^" >> $SED1
  686.   fi
  687. fi
  688.  
  689. if [ ! -f /bin/rm ]
  690. then
  691.   echo $nflag "Where's the 'rm' program? " $cflag
  692.   read answer
  693.  
  694.   if [ "$answer" != "" ]
  695.   then
  696.     echo "s^/bin/rm^$answer^" >> $SED1
  697.   fi
  698. fi
  699.  
  700. if [ ! -f /bin/cat ]
  701. then
  702.   echo $nflag "Where's the 'cat' program? " $cflag
  703.   read answer
  704.  
  705.   if [ "$answer" != "" ]
  706.   then
  707.     echo "s^/bin/rm^$answer^" >> $SED1
  708.   fi
  709. fi
  710.  
  711. if [ ! -c /dev/rct ]
  712. then
  713.   if [ ! -c /dev/rmt ]
  714.   then
  715.     echo $nflag "What's the name of your remote-tape unit? " $cflag
  716.     read answer
  717.  
  718.     if [ "$answer" = "" ]
  719.     then
  720.       echo "s^>tapeunit<^unknown-remote-tape-unit^" >> $SED2
  721.     else
  722.       if [ ! -c $answer ] 
  723.       then
  724.     if [ -c /dev/$answer ]
  725.     then
  726.           echo "s^>tapeunit<^/dev/$answer^" >> $SED2
  727.         else
  728.           echo \
  729.            "I can't find either $answer or /dev/$answer.  I'll set it to junk" 
  730.           echo "s^>tapeunit<^unknown-remote-tape-unit^" >> $SED2
  731.         fi
  732.       else
  733.         echo "s^>tapeunit<^$answer^" >> $SED2
  734.       fi
  735.     fi
  736.   else
  737.     echo "s^>tapeunit<^/dev/rmt^" >> $SED2
  738.   fi
  739. else
  740.   echo "s^>tapeunit<^/dev/rct^" >> $SED2
  741. fi
  742.  
  743. if [ ! -d /usr/local/bin ]
  744. then
  745.   echo $nflag "Where do you want the system software installed? " $cflag
  746.   read answer
  747.  
  748.   if [ "$answer" = "" ]
  749.   then
  750.     echo "s^>dest-dir<^unknown-destination-directory^" >> $SED2
  751.   else
  752.     if [ -d $answer ]
  753.     then
  754.       echo "s^>dest-dir<^$answer^" >> $SED2
  755.     else
  756.       echo "I don't know what you're talking about.  I'll set it to junk" 
  757.       echo "s^>dest-dir<^unknown-destination-directory^" >> $SED2
  758.     fi
  759.   fi
  760. else
  761.   echo "s^>dest-dir<^/usr/local/bin^" >> $SED2
  762. fi
  763.  
  764. if [ ! -f /usr/bin/troff ]
  765. then
  766.   if [ ! -f /usr/local/bin/troff ]
  767.   then
  768.     if [ ! -f /usr/contrib/bin/troff ]
  769.     then
  770.       if [ ! -f /usr/ucb/troff ]
  771.       then
  772.         if [ ! -f /bin/troff ]
  773.         then
  774.           echo $nflag "Where does the 'troff' program live? " $cflag
  775.        read answer
  776.  
  777.       if [ "$answer" = "" ]
  778.       then
  779.             echo "s/>troff</nroff/" >> $SED2
  780.       else
  781.             if [ -f $answer ]
  782.         then
  783.               echo "s^>troff<^$answer^" >> $SED2
  784.               troff=$answer
  785.         else
  786.           echo "Still can't find it.  I'll set it to \"nroff\" instead."
  787.               echo "s/>troff</nroff/" >> $SED2
  788.         fi
  789.       fi
  790.     else
  791.           echo "s^>troff<^/bin/troff^" >> $SED2
  792.           troff=/bin/troff
  793.         fi
  794.       else
  795.         echo "s^>troff<^/usr/ucb/troff^" >> $SED2
  796.         troff=/usr/ucb/troff
  797.       fi
  798.     else
  799.       echo "s^>troff<^/usr/contrib/bin/troff^" >> $SED2
  800.       troff=/usr/contribbin/troff
  801.     fi
  802.   else
  803.     echo "s^>troff<^/usr/local/bin/troff^" >> $SED2
  804.     troff=/usr/local/bin/troff
  805.   fi
  806. else
  807.   echo "s^>troff<^/usr/bin/troff^" >> $SED2
  808.   troff=/usr/bin/troff
  809. fi
  810.  
  811. # phew!
  812.  
  813. troffdir=`dirname $troff`
  814.  
  815. if [ -f $troffdir/tbl ]
  816. then
  817.   echo "s^>tbl<^$troffdir/tbl^" >> $SED2
  818. else
  819.   echo $nflag "Where does the 'tbl' program live? " $cflag
  820.   read answer
  821.  
  822.   if [ "$answer" = "" ]
  823.   then
  824.     echo "s^>tbl<^cat^" >> $SED2
  825.   elif [ -f $answer ]
  826.   then
  827.     echo "s^>tbl<^$answer^" >> $SED2
  828.   else
  829.     echo "I can't find that either.  I'll just set it to junk..."
  830.     echo "s^>tbl<^cat^" >> $SED2
  831.   fi
  832. fi
  833.  
  834. if [ -f /bin/cc ]
  835. then
  836.   echo "s^>cc<^/bin/cc^" >> $SED2
  837. else
  838.   echo $nflag "Where does the 'C' compiler live? " $cflag
  839.   read answer
  840.  
  841.   if [ "$answer" = "" ]
  842.   then
  843.     cat << THE_END
  844.  
  845. I hope you realize that without a "C" compiler there's no point in doing any
  846. of this.  If we can't compile anything then this is just so much disk filler.
  847.  
  848. In fact, thinking about it, let's just quit right now.
  849.  
  850. THE_END
  851.  
  852.     exit 1
  853.   fi
  854.  
  855.   if [ -f $answer ]
  856.   then
  857.     echo "s^>cc<^$answer^" >> $SED2
  858.   else
  859.     cat << THE_END
  860.  
  861. I couldn't find what you specified, pal.  I hope you realize that without a 
  862. "C" compiler there's no point in doing any of this.  If we can't compile 
  863. anything then this system is just so much disk filler.
  864.  
  865. In fact, thinking about it, let's just quit right now.
  866.  
  867. THE_END
  868.     exit 1
  869.   fi
  870. fi
  871.  
  872. echo "s^>rm<^$rm -f^" >> $SED2
  873.  
  874. if [ -f /bin/mv ]
  875. then
  876.   echo "s^>mv<^/bin/mv -f^" >> $SED2
  877. else
  878.   echo "s^>mv<^mv -f^" >> $SED2  
  879. fi
  880.  
  881. if [ -f /bin/cp ]
  882. then
  883.   echo "s^>cp<^/bin/cp^" >> $SED2
  884. else
  885.   echo "s^>cp<^cp^" >> $SED2  
  886. fi
  887.  
  888. cat << END
  889.  
  890. That's it.  Just  have to do some patching up and such...hang loose for a 
  891. minute or two, please...
  892.  
  893. END
  894.  
  895. # process the four Makefiles accordingly...
  896.  
  897. echo "1 - processing the file \"Makefile\"..."
  898. cat Makefile.mstr | sed -f $SED2 > Makefile
  899.  
  900. echo "2 - processing the file \"src/Makefile\"..."
  901. cat src/Makefile.mstr | sed -f $SED2 > src/Makefile
  902.  
  903. echo "3 - processing the file \"utils/Makefile\"..."
  904. cat utils/Makefile.mstr | sed -f $SED2 > utils/Makefile
  905.  
  906. echo "4 - processing the file \"filter/Makefile\"..."
  907. cat filter/Makefile.mstr | sed -f $SED2 > filter/Makefile
  908.  
  909. # then filter the sysdefs file through the sed script we've created!
  910.  
  911. echo "Finally, processing the file \"hdrs/sysdefs.h\"..."
  912.  
  913. if [ -f hdrs/sysdefs.h ]
  914. then
  915.   mv hdrs/sysdefs.h hdrs/sysdefs.old
  916. fi
  917.  
  918. cat hdrs/sysdefs.master | sed -f $SED1 > hdrs/sysdefs.h
  919.  
  920. echo Done\!
  921.  
  922. $rm -f $SED1 $SED2
  923. exit 0
  924.