inn2newsd.sh 1006 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. #!/bin/sh
  2. #
  3. # Simple script to convert an INND spool directory into a Newsd spool
  4. # directory.
  5. #
  6. # Usage:
  7. #
  8. # inn2newsd.sh inn-spooldir newsd-spooldir
  9. #
  10. if test $# != 2; then
  11. echo Usage: $0 inn-spooldir newsd-spooldir
  12. exit 1
  13. fi
  14. if test ! -d "$1"; then
  15. echo $0: INND directory $1 does not exist!
  16. exit 1
  17. fi
  18. if test ! -d "$1/articles"; then
  19. echo $0: INND directory $1 does not contain an articles subdirectory!
  20. exit 1
  21. fi
  22. if test ! -d "$2"; then
  23. echo $0: Newsd directory $2 does not exist!
  24. exit 1
  25. fi
  26. inndspool="$1/articles"
  27. newsdspool="$2"
  28. cd "$inndspool"
  29. if test "$inndspool" != "$newsdspool"; then
  30. echo Copying INND articles to Newsd...
  31. cp -r * "$newsdspool"
  32. chown -R news:news "$newsdspool"
  33. chmod -R ugo+r,u+w,go-w "$newsdspool"
  34. echo Copy complete!
  35. fi
  36. cd "$newsdspool"
  37. echo Creating Newsd groups...
  38. for group in `find . -type d -print`; do
  39. case "$group" in
  40. */announce | */commit | */cvs)
  41. echo postok 0 >$group/.config
  42. ;;
  43. *)
  44. echo postok 1 >$group/.config
  45. ;;
  46. esac
  47. done