home *** CD-ROM | disk | FTP | other *** search
/ Fish 'n' More 2 / fishmore-publicdomainlibraryvol.ii1991xetec.iso / disks / disk381.lzh / SKsh / Check_1.6.sksh < prev    next >
Text File  |  1990-10-20  |  9KB  |  303 lines

  1.  
  2. # *****************************************************************************
  3. #    This script checks the SKsh installation for the errors noted in the
  4. #    initial message.
  5. # *****************************************************************************
  6.  
  7. rel='1.6'
  8. relnum=7
  9. b="$_ANSI_P3"
  10. e="$_ANSI_P1"
  11.  
  12. missing="ram:.missing"
  13. invalid="ram:.invalid"
  14. inpath="ram:.inpath"
  15.  
  16. function clean_up {
  17.    rm "$missing" "$invalid" "$inpath"
  18.    cd "$orig_dir"
  19.    rm 'ram:crc'
  20. }
  21.  
  22. function check_files {
  23.  
  24.    if [ ! -f "$1" ]
  25.    then
  26.       echo -c "$b" "ERROR: " "$e" "this file is missing: $1"
  27.       echo "$1" >> "$missing"
  28.    else
  29.       crcval=$("$crccmd" -q "$1")
  30.  
  31.       if [ "$crcval" != "$2" ]
  32.       then
  33.          echo -c "$b" "ERROR: " "$e" "this file has an incorrect checksum: $1"
  34.          echo "$1" >> "$invalid"
  35.       fi
  36.  
  37.       if [ "$3" = "pure" -a ! -P "$1" ]
  38.       then
  39.          echo -c "$b" "WARNING: " "$e" "this file should have the pure bit set: $1"
  40.       fi
  41.  
  42.       if [ "$4" = "path" -a -z $(which -s "$1") ]
  43.       then
  44.          echo -c "$b" "ERROR: " "$e" "this file must be in your SKsh path: $1"
  45.          echo "$1" >> "$inpath"
  46.       fi
  47.    fi
  48. }
  49.  
  50.  
  51. function read_dir {
  52.  
  53.    local in_dir; in_dir=''
  54.  
  55.    cd $orig_dir
  56.  
  57.    while [ ! -d "$in_dir" -o -z "$in_dir" ]
  58.    do
  59.       echo
  60.       echo "$1"
  61.       echo -n "$2" "$b\[$3]$e ? > "
  62.  
  63.       read read_dir
  64.       eval "in_dir = $read_dir"     # to get filename mapping right
  65.  
  66.       if [ -z "$in_dir" ]; then in_dir = "$3"; fi
  67.  
  68.       if [ ! -d "$in_dir" ]
  69.       then
  70.          echo "\n$read_dir is not a valid directory name."
  71.       fi
  72.    done
  73.  
  74.    export -l in_dir
  75. }
  76.  
  77. clear
  78.  
  79. if [ $(version -s) -lt "$relnum" ]
  80. then
  81.    echo "This script must be run under SKsh $rel or later.  Please install"
  82.    echo "SKsh $rel, run it, and then run this script."
  83.    echo
  84.    return
  85. fi
  86.  
  87. echo "
  88. This script will verify the installation of SKsh $rel.  It will report
  89. missing files, files which do not have the correct checksum for this
  90. version of SKsh, files which should have the pure bit set bit don't,
  91. and files which should be in the search path but are not.  It will prompt
  92. you for the location of various commands.  You must enter a valid
  93. directory name which contains the files; for example, you might
  94. enter \"c:\" (without the quotes) for the location of the main SKsh
  95. binaries, and \"sys:bin\" for the location of the SKsh external commands.
  96.  
  97. This script is a reporting tool only; it will not change your filesystem.
  98. "
  99.  
  100. if [ ! -m 'ram:' ]
  101. then
  102.    echo "This script requires the ram: disk to be temporarily mounted.  Also,"
  103.    echo "you can assign ram: to another location.  In any case, please fix this"
  104.    echo "and run the tool again."
  105.    echo
  106.    return
  107. fi
  108.  
  109. if [ ! -m 'sksh:' ]
  110. then
  111.    echo -c "$b" "ERROR: " "$e" "The volume sksh: must be mounted.\n"
  112.    return
  113. fi
  114.  
  115. if [ ! -m 'vmagic:' ]
  116. then
  117.    echo -c "$b" "WARNING: " "$e" "the volume vmagic: should be mounted.\n"
  118. fi
  119.  
  120. crccmd=$(which -s crc)
  121.  
  122. if [ -z "$crccmd" ]
  123. then
  124.    echo "The 'crc' command was not found in your SKsh search path.  It must"
  125.    echo "be there for this script to run correctly."
  126.    echo
  127.    return
  128. fi
  129.  
  130. cp "$crccmd" ram:
  131. crccmd='ram:crc'
  132.  
  133. orig_dir="$PWD"
  134.  
  135. echo -n > "$missing"
  136. echo -n > "$invalid"
  137. echo -n > "$inpath"
  138.  
  139. # --- Find dir containing sksh binary... -------------------------------------
  140.  
  141. read_dir "Please enter the name of the directory which contains the SKsh and" \
  142.          "Tiny_SKsh binaries" "c:"
  143.  
  144. echo -c "\n$_ANSI_US" "Checking SKsh binaries and init files...$_ANSI_UE" "\n"
  145. cd "$in_dir"
  146.  
  147. check_files sksh            '     69880    5656931  614374586' 'pure' ''
  148. check_files tiny_sksh       '     51980    4115062  614154319' 'pure' ''
  149.  
  150. initfile=FALSE
  151. if [ -f sksh:.skshinit ]
  152. then
  153.    initfile=TRUE
  154.    check_files sksh:.skshinit    '      3559     212415 1621908546' ''     ''
  155. fi
  156. if [ -f sksh:.skshinit.pp ]
  157. then
  158.    initfile=TRUE
  159.    check_files sksh:.skshinit.pp '      3698     201992 1407416923' ''     ''
  160. fi
  161.  
  162. if [ "$initfile" = 'FALSE' ]
  163. then
  164.    check_files sksh:.skshinit    '      3559     212415 1621908546' ''     ''
  165. fi
  166.  
  167. if [ ! -f 'sksh:.skshrc' ]
  168. then
  169.    echo -c "$b" "ERROR: " "$e" "this file is missing: sksh:.skshrc"
  170.    echo "sksh:.skshrc" >> "$missing"
  171. fi
  172.  
  173. if [ -m 'vmagic:' ]
  174.    then
  175.    if [ ! -f 'vmagic:view.magic' ]
  176.    then
  177.       echo -c "$b" "WARNING: " "$e" "this file is missing: vmagic:view.magic"
  178.       echo "vmagic:view.magic" >> "$missing"
  179.    fi
  180. fi
  181.  
  182. if [ -s "$missing" -a -s "$invalid" -a -s "$inpath" ]
  183. then
  184.    echo "\nSKsh binaries and init files are valid.\n"
  185. fi
  186.  
  187. echo -n > "$missing"
  188. echo -n > "$invalid"
  189. echo -n > "$inpath"
  190.  
  191. # --- Find dir containing sksh external commands... --------------------------
  192.  
  193. read_dir "Please enter the name of the directory which contains the SKsh" \
  194.          "external commands" "c:"
  195.  
  196. echo -c "\n$_ANSI_US" "Checking SKsh external commands...$_ANSI_UE" "\n"
  197. cd "$in_dir"
  198.  
  199. check_files cat             '      2640     194202   76668405' 'pure' 'path'
  200. check_files cmp             '      3092     227924  536903169' 'pure' 'path'
  201. check_files cp              '      4532     362396 1917344647' 'pure' 'path'
  202. check_files crc             '      2668     193827  536898298' 'pure' 'path'
  203. check_files cut             '      3560     273017 1764043124' 'pure' 'path'
  204. check_files du              '      3432     246205   76660976' 'pure' 'path'
  205. check_files encr            '      3944     303081 1303786364' 'pure' 'path'
  206. check_files fgrep           '      5316     389047   76640570' 'pure' 'path'
  207. check_files find            '      6552     492821  460104968' 'pure' 'path'
  208. check_files grep            '     11628     922091 1303697934' 'pure' 'path'
  209. check_files head            '      3032     210930 1917366285' 'pure' 'path'
  210. check_files indent          '      3312     230719 1917363458' 'pure' 'path'
  211. check_files join            '      2920     216395  536901522' 'pure' 'path'
  212. check_files num             '      2784     202126   76667273' 'pure' 'path'
  213. check_files srun            '      2884     209028   76666287' 'pure' 'path'
  214. check_files strings         '      2736     205271 1764033446' 'pure' 'path'
  215. check_files tail            '      3588     259491   76659078' 'pure' 'path'
  216. check_files tee             '      2880     222196 1303797919' 'pure' 'path'
  217. check_files view            '      6200     511324 1303756615' 'pure' 'path'
  218. check_files wc              '      3212     235859   76662454' 'pure' 'path'
  219. check_files window          '      4840     347343 1994042642' 'pure' 'path'
  220. check_files xd              '      3408     258472  536907533' 'pure' 'path'
  221.  
  222. if [ -s "$missing" -a -s "$invalid" -a -s "$inpath" ]
  223. then
  224.    echo "\nSKsh external commands are valid.\n"
  225. fi
  226.  
  227. echo -n > "$missing"
  228. echo -n > "$invalid"
  229. echo -n > "$inpath"
  230.  
  231. # --- Find dir containing sksh documentation... ------------------------------
  232.  
  233. echo -n "\nDo you wish to check the documentation files [y/n] ? > "; read yn
  234. echo
  235.  
  236. if [ "$yn" = 'y' -o "$yn" = 'Y' ]
  237. then
  238.  
  239. read_dir "Please enter the name of the directory which contains the SKsh" \
  240.          "documentation files" "MAN:"
  241.  
  242. echo -c "\n$_ANSI_US" "Checking SKsh documentation files...$_ANSI_UE" "\n"
  243. cd "$in_dir"
  244.  
  245. check_files Addendum1.1.doc '      7777     547578  846267691' '' ''
  246. check_files Addendum1.2.doc '     10166     719184  846287525' '' ''
  247. check_files Addendum1.3.doc '     21523    1579874  232839043' '' ''
  248. check_files Addendum1.4.doc '     27115    1931513  232884596' '' ''
  249. check_files Addendum1.5.doc '     31858    2358666 1607759333' '' ''
  250. check_files Addendum1.6.doc '     15417    1114231  994375034' '' ''
  251. check_files Bugs.doc        '      1854     122801 1295233284' '' ''
  252. check_files Diffs.doc       '      6201     443660 1314849289' '' ''
  253. check_files ErrorCodes.doc  '      2405     151213 1753026272' '' ''
  254. check_files ExtCmds.doc     '     51090    3342542 1063441335' '' ''
  255. check_files Hints.doc       '      7882     563767  376124102' '' ''
  256. check_files Install.doc     '      6732     452605 1677387440' '' ''
  257. check_files MiscInfo.doc    '      5904     437686  740472207' '' ''
  258. check_files ReadMe_1st.doc  '      5303     363846 1354028415' '' ''
  259. check_files Reference.doc   '    152511    9929090 1701119901' '' ''
  260. check_files TechNotes.doc   '      5451     404613 1267203720' '' ''
  261. check_files TinySKsh.doc    '      3176     208417  774303476' '' ''
  262. check_files UserMan.doc     '    102292    7283198 1676411641' '' ''
  263. check_files View.doc        '     13037     952692 1088835487' '' ''
  264.  
  265. if [ -s "$missing" -a -s "$invalid" -a -s "$inpath" ]
  266. then
  267.    echo "\nSKsh documentation files are valid.\n"
  268. fi
  269.  
  270. fi # end of doc file check
  271.  
  272. # --- Find dir containing stuff.sksh... -----------------------------------
  273.  
  274. echo -n "\nDo you wish to check the Stuff.sksh file [y/n] ? > "; read yn
  275. echo
  276.  
  277. if [ "$yn" = 'y' -o "$yn" = 'Y' ]
  278. then
  279.  
  280. read_dir "Please enter the name of the directory which contains the" \
  281.          "Stuff.sksh file" "sksh:"
  282.  
  283. echo -c "\n$_ANSI_US" "Checking Stuff.sksh file...$_ANSI_UE" "\n"
  284. cd "$in_dir"
  285.  
  286. check_files Stuff.sksh      '      8644     574008 1424267139' '' ''
  287.  
  288. if [ -f Stuff.sksh ]
  289. then
  290.    check_files Stuff.sksh.pp   '      6226     338179 1654313710' '' ''
  291. fi
  292.  
  293. if [ -s "$missing" -a -s "$invalid" -a -s "$inpath" ]
  294. then
  295.    echo "\nStuff.sksh file is valid.\n"
  296. fi
  297.  
  298. fi # end of Stuff.sksh file check
  299.  
  300.  
  301. echo "\nSKsh installation checking complete."
  302. clean_up
  303.