home *** CD-ROM | disk | FTP | other *** search
/ Complete Linux / Complete Linux.iso / docs / apps / database / postgres / postgre4.z / postgre4 / newconf / doctree < prev    next >
Encoding:
Text File  |  1992-08-27  |  2.1 KB  |  132 lines

  1. #!/bin/sh
  2. #
  3. #    doctree -- create a copy of the postgres master documentation tree
  4. #
  5. # handle some command line arguments...
  6.  
  7. if [ -z "$PGMASTERTREE" ]; then
  8.     MASTER=/usr/local/dev/postgres/mastertree/doc
  9. else
  10.     MASTER=$PGMASTERTREE/doc
  11. fi
  12.  
  13. cd $MASTER
  14.  
  15. debug=0
  16. quiet=0
  17. TREE=""
  18. name=$0
  19. create=0
  20. usage="Usage: $name [-d] [-q] [-c] full_path_to_tree"
  21.  
  22. while (test ! -z "$1")
  23. do
  24.     case $1 in
  25.     -d)
  26.         debug=1
  27.         shift ;;
  28.     -c)
  29.         create=1
  30.         shift ;;
  31.     -q)
  32.         quiet=1
  33.         shift;;
  34.     -*)
  35.         echo "$usage" >&2
  36.         exit 1 ;;
  37.     /*)
  38.         TREE=$1
  39.         shift ;;
  40.     *)
  41.         echo "$usage" >&2
  42.         exit 1 ;;
  43.     esac
  44. done
  45.  
  46. if (test ! -z "$TREE")
  47. then
  48.     if (test $quiet -eq 0)
  49.     then
  50.         echo "using directory $TREE"
  51.     fi
  52. fi
  53.  
  54. if (test -z "$TREE")
  55. then
  56.     echo ""
  57.     echo -n "Full pathname of directory to contain doc tree "
  58.     echo -n "(default /usr/postgres/doc): "
  59.     read TREE
  60.  
  61.     if (test -z "$TREE")
  62.     then
  63.         TREE="/usr/postgres/doc"
  64.     fi
  65. fi
  66.  
  67. if (test ! -d $TREE -a $create -eq 0)
  68. then
  69.     echo ""
  70.     echo -n "Directory $TREE does not exist; create (y/n)? "
  71.     read yn
  72.     if (test $yn != y)
  73.     then
  74.         echo "aborting doctree creation"
  75.         exit
  76.     fi
  77.     create=1
  78. fi
  79.  
  80. if (test $create -eq 1)
  81. then
  82.     TREEPATH=`echo $TREE | sed 's|/| |g' `
  83.     cd /
  84.     echo
  85.     for i in $TREEPATH
  86.     do
  87.         if (test ! -d $i)
  88.         then
  89.             echo ===== creating `pwd`/$i =====
  90.             mkdir $i
  91.         fi
  92.         cd $i
  93.     done
  94.     echo
  95. fi
  96.  
  97. # generate the new tree
  98.  
  99. cd $TREE
  100. if (test -d $MASTER/RCS)
  101. then
  102.     if (test $quiet -eq 0)
  103.     then
  104.     echo ===== checking out files in $MASTER =====
  105.     fi
  106.     if (test $debug -eq 0)
  107.     then
  108.     ln -s $MASTER/RCS
  109.     co -q RCS/*,v
  110.     fi
  111. fi
  112.  
  113. for i in `co -q -p $MASTER/dirs.mk`
  114. do
  115.     mkdir $TREE/$i
  116.     if (test -d $MASTER/$i/RCS)
  117.     then
  118.         cd $TREE/$i
  119.         if (test $quiet -eq 0)
  120.         then
  121.             echo ===== checking out files in $i =====
  122.         fi
  123.         if (test $debug -eq 0)
  124.         then
  125.             ln -s $MASTER/$i/RCS
  126.             co -q RCS/*,v
  127.         fi
  128.     fi
  129. done
  130.  
  131. echo ===== documentation tree completed =====
  132.