home *** CD-ROM | disk | FTP | other *** search
/ back2roots/padua / padua.7z / padua / shell / SKsh017.lzh / misc / MiscFiles.lzh / Install_1.7.sksh < prev    next >
Encoding:
Text File  |  1991-05-04  |  31.5 KB  |  980 lines

  1.  
  2. # *****************************************************************************
  3. #    This script installs or updates SKsh
  4. # *****************************************************************************
  5.  
  6. options CFIclsw
  7.  
  8. # *****************************************************************************
  9. # setup variables containing configuration information
  10. # *****************************************************************************
  11.  
  12.    rel='1.7'
  13.    arcname='SKsh017.lzh'
  14.    relnum=8
  15.    b="$_ANSI_P3"
  16.    e="$_ANSI_P1"
  17.    errorlog='ram:Install_SKsh.err'
  18.    st_file='s:startup-sequence'
  19.    ms_file='ram:ManSteps.txt'
  20.    RECUR_DEPTH=32
  21.  
  22. # *****************************************************************************
  23. # setup variables containing files we need to install
  24. # *****************************************************************************
  25.  
  26.   main_files='sksh'
  27.  
  28.   script_files='scr/chext scr/cleard scr/dstack scr/emacs_mode scr/man
  29.     scr/path scr/popd scr/pushd scr/qrm scr/usage scr/vi_mode scr/histload
  30.     scr/histsave scr/histlist scr/histrm'
  31.  
  32.   script_s_files='scr_source/chext.s scr_source/cleard.s scr_source/dstack.s
  33.      scr_source/emacs_mode.s scr_source/histlist.s scr_source/histload.s
  34.      scr_source/histrm.s scr_source/histsave.s scr_source/man.s
  35.      scr_source/path.s scr_source/popd.s scr_source/pushd.s scr_source/qrm.s
  36.      scr_source/usage.s scr_source/vi_mode.s'
  37.  
  38.   bin_files='bin/cat bin/cmp bin/cp bin/crc bin/cut bin/doc2man bin/du
  39.      bin/encr bin/fgrep bin/find bin/grep bin/head bin/indent bin/join
  40.      bin/num bin/split bin/srun bin/strings bin/tail bin/tee bin/view bin/wc
  41.      bin/window bin/xargs bin/xd'
  42.  
  43.   init_files='init/.skshinit init/.skshinit.pp init/Stuff.sksh init/Stuff.pp
  44.      sksh.msg'
  45.  
  46.   config_files='init/.skshrc'
  47.  
  48.   inst_files="Install_$rel.pp README.install"
  49.  
  50.   misc_files="misc/MiscFiles.lzh"
  51.  
  52.   doc_files='doc/Addendum1.1.doc doc/Addendum1.1.doc doc/Addendum1.2.doc
  53.      doc/Addendum1.3.doc doc/Addendum1.4.doc doc/Addendum1.5.doc
  54.      doc/Addendum1.6.doc doc/Addendum1.7.doc doc/Bugs.doc doc/Diffs.doc
  55.      doc/ErrorCodes.doc doc/ExtCmds.doc doc/Hints.doc doc/Install.doc
  56.      doc/MiscInfo.doc doc/ReadMe_1st.doc doc/Reference.doc doc/TechNotes.doc
  57.      doc/TinySKsh.doc doc/UserMan.doc doc/View.doc'
  58.  
  59.  
  60. # *****************************************************************************
  61. #    cleanup function to remove files we put in ram:
  62. # *****************************************************************************
  63.  
  64. function cleanup {
  65.    rm -fr ram:cp ram:crc ram:grep ram:cat ram:tail ram:cut >nil:
  66. }
  67.  
  68. # *****************************************************************************
  69. #    Report an error
  70. # *****************************************************************************
  71.  
  72. function error {
  73.    echo -c "\n$b" "ERROR: " "$e" "$1\n"
  74.    echo "ERROR: $1\n" >>"$errorlog"
  75.    return 1
  76. }
  77.  
  78. # *****************************************************************************
  79. #    Report a warning
  80. # *****************************************************************************
  81.  
  82. function warn {
  83.    echo -c "$b" "WARNING: " "$e" "$1\n"
  84.    echo "WARNING: $1\n" >>"$errorlog"
  85. }
  86.  
  87. # *****************************************************************************
  88. #    See if we should terminate because of errors
  89. # *****************************************************************************
  90.  
  91. function ck_terminate {
  92.    if [ -f "$errorlog" ]
  93.    then
  94.       echo "\n${b}Errors were encountered.  Check the file $errorlog.${e}\n"
  95.       cleanup
  96.       return 1 2
  97.    fi
  98. }
  99.  
  100. # *****************************************************************************
  101. #    Checksum files
  102. # *****************************************************************************
  103.  
  104. function crc_files {
  105.  
  106.    local fspec
  107.  
  108.    fspec=$(tackon "$1" "$2")
  109.  
  110.    echo -n '.'
  111.  
  112.    if [ ! -f "$fspec" ]
  113.    then
  114.       echo
  115.       error "this file is missing: $fspec"
  116.    else
  117.       crcval=$(ram:crc -q "$fspec") || error "can't crc $fspec" || ck_terminate
  118.  
  119.       if [ "$crcval" != "$3" ]
  120.       then
  121.          echo
  122.          error "this file has an incorrect checksum: $fspec"
  123.       fi
  124.  
  125.       if [ $(expr index "$4" 'p') -gt 0 -a ! -P "$fspec" ]
  126.       then
  127.          echo
  128.          warn "this file should have the pure bit set: $fspec"
  129.       fi
  130.  
  131.       if [ $(expr index "$4" 's') -gt 0 -a ! -S "$fspec" ]
  132.       then
  133.          echo
  134.          warn "this file should have the script bit set: $fspec"
  135.       fi
  136.    fi
  137. }
  138.  
  139. # *****************************************************************************
  140. #    Verify that files exist
  141. # *****************************************************************************
  142.  
  143. function check_files {
  144.  
  145.    local notfound file
  146.  
  147.    notfound='0'
  148.    sty="$1"; shift
  149.  
  150.    for file in $1
  151.    do
  152.       if [ "$sty" != 'PATH' -a ! -f "$file" -o
  153.            "$sty" =  'PATH' -a -z $(which -s "$file") ]
  154.       then
  155.         error "The '$file' file must be present for this script to
  156.        operate properly.  Please install it in the appropriate
  157.        place and run this script again."
  158.         notfound=1
  159.       fi
  160.       shift
  161.    done
  162.  
  163.    return "$notfound"
  164. }
  165.  
  166.  
  167. # *****************************************************************************
  168. #    Install files
  169. # *****************************************************************************
  170.  
  171. function install_files {
  172.  
  173.    local install_dir chmod_flags overwrite fspec file
  174.  
  175.    install_dir = "$1"
  176.    chmod_flags = "$2"
  177.    overwrite   = "$3"
  178.    shift 3
  179.  
  180.    for file in $1
  181.    do
  182.       echo -n '.'
  183.       fspec=$(tackon "$install_dir" $(basename "$file"))
  184.       if [ -f "$fspec" ]
  185.       then
  186.          if [ "$overwrite" = 'Y' ]
  187.          then
  188.             chmod +wd "$fspec" >nil: ||
  189.                error "can't chmod +wd $fspec" || ck_terminate
  190.             ow='Y'
  191.          else
  192.             ow='N'
  193.          fi
  194.       else
  195.          ow='Y'
  196.       fi
  197.  
  198.       if [ -f "$file" ]
  199.       then
  200.          if [ "$ow" = 'Y' ]
  201.          then
  202.             ram:cp "$file" "$fspec" >nil: ||
  203.                   error "can't copy $file to $fspec" || ck_terminate
  204.             chmod "$chmod_flags" "$fspec" >nil: ||
  205.                   error "can't change $fspec mode to $chmod_flags" ||
  206.                   ck_terminate
  207.          fi
  208.       else
  209.          echo
  210.          error "The file '$file' is missing from the current directory."
  211.          return 1
  212.       fi
  213.    done
  214. }
  215.  
  216. # *****************************************************************************
  217. #    Read dir name (or file name)
  218. # *****************************************************************************
  219.  
  220. function read_dir {
  221.  
  222.    local in_dir read_dir; in_dir=''
  223.  
  224.    while [ -z "$in_dir" -o "$4" = 'directory' -a ! -d "$in_dir" -o 
  225.            "$4" = 'file' -a ! -f "$in_dir" ]
  226.    do
  227.       echo
  228.       echo "$1"
  229.  
  230.       line read_dir "$2 $b\[$3]$e ? > " 20
  231.  
  232.       in_dir=$(pathconv -a "$read_dir")
  233.  
  234.       if [ "$4" = 'directory' -a ! -d "${in_dir:=$3}" -o
  235.            "$4" = 'file'      -a ! -f "${in_dir:=$3}" ]
  236.       then
  237.          echo "\n$in_dir is not a valid $4 name."
  238.  
  239.          if [ "$4" = 'directory' ]
  240.          then
  241.             line yn "Do you wish to create it? $b[y/N]$e > " 20
  242.             if [ $(expr substr $(toupper "$yn") 1 1) = 'Y' ]
  243.             then
  244.                mkdir -p "$in_dir" || error "can't create directory $in_dir"
  245.             fi
  246.          fi
  247.       fi
  248.    done
  249.  
  250.    export -l in_dir
  251. }
  252.  
  253. # *****************************************************************************
  254. #   Resolve a device name
  255. # *****************************************************************************
  256.  
  257. function resolve_dir {
  258.    if [ $(expr index "$1" ':') -gt 0 ]
  259.    then
  260.       dev_name=$(car "$1" ':')
  261.       f_name=$(cdr "$1" ':')
  262.       tackon $(info "$dev_name:" | ram:tail -1 | ram:cut -c66-200) $f_name
  263.    else
  264.       echo "$1"
  265.    fi
  266. }
  267.  
  268. # *****************************************************************************
  269. #    Check a device assignment
  270. # *****************************************************************************
  271.  
  272. function check_assign {
  273.  
  274.    local device loc descr defdir change
  275.  
  276.    device = "$1"
  277.    defdir = "$2"
  278.    loc    = "$3"
  279.    descr  = "$4"
  280.    change = ''
  281.  
  282.    echo -n "Checking the $device: device..."
  283.  
  284.    if [ -m "$device:" ]
  285.    then
  286.  
  287.       if [ $(tolower "$defdir") != $(tolower "$loc") ]
  288.       then
  289.          change='TRUE'
  290.          clear
  291.          echo "${b}Incorrect assignment of $device:${e} - should be $loc."
  292.  
  293.          echo "The '$b$device:$e' assignment currently points to the '$b$defdir$e'
  294. directory.  You previoulsy installed the $descr
  295. files in '$b$loc$e' directory.
  296.  
  297. This assignment must be changed for SKsh to operate correctly."
  298.  
  299.       fi
  300.    else
  301.       change='TRUE'
  302.       clear
  303.       echo "
  304. The '$b$device:$e' assignment does not currently exist.
  305. This device must be assigned to the directory containing
  306. the $descr files.
  307.  
  308. You previously installed these files in the '$b$loc$e'
  309. directory.
  310. "
  311.    fi
  312.  
  313.    if [ -n "$change" ]
  314.    then
  315.       echo
  316.       line yn "Press return to continue: > "
  317.  
  318.       echo -n "
  319. If you wish, this script will now assign '$b$device:$e' to the
  320. '$b$loc$e' directory.  ${b}NOTE:${e} This will ONLY be in affect until
  321. you reboot your computer.  To make this change permanent, you must
  322. modify your ${b}${st_file}${e} file and make it create these
  323. assignments.
  324.  
  325. If you type 'Y' at the prompt below, the following assignment will be
  326. made:
  327.  
  328.    ${b}assign $device: $loc${e}
  329.  
  330. Do you want to make this assignment now? [Y/n] > "
  331.  
  332.       read yn
  333.  
  334.       if [ $(expr substr $(toupper "$yn") 1 1) != 'N' ]
  335.       then
  336.           echo "Executing ${b}assign $device: $loc${e}..."
  337.           assign "$device:" "$loc"
  338.       else
  339.           echo "Assignment not made.  You ${b}must${e} make it manually."
  340.           warn "Incorrect assignment of $device: - should be $loc." >nil:
  341.       fi
  342.       echo
  343.       line yn "Press return to continue: > "
  344.  
  345.    else
  346.       echo "${b}OK${e}"
  347.    fi
  348. }
  349.  
  350. # *****************************************************************************
  351. #    Verify a line in the startup sequence
  352. # *****************************************************************************
  353.  
  354. function check_ss {
  355.    if eval "$1"
  356.    then return 0
  357.    else
  358.       echo "   $stepnum) $2"
  359.       echo "   $stepnum) $2" >> "$ms_file"
  360.       if [ -n "$3" ]
  361.       then
  362.          inc stepnum
  363.          echo "   $stepnum) $3"
  364.          echo "   $stepnum) $3" >> "$ms_file"
  365.       fi
  366.       return 1
  367.    fi
  368. }
  369.  
  370. # *****************************************************************************
  371. #   start of "main" script - check system setup and prerequisites
  372. # *****************************************************************************
  373.  
  374. clear
  375.  
  376. if [ ! -m 'ram:' ]
  377. then
  378.    echo "${b}ERROR${e}: This script requires the ram: disk to be temporarily mounted.
  379.        Also, you can assign ram: to another location.  In any case, please
  380.        fix this and run this script again.\n"
  381.    cleanup
  382.    return 0
  383. fi
  384.  
  385. if [ "$LINES" -lt 22 -o "$COLUMNS" -lt 72 ]
  386. then
  387.    error "This script requires a larger window size.  Please make
  388.        your window at least 22 lines by 72 columns and run this
  389.        script again."
  390.    ck_terminate
  391. fi
  392.  
  393. #if [ $(cdr $(stack) ':') -lt 8000 ]
  394. #then
  395. #   error "Please set the stack size to at least 8000 bytes and run
  396. #       this script again."
  397. #   ck_terminate
  398. #fi
  399.  
  400. if [ $(version -s) -lt "$relnum" ]
  401. then
  402.    error "This script must be run under SKsh $rel or later.  Please
  403.        dearchive SKsh $rel, and type 'sksh -n Install_$rel.sksh' to
  404.        run this script."
  405.    ck_terminate
  406. fi
  407.  
  408. if [ ! -d 'bin' -o ! -d 'doc' -o ! -d 'init' -o ! -d 'misc' -o ! -d 'scr' ]
  409. then
  410.    error "This script must be invoked from the directory in which
  411.        you unarchived the main $arcname file.  You can use the -m
  412.        option to lharc to automatically create directories:
  413.  
  414.           lharc -m x $arcname"
  415.    ck_terminate
  416. fi
  417.  
  418. if [ ! -m 't:' ]
  419. then
  420.    mkdir -p ram:tmp
  421.    assign t: ram:tmp || error "can't assign t: to ram:tmp" || ck_terminate
  422. fi
  423.  
  424. check_files 'PATH' assign || ck_terminate
  425. check_files 'PWD' 'bin/grep bin/cp bin/cat bin/crc' || ck_terminate
  426.  
  427. chmod +wd ram:grep ram:cp ram:cat ram:crc >nil:
  428.  
  429. bin/cp bin/cp    ram:cp   || error "can't copy 'cp' to ram" || ck_terminate
  430. install_files 'ram:' 'rwedp' 'Y' \
  431.   "bin/crc bin/grep bin/cat bin/cut bin/tail" || ck_terminate
  432.  
  433. # *****************************************************************************
  434. #    End of checking.  Start actual steps
  435. # *****************************************************************************
  436.  
  437. clear
  438.  
  439. echo "${b}SKsh $rel installation script ----------------------------------${e}
  440.  
  441. This script will assist you in installing SKsh $rel by performing
  442. tasks which can be easily automated.  It will do the following:
  443.  
  444.    1) Check that all files are present from archive.
  445.    2) Input destination directory names for install.
  446.    3) Install SKsh files into above dirs (this step can be skipped).
  447.    4) check device assignments (sksh:, etc)
  448.    5) check integrity of installed SKsh commands
  449.    6) Update or create .pp (faster script) files (optional)
  450.    7) Install SKsh man pages (optional)
  451.    8) Report additional manual activities which are necessary
  452.  
  453. To run this script, the main SKsh archive (called $arcname)
  454. must have been de-archived in the current directory.  You should have
  455. invoked this by typing 'sksh -n Install_$rel.pp' from an AmigaDos CLI.
  456. "
  457.  
  458. line yn "Do you wish to continue? $b[y/N]$e > " 20
  459. echo
  460.  
  461. if [ $(expr substr $(toupper "$yn") 1 1) != 'Y' ]
  462. then
  463.   echo "Ok, bye."
  464.   cleanup
  465.   return
  466. fi
  467.  
  468. rm -f "$errorlog" >nil:
  469. chmod +s scr/emacs_mode
  470. scr/emacs_mode >nil: || error "unable to set editing mode" || ck_terminate
  471.  
  472.  
  473. # -------------- step 1 -----------------------------------------------
  474.  
  475. clear
  476. echo "${b}STEP ONE: Check unarchived files ---------------------------------${e}"
  477.  
  478. echo "
  479. The files in the current working directory will now be checked to
  480. insure that they all have been unarchived in the proper locations.
  481. "
  482.  
  483. echo -n "Checking main sksh binary..."
  484. check_files 'PWD' "$main_files" || ck_terminate
  485.  
  486. echo -n "${b}OK${e}\nChecking external binary commands..."
  487. check_files 'PWD' "$bin_files" || ck_terminate
  488.  
  489. echo -n "${b}OK${e}\nChecking external script commands..."
  490. check_files 'PWD' "$script_files" || ck_terminate
  491. check_files 'PWD' "$script_s_files" || ck_terminate
  492.  
  493. echo -n "${b}OK${e}\nChecking initialization files..."
  494. check_files 'PWD' "$init_files" || ck_terminate
  495. check_files 'PWD' "$config_files" || ck_terminate
  496.  
  497. echo -n "${b}OK${e}\nChecking documentation..."
  498. check_files 'PWD' "$doc_files"      || ck_terminate
  499.  
  500. echo -n "${b}OK${e}\nChecking installation files..."
  501. check_files 'PWD' "$inst_files" || ck_terminate
  502.  
  503. echo -n "${b}OK${e}\nChecking misc files..."
  504. check_files 'PWD' "$misc_files" || ck_terminate
  505.  
  506. echo -n "${b}OK${e}\n\n\nThe necessary files were found.  Press return to continue: > "
  507. read yn
  508.  
  509. # -------------- step 2 -----------------------------------------------
  510.  
  511. clear
  512. echo "${b}STEP TWO: input directories --------------------------------------${e}"
  513.  
  514. echo -n "
  515. This script must know the locations of several directories in
  516. order to properly install the SKsh files.  Defaults will given in
  517. brackets for each directory - you may press <return> to accept the
  518. default, or type in a legal directory name.
  519. "
  520.  
  521. read_dir "Please enter the directory which will contain the main SKsh " \
  522.          "binary" "c:" 'directory'
  523.  
  524. sksh_dir=$(resolve_dir "$in_dir")
  525.  
  526. [ -m sksh: ] && devsksh=$(resolve_dir 'sksh:')
  527.  
  528. read_dir "Please enter the directory which will contain the .skshinit " \
  529.          "and .skshrc startup files" "${devsksh:-s:}" 'directory'
  530.  
  531. init_dir=$(resolve_dir "$in_dir")
  532.  
  533. [ -m skshbin: ] && devbin=$(resolve_dir 'skshbin:')
  534.  
  535. read_dir "Please enter the directory which will contain the SKsh " \
  536.          "external binary commands" "${devbin:-sys:bin}" 'directory'
  537.  
  538. bin_dir=$(resolve_dir "$in_dir")
  539.  
  540. [ -m skshscr: ] && devscr=$(resolve_dir 'skshscr:')
  541.  
  542. read_dir "Please enter the directory which will contain the SKsh " \
  543.          "external scripts" "${devscr:-sys:scr}" 'directory'
  544.  
  545. scr_dir=$(resolve_dir "$in_dir")
  546.  
  547. echo
  548. line yn "Do you wish to install the documentation files? $b[Y/n]$e > " 20
  549.  
  550. doc_dir=''
  551.  
  552. if [ $(expr substr $(toupper "$yn") 1 1) != 'N' ]
  553. then
  554.    read_dir "Please enter the directory which will contain the SKsh " \
  555.             "documentation files." "sys:doc" 'directory'
  556.    doc_dir=$(resolve_dir "$in_dir")
  557. fi
  558.  
  559.  
  560.  
  561. # -------------- step 3 -----------------------------------------------
  562.  
  563. clear
  564. echo "${b}STEP THREE: install files ------------------------------------${e}"
  565.  
  566. echo -n "
  567. The SKsh files will now be installed in the locations you chose in
  568. ${b}step 2${e}.  Configuration files such as .skshrc will ${b}not${e} be
  569. overwritten if they exist so that this script can be used for either
  570. a new install, or an update to a later SKsh version.  You may choose to
  571. skip this step, although no files will be installed if you do.  Choose
  572. Y or press return to perform the installation.
  573.  
  574. "
  575.  
  576. line yn "Do you wish to perform this step? $b[Y/n]$e > " 20
  577. echo
  578.  
  579. if [ $(expr substr $(toupper "$yn") 1 1) = 'N' ]
  580. then
  581.    echo "File installation skipped - No files installed."
  582. else
  583.    echo -n "Installing sksh binary."
  584.    install_files "$sksh_dir" "rep" 'Y' "$main_files"     || ck_terminate
  585.  
  586.    echo -n "${b}OK${e}\nInstalling external binary commands."
  587.    install_files "$bin_dir" "rep" 'Y' "$bin_files"       || ck_terminate
  588.  
  589.    echo -n "${b}OK${e}\nInstalling external script commands."
  590.    install_files "$scr_dir" "res" 'Y' "$script_files"    || ck_terminate
  591.  
  592.    echo -n "${b}OK${e}\nInstalling initialization files."
  593.    install_files "$init_dir" "res" 'Y' "$init_files"     || ck_terminate
  594.    install_files "$init_dir" "res" 'N' "$config_files"   || ck_terminate
  595.  
  596.    if [ -n "$doc_dir" ]
  597.    then
  598.       echo -n "${b}OK${e}\nInstalling documentation."
  599.       install_files "$doc_dir" "r" 'Y' "$doc_files"      || ck_terminate
  600.    fi
  601.  
  602.    echo -n "${b}OK${e}\n\nFile installation complete.  "
  603. fi
  604.  
  605. echo -n "Press return to continue: > "; read yn
  606.  
  607. # -------------- step 4 -----------------------------------------------
  608.  
  609. clear
  610. echo "${b}STEP FOUR: check device assignments --------------------------${e}"
  611.  
  612. echo -n "
  613. SKsh needs several AmigaDos device assignments in order to operate
  614. correctly.  This step will check that those assignments have been made
  615. correctly.
  616.  
  617. Press return to continue: > "
  618. read yn
  619.  
  620. echo
  621.  
  622. check_assign 'sksh'    "$devsksh" "$init_dir" 'SKsh binary'
  623. check_assign 'skshbin' "$devbin"  "$bin_dir"  'SKsh external binary'
  624. check_assign 'skshscr' "$devscr"  "$scr_dir"  'SKsh external script'
  625.  
  626. echo -n "\nPress return to continue: > "
  627. read yn
  628.  
  629. # -------------- step 5 -----------------------------------------------
  630.  
  631. clear
  632. echo "${b}STEP FIVE: check integrity of installed files ----------------${e}"
  633.  
  634. echo -n "
  635. This step will verify that the installed files are in place and that
  636. they have proper checksums.  No errors should be reported.
  637.  
  638. Press return to continue: > "
  639.  
  640. read yn;
  641.  
  642. echo -n "\nChecking sksh binary."
  643.  
  644. crc_files "$sksh_dir" sksh          '     71380    5631852 1839896023' 'p'
  645.  
  646. echo -n "${b}OK${e}\nChecking initialization files."
  647.  
  648. crc_files "$init_dir" sksh.msg      '      6160     507141 1969742648' 's'
  649. crc_files "$init_dir" .skshinit     '      1699     101524 1008357631' 's'
  650. crc_files "$init_dir" .skshinit.pp  '       981      58735 1046829638' 's'
  651. crc_files "$init_dir" Stuff.sksh    '      3346     233003  111354638' 's'
  652. crc_files "$init_dir" Stuff.pp      '      1880     115336 2072644645' 's'
  653.  
  654. echo -n "${b}OK${e}\nChecking external binary commands."
  655.  
  656. crc_files "$bin_dir"  cat           '      2164     164842  766981691' 'p'
  657. crc_files "$bin_dir"  cmp           '      2572     195291 1994119554' 'p'
  658. crc_files "$bin_dir"  cp            '      4044     335129 1073694252' 'p'
  659. crc_files "$bin_dir"  crc           '      2256     172206  766982743' 'p'
  660. crc_files "$bin_dir"  cut           '      3160     252382 1073706073' 'p'
  661. crc_files "$bin_dir"  doc2man       '      3128     246846 1994126919' 'p'
  662. crc_files "$bin_dir"  du            '      2960     221083 1380556482' 'p'
  663. crc_files "$bin_dir"  encr          '      3404     264713 1687271068' 'p'
  664. crc_files "$bin_dir"  fgrep         '      5464     399663  690205810' 'p'
  665. crc_files "$bin_dir"  find          '      6016     465405  920283952' 'p'
  666. crc_files "$bin_dir"  grep          '     11724     928329 1764136740' 'p'
  667. crc_files "$bin_dir"  head          '      2220     168607 1994115742' 'p'
  668. crc_files "$bin_dir"  indent        '      2912     209666 1840670621' 'p'
  669. crc_files "$bin_dir"  join          '      2436     187812 1380551729' 'p'
  670. crc_files "$bin_dir"  num           '      2392     181575 1380550838' 'p'
  671. crc_files "$bin_dir"  split         '      2520     194062 1687281161' 'p'
  672. crc_files "$bin_dir"  srun          '      2424     179586 1687283229' 'p'
  673. crc_files "$bin_dir"  strings       '      2328     178198  766983599' 'p'
  674. crc_files "$bin_dir"  tail          '      2820     223470 1380556823' 'p'
  675. crc_files "$bin_dir"  tee           '      2436     193881 1380552596' 'p'
  676. crc_files "$bin_dir"  view          '      5612     471187  153458698' 'p'
  677. crc_files "$bin_dir"  wc            '      2696     206692  153420913' 'p'
  678. crc_files "$bin_dir"  window        '      3988     309859 1610568774' 'p'
  679. crc_files "$bin_dir"  xargs         '      3868     307488  767002069' 'p'
  680. crc_files "$bin_dir"  xd            '      2924     222704 1840731781' 'p'
  681.  
  682. echo -n "${b}OK${e}\nChecking external script commands."
  683.  
  684. crc_files "$scr_dir"  chext         '       724      45783  156338274' 's'
  685. crc_files "$scr_dir"  cleard        '       239      14129  111842316' 's'
  686. crc_files "$scr_dir"  dstack        '       374      22387 1962381090' 's'
  687. crc_files "$scr_dir"  emacs_mode    '      1664      86891 1741126506' 's'
  688. crc_files "$scr_dir"  histlist      '       543      35191  402881538' 's'
  689. crc_files "$scr_dir"  histload      '       445      28405 1393911568' 's'
  690. crc_files "$scr_dir"  histrm        '       286      17219 1355833554' 's'
  691. crc_files "$scr_dir"  histsave      '       435      27818  220244877' 's'
  692. crc_files "$scr_dir"  man           '      1083      67777 1491596828' 's'
  693. crc_files "$scr_dir"  path          '      1621      93619 1270108958' 's'
  694. crc_files "$scr_dir"  popd          '       594      36313  103051252' 's'
  695. crc_files "$scr_dir"  pushd         '       418      25010  501725995' 's'
  696. crc_files "$scr_dir"  qrm           '       573      35576 1652620235' 's'
  697. crc_files "$scr_dir"  usage         '       351      22122  900170573' 's'
  698. crc_files "$scr_dir"  vi_mode       '      2066     107198 1741129407' 's'
  699.  
  700. if [ -n "$doc_dir" ]
  701. then
  702.   echo -n "${b}OK${e}\nChecking documentation."
  703.  
  704.   crc_files "$doc_dir" Addendum1.1.doc '      6617     507608  846261981' ''
  705.   crc_files "$doc_dir" Addendum1.2.doc '      8613     665741 1607987136' ''
  706.   crc_files "$doc_dir" Addendum1.3.doc '     18429    1473628  232823865' ''
  707.   crc_files "$doc_dir" Addendum1.4.doc '     23004    1790308 1459997937' ''
  708.   crc_files "$doc_dir" Addendum1.5.doc '     27235    2199926  380648497' ''
  709.   crc_files "$doc_dir" Addendum1.6.doc '     13165    1036769  994386100' ''
  710.   crc_files "$doc_dir" Addendum1.7.doc '     31923    2555942 1607740513' ''
  711.   crc_files "$doc_dir" Bugs.doc        '      1922     145726 1295230009' ''
  712.   crc_files "$doc_dir" Diffs.doc       '      5096     398610 1139424173' ''
  713.   crc_files "$doc_dir" ErrorCodes.doc  '      1883     134329 1753028684' ''
  714.   crc_files "$doc_dir" ExtCmds.doc     '     52474    3718919  163638410' ''
  715.   crc_files "$doc_dir" Hints.doc       '      6269     494803  376114250' ''
  716.   crc_files "$doc_dir" Install.doc     '      9034     703354  163348651' ''
  717.   crc_files "$doc_dir" MiscInfo.doc    '      5113     413233 1100231556' ''
  718.   crc_files "$doc_dir" Readme_1st.doc  '      6088     457640  126908301' ''
  719.   crc_files "$doc_dir" Reference.doc   '    161996   11458458 1366932363' ''
  720.   crc_files "$doc_dir" TechNotes.doc   '      4710     379193  653633332' ''
  721.   crc_files "$doc_dir" TinySKsh.doc    '      2886     207444  774303615' ''
  722.   crc_files "$doc_dir" UserMan.doc     '     96850    7691838 1391480519' ''
  723.   crc_files "$doc_dir" View.doc        '     11125     886892 1088844887' ''
  724. fi
  725.  
  726. echo -n "${b}OK${e}\n\nIntegrity check complete.  Press return to continue: > "
  727. read yn
  728.  
  729.  
  730. # -------------- step 6 -----------------------------------------------
  731.  
  732. clear
  733. echo "${b}STEP SIX: Re-create .skshrc.pp -------------------------------${e}"
  734.  
  735. echo -n "
  736. Sksh permits a special form of script file, known as a .pp file, to
  737. be executed faster than a plain script file.  If you use one for
  738. your .skshrc init file, invocation time will be improved.
  739.  
  740. If you wish to use a .skshrc.pp, it must match have been created
  741. by SKsh version $rel.  This step will allow you to create a new
  742. .skshrc.pp file if you wish.
  743.  
  744. "
  745.  
  746. line yn "Do you wish to perform this step? $b[Y/n]$e > " 20
  747. echo
  748.  
  749. rcfile=$(tackon "$init_dir" .skshrc)
  750.  
  751. [ -f "$rcfile" ] || error "No .skshrc file found in $init_dir" ||
  752.                     ck_terminate
  753.  
  754. if [ $(expr substr $(toupper "$yn") 1 1) = 'N' ]
  755. then
  756.    echo "\nStep skipped, no .skshrc.pp file created."
  757. else
  758.    if [ -f "${rcfile}.pp" ]
  759.    then echo "Re-creating .skshrc.pp from .skshrc..."
  760.    else echo "No .skshrc.pp file found, creating new one..."
  761.    fi
  762.    preparse < "$rcfile" > "${rcfile}.pp" ||
  763.        error "Unable to create .skshrc.pp file in $init_dir" ||
  764.        ck_terminate
  765.        
  766.    echo "Process complete."
  767. fi
  768.  
  769. echo -n "\nPress return to continue: > "
  770. read yn
  771.  
  772.  
  773. # -------------- step 7 -----------------------------------------------
  774.  
  775. clear
  776. echo "${b}STEP SEVEN: Install SKsh manual pages ------------------------${e}"
  777.  
  778. echo "
  779. If you wish to use the SKsh 'man' program to access the manual pages
  780. for commands, variables, and aliases supplied by SKsh, you will need
  781. to perform this step.  It is automated.  SKsh manpages reside in the
  782. MAN:SKsh directory, where man points to any valid AmigaDos directory.
  783. This step will create such a directory if it does not exist, and copy
  784. the manpages there.  The manpages are extracted from the Reference.doc
  785. and ExtCmds.doc files in the doc directory.  You must have enough disk
  786. space to store the manpages.
  787.  
  788. You may choose to skip this step, but if you do, you will be unable to
  789. use the SKsh manpages.
  790. "
  791.  
  792. perf_man=FALSE
  793. line yn "Do you wish to perform this step? $b[Y/n]$e > " 20
  794.  
  795. if [ $(expr substr $(toupper "$yn") 1 1) != 'N' ]
  796. then
  797.    perf_man=TRUE
  798.    clear
  799.    if [ ! -m 'MAN:' ]
  800.    then
  801.       echo "You do not currently have a MAN: assignment.  You must make
  802. one now in order to install the manpages.\n"
  803.  
  804.       man_dir='sys:man'
  805.    else
  806.       man_dir=$(resolve_dir "MAN:")
  807.       echo "Your current MAN: directory is $man_dir.  Press return to
  808. use this directory, or type in a new one."
  809.    fi
  810.  
  811.    read_dir "Please enter the directory which will contain the SKsh" \
  812.             "manpage entries" "$man_dir" 'directory'
  813.    man_dir=$(resolve_dir "$in_dir")
  814.  
  815.    assign MAN: "$man_dir"
  816.    
  817.    sman_dir=$(tackon "$man_dir" SKsh)
  818.    mkdir -p "$sman_dir" || error "Can't create $sman_dir" || ck_terminate
  819.    
  820.    check_files 'PWD' 'bin/doc2man' || ck_terminate
  821.    
  822.    clear
  823.    echo "Extracting manpages.....\n"
  824.    bin/doc2man doc/Reference.doc doc/ExtCmds.doc
  825.    echo
  826.    line yn "Done extracting SKsh manpages.  Press return > " 0
  827. else
  828.    echo
  829.    line yn "Skipping manpage extraction.  Press return > " 0
  830. fi
  831.  
  832.  
  833. # -------------- step 8 -----------------------------------------------
  834.  
  835. clear
  836. echo "${b}STEP EIGHT: manual steps -------------------------------------${e}"
  837.  
  838. echo "
  839. Some manual steps may be necessary to finish installing SKsh.  A
  840. list of these steps will be generated here."
  841.  
  842. read_dir "Please enter the file name which contains your AmigaDos " \
  843.          "startup instructions" "$st_file" 'file'
  844.  
  845. st_file="$in_dir"
  846.  
  847. echo -n "Press return to continue: > "
  848.  
  849. read yn;
  850.  
  851. stepnum=1
  852. rm -f "$ms_file" >nil:
  853.  
  854. clear
  855. echo '\n--- Manual Steps Necessary for SKsh Installation --------------\n'
  856. echo '\n--- Manual Steps Necessary for SKsh Installation --------------\n' \
  857.      >> "$ms_file"
  858.  
  859. ss_cont=$(ram:cat "$st_file")    # store away startup-sequence in variable
  860.  
  861. if check_ss 'echo "$ss_cont" | ram:grep -is ".bra "' \
  862.    "Insert '.bra [' in $st_file (unless c:execute is Arp)"
  863. then true; else inc stepnum; fi
  864.  
  865. if check_ss 'echo "$ss_cont" | ram:grep -is ".ket "' \
  866.    "Insert '.ket ]' in $st_file (unless c:execute is Arp)"
  867. then true; else inc stepnum; fi
  868.  
  869. if check_ss 'echo "$ss_cont" | ram:grep -is "stack "' \
  870.    "Insert 'stack 8000' (or larger) in $st_file"
  871. then true; else inc stepnum; fi
  872.  
  873. if check_ss 'echo "$ss_cont" | ram:grep -i "t: " | ram:grep -si "assign "' \
  874.    "Insert 'makedir >nil: ram:tmp' in $st_file" \
  875.    "Insert 'assign t: ram:tmp' in $st_file"
  876. then true; else inc stepnum 2; fi
  877.  
  878. if check_ss 'echo "$ss_cont" | ram:grep -i "env: " | ram:grep -si "assign "' \
  879.    "Insert 'makedir >nil: t:env' in $st_file" \
  880.    "Insert 'assign env: t:env' in $st_file"
  881. then true; else inc stepnum 2; fi
  882.  
  883. if check_ss 'echo "$ss_cont" | ram:grep -i "sksh: " | ram:grep -si "assign "' \
  884.    "Insert 'assign sksh: $init_dir' in $st_file"
  885. then
  886.    if check_ss 'echo "$ss_cont" | ram:grep -i "sksh: " | ram:grep -i "assign " | \
  887.       ram:grep -si "$init_dir"' \
  888.       "modify the the 'assign sksh:' statement in $st_file
  889.       to read 'assign sksh: $init_dir'"
  890.    then true; else inc stepnum; fi
  891. else inc stepnum; fi
  892.  
  893. if check_ss 'echo "$ss_cont" | ram:grep -i "skshbin: " | ram:grep -si "assign "' \
  894.    "Insert 'assign skshbin: $bin_dir' in $st_file"
  895. then
  896.    if check_ss 'echo "$ss_cont" | ram:grep -i "skshbin: " | ram:grep -i "assign " | \
  897.       ram:grep -si "$bin_dir"' \
  898.       "modify the the 'assign sksh:' statement in $st_file
  899.       to read 'assign sksh: $bin_dir'"
  900.    then true; else inc stepnum; fi
  901. else inc stepnum; fi
  902.  
  903. if check_ss 'echo "$ss_cont" | ram:grep -i "skshscr: " | ram:grep -si "assign "' \
  904.    "Insert 'assign skshscr: $scr_dir' in $st_file"
  905. then
  906.    if check_ss 'echo "$ss_cont" | ram:grep -i "skshscr: " | ram:grep -i "assign " | \
  907.       ram:grep -si "$scr_dir"' \
  908.       "modify the the 'assign sksh:' statement in $st_file
  909.        to read 'assign sksh: $scr_dir'"
  910.    then true; else inc stepnum; fi
  911. else inc stepnum; fi
  912.  
  913. if check_ss 'echo "$ss_cont" | ram:grep -i "vmagic: " | ram:grep -si "assign "' \
  914.    "Insert 'assign vmagic: <dir containing view magic files>'
  915.        in $st_file (use step $stepnum only if you wish
  916.        to use the SKsh 'view' utility)"
  917. then true
  918. else inc stepnum; fi
  919.  
  920.  
  921. if [ "$perf_man" = 'TRUE' ]
  922. then
  923. if check_ss 'echo "$ss_cont" | ram:grep -i "man: " | ram:grep -si "assign "' \
  924.    "Insert 'assign MAN: $man_dir' in $st_file"
  925. then
  926.    if check_ss 'echo "$ss_cont" | ram:grep -i "skshscr: " | ram:grep -i "assign " | \
  927.       ram:grep -si "$scr_dir"' \
  928.       "modify the the 'assign MAN:' statement in $st_file
  929.        to read 'assign sksh: $man_dir'"
  930.    then true; else inc stepnum; fi
  931. else inc stepnum; fi
  932. fi
  933.  
  934. mypath=$(tackon "$sksh_dir" 'sksh')
  935.  
  936. if check_ss 'echo "$ss_cont" | ram:grep -i "resident " | ram:grep -si "sksh"' \
  937.    "Insert 'c:resident $mypath' in $st_file (this step
  938.        optional, but it will save memory if SKsh is invoked
  939.        from a NewCLI window)"
  940. then true
  941. else inc stepnum; fi
  942.  
  943. if [ "$stepnum" -le 1 ]
  944. then
  945.    echo "\n** No manual steps necessary **\n"
  946.    rm -f "$ms_file" >nil:
  947. else
  948.    echo "\nA listing of the manual steps has been placed in '$ms_file'\n"
  949. fi
  950.  
  951. line yn "Press return to continue: > "
  952.  
  953. # -------------- done -------------------------------------------------
  954.  
  955. clear
  956. echo "${b}DONE: installation complete ----------------------------------${e}"
  957.  
  958. echo "
  959. The SKsh installation is complete.  If you performed step 3 (install
  960. files), then the files in this directory have been copied to their
  961. proper installation directories, and you may delete the files in this
  962. directory.   However, the files in the 'scr_source' and 'misc'
  963. directories have not been installed, as they are not necessary to run
  964. SKsh.  If you wish to keep them, you should copy or move them to a
  965. safe place.
  966.  
  967. ${b}SKsh is freely distributable software.  It is copyrighted, and is
  968. _not_ public domain.${e}  Please see UserMan.doc for copyright details.
  969. "
  970.  
  971. if [ -f "$ms_file" ]
  972. then
  973.    echo "Don't forget to perform the manual steps which are listed in the
  974. '$ms_file' file.
  975. "
  976. fi
  977.  
  978. cleanup
  979. ck_terminate
  980.