home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 5 / Skunkware 5.iso / src / Tools / sco / mkcdfs < prev    next >
Encoding:
Text File  |  1995-05-03  |  2.0 KB  |  56 lines

  1. #!/bin/sh
  2. # This is a script to facilitate making a "CD ROM efficient" EAFS
  3. # filesystem.  Given an input directory hierarchy, it produces on standard
  4. # out a shell script which creates a directory structure framework, with
  5. # each directory fleshed out to the necessary size.  It also has comments
  6. # showing how to properly initialize the hard disk EAFS filesystem from
  7. # which the CD ROM image will be dd'd.
  8. # Hope this is helpful.
  9. # >Bela<
  10. #
  11. # mkcdfs  1.21  94/07/19  belal@sco.com
  12. #
  13. # usage: cd /working/directory; mkcdfs > OUTPUT_FILE
  14. #
  15. # e.g.: cd /v/wrk/dist; mkcdfs > /tmp/make_dist_tree
  16. #
  17. # The output is a shell script which can be run on a *blank* mkfs'd filesystem
  18. # to create a directory structure which will hopefully be efficient on an EAFS
  19. # filesystem CD-ROM.  The script is run like this:
  20. #
  21. #   cd /root/of/filesystem/from/which/CD/will/be/dd'd
  22. #   . /tmp/make_dist_tree
  23. #
  24. # The filesystem should have been created with
  25. #
  26. #   mkfs -y -f EAFS /dev/_whatever_ BBBB:IIII 1 2048 -E -C1
  27. #
  28. # where BBBB is the size of the filesystem, in 1/2K blocks (use about 5%
  29. # larger than cpio said) and IIII is the number of inodes (use perhaps
  30. # 100 more than the total number of files+directories on the filesystem).
  31. #
  32. # This is very crude...
  33.  
  34. echo "Making script to make CD filesystem of `/bin/pwd`" 1>&2
  35.  
  36. echo 'ROOT_DIR=`pwd`'
  37. find . -depth -type d -print |
  38.   sed 's-^\./--' | # `sed` to remove leading "./"
  39.   tr '/' '\01' |   # `tr` to make sure /etc/abc/def sorts before /etc/abc.def
  40.   sort |           # `sort` to make sure dirs processed before their subdirs
  41.   tr '\01' '/' |   # `tr` to undo the first `tr`
  42.   while read d; do
  43.     [ "$d" != "." ] && echo 'mkdir $ROOT_DIR/'"$d"
  44.     echo 'cat > /tmp/filelist.$$ << '"'__filelist__EOF'"
  45.     (echo $d/.* $d/* | xargs ls -lLd) 2>/dev/null | awk '/^d/ {next} {print $NF}'
  46.     echo '__filelist__EOF'
  47.     echo 'xargs -n100 touch < /tmp/filelist.$$'
  48.     echo 'cat /tmp/filelist.$$ >> /tmp/cpiolist.$$'
  49.   done
  50.  
  51. # Output should be redirected somewhere -- this is supposed to be writing
  52. # a shell script which will be executed later.
  53.