/cron.weekly/cvs

http://github.com/brinkman83/bashrc · Shell · 68 lines · 40 code · 7 blank · 21 comment · 9 complexity · 399d8deb045fc6def684999341e91011 MD5 · raw file

  1. #!/bin/sh
  2. # $Debian: cron.weekly,v 1.1 2001/04/20 16:00:54 epg Exp $
  3. # CVS cron.weekly script - rotate history files in registered CVS dirs.
  4. # rotate <dir>
  5. rotate ()
  6. {
  7. DIR="$1"
  8. if [ ! -d $DIR ] || [ ! -d $DIR/CVSROOT ] || [ ! -f $DIR/CVSROOT/history ]; then
  9. return
  10. fi
  11. if [ "$ROTKEEP" = "yes" ]; then
  12. #db_get cvs/rotatekeep
  13. #KEEPTIME="$RET"
  14. KEEPTIME="$OTHER_ROTKEEP"
  15. elif [ "$ROTKEEP" = "individual" ]; then
  16. RNAME="`echo "$DIR" | sed -e 's:/:_:g'`"
  17. #db_get "cvs/rotatekeep/$RNAME"
  18. #KEEPTIME="$RET"
  19. eval KEEPTIME="\${ROTKEEP_${RNAME}}"
  20. else # no
  21. KEEPTIME="7"
  22. fi
  23. savelog -p -t -c $KEEPTIME $DIR/CVSROOT/history >/dev/null 2>&1
  24. }
  25. # Uncomment these if you want to use debconf to get the variables directly
  26. #. /usr/share/debconf/confmodule
  27. if [ -e /etc/cvs-cron.conf ] ; then
  28. . /etc/cvs-cron.conf
  29. fi
  30. # Retrieve some useful variables
  31. #db_get cvs/rotatehistory
  32. #ROT_HIST="$RET"
  33. #db_get cvs/repositories
  34. #REPOS="$RET"
  35. #db_get cvs/rotatekeep_nondefault
  36. #ROTKEEP="$RET"
  37. # Do the rotation
  38. if [ "$ROT_HIST" = "no" ]; then
  39. exit 0
  40. elif [ "$ROT_HIST" = "individual" ]; then
  41. IFS=':'
  42. for i in $REPOS; do
  43. IFS=' \
  44. '
  45. RNAME="`echo "$i" | sed -e 's:/:_:g'`"
  46. #db_get "cvs/rotate/$RNAME"
  47. #if [ "$RET" = "true" ]; then
  48. eval T="\${ROT_${RNAME}}"
  49. if [ "$T" = "true" ]; then
  50. rotate $i
  51. fi
  52. done
  53. else # yes
  54. IFS=':'
  55. for i in $REPOS; do
  56. IFS=' \
  57. '
  58. rotate $i
  59. done
  60. fi
  61. # End of file.