fnrclone 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. #! /bin/sh
  2. # This shell script runs findnewrcs on a clone tree.
  3. # Usage
  4. DoUsage()
  5. {
  6. cat << dernier
  7. Usage: fnrclone [-OPTIONS] <source> <destination>
  8. where OPTIONS are:
  9. [-c (checkout any new versions of files from RCS)]
  10. [-s (create a script & log file in $HOME/fnrclone and
  11. execute the script)]
  12. [-n (leave actual files, not symbolic links)]
  13. [-f <logfile name> (create a log file of changes)]
  14. [-d (descend symbolically linked directories)]
  15. [-S (do not follow symbolic links for files)
  16. [-O (do not check out files, Only create symbolic links for existing files)
  17. [-C (process SCCS directories[usually they are ignored])
  18. [-u Usage message]
  19. NOTE: the default is make symbolic links and don't check out newer
  20. revisions of files, just shadow the source. If the RCS directory is
  21. accessible, check out any brand new files as real files. If the
  22. RCS directory is not accessible (remote exchange), do NOT check out
  23. any brand new files.
  24. dernier
  25. }
  26. if [ $# -lt 2 ] ; then
  27. DoUsage
  28. exit 1
  29. fi
  30. DEF_s="L"
  31. DEF_X="X"
  32. LINKOPT="l"
  33. ACTUAL=
  34. #Parse the options
  35. set -- `getopt csSCOdnuf: $*`
  36. while [ $# -gt 0 ]
  37. do
  38. case $1 in
  39. -n) LINKOPT= ;shift;;
  40. -s) DEF_X=;shift;;
  41. -S) DEF_S=s;shift;;
  42. -c) DEF_s=;shift;;
  43. -C) DEF_C=C;shift;;
  44. -O) DEF_O=O;shift;;
  45. -u) DoUsage;shift;;
  46. -f) LOG=$2;shift 2;;
  47. -d) ACTUAL="${ACTUAL}f";shift;;
  48. --) shift;;
  49. -*) DoUsage;shift;;
  50. *) SRC=$1;DEST=$2;shift 2;;
  51. esac
  52. done
  53. OPTS="${DEF_X}${DEF_s}${DEF_S}${DEF_C}${DEF_O}${ACTUAL}${LINKOPT}miA"
  54. #
  55. # get the system from uname -s
  56. #
  57. SYSTEM=`uname -s`
  58. RELEASE=`uname -r`
  59. MACHINE=`uname -m`
  60. Findnewrcs="findnewrcs.${SYSTEM}"
  61. if [ "$SYSTEM" = "HP-UX" ];then
  62. # 700's
  63. M700=`echo $MACHINE | fgrep '/7' 2>/dev/null`
  64. M800=`echo $MACHINE | fgrep '/8' 2>/dev/null`
  65. R100=`echo $RELEASE | fgrep '10.' 2>/dev/null`
  66. R90=`echo $RELEASE | fgrep '9.' 2>/dev/null`
  67. R80=`echo $RELEASE | fgrep '8.' 2>/dev/null`
  68. R70=`echo $RELEASE | fgrep '7.' 2>/dev/null`
  69. if [ "$M700" ]; then
  70. if [ "$R100" ];then
  71. Findnewrcs="findnewrcs.700.100"
  72. elif [ "$R80" ];then
  73. Findnewrcs="findnewrcs.700.807"
  74. fi
  75. elif [ "$M800" ]; then
  76. if [ "$R100" ];then
  77. Findnewrcs="findnewrcs.800.100"
  78. elif [ "$R90" ];then
  79. Findnewrcs="findnewrcs.800.90"
  80. elif [ "$R80" ];then
  81. Findnewrcs="findnewrcs.800.80"
  82. else
  83. Findnewrcs="findnewrcs.800.70"
  84. fi
  85. else
  86. if [ "$R90" ];then
  87. Findnewrcs="findnewrcs.300.90"
  88. elif [ "$R80" ];then
  89. Findnewrcs="findnewrcs.300.80"
  90. fi
  91. fi
  92. fi
  93. if [ "$SYSTEM" = "SunOS" ];then
  94. if [ "$MACHINE" = "i86pc" ];then
  95. Findnewrcs="findnewrcs.UNIX_SV"
  96. elif [ "$MACHINE" = "prep" ];then
  97. Findnewrcs="findnewrcs.SunOS_PPC"
  98. else
  99. Findnewrcs="findnewrcs.SunOS"
  100. fi
  101. fi
  102. #
  103. # make an old style script
  104. #
  105. FNR_BINDIR=`dirname $0`
  106. if [ ! "$DEF_X" ];then
  107. DATE=`date +%H%M%S`
  108. FNR_DIR=/$HOME/fnrclone
  109. [ ! -d $FNR_DIR ] && mkdir $FNR_DIR
  110. FNR_SCRIPT=$FNR_DIR/script$DATE
  111. FNR_LOG=$FNR_DIR/log$DATE
  112. $FNR_BINDIR/$Findnewrcs -S${SRC} -W${DEST} -${OPTS} > $FNR_SCRIPT 2> $FNR_LOG
  113. chmod 777 $FNR_SCRIPT
  114. chmod 777 $FNR_LOG
  115. $FNR_SCRIPT
  116. echo "`basename $0`: script is in $FNR_SCRIPT, logfile is $FNR_LOG"
  117. if [ "$LOG" ];then
  118. cat $FNR_LOG > $LOG
  119. echo "logfile is also in $LOG"
  120. fi
  121. else # execute without a script
  122. if [ "$LOG" ];then
  123. $FNR_BINDIR/$Findnewrcs -S${SRC} -W${DEST} -${OPTS} 2> $LOG
  124. else
  125. $FNR_BINDIR/$Findnewrcs -S${SRC} -W${DEST} -${OPTS}
  126. fi
  127. fi