spegla-mirror 982 B

123456789101112131415161718192021222324252627282930313233343536
  1. #!/bin/sh
  2. ##
  3. ## spegla-mirror -- Spegla Mirror Manager
  4. ## Copyright (c) 2000-2003 Ralf S. Engelschall <rse@engelschall.com>
  5. ##
  6. BINDIR="@l_prefix@/bin"
  7. ETCDIR="@l_prefix@/etc/spegla"
  8. VARDIR="@l_prefix@/var/spegla"
  9. PKGDIR="@l_prefix@/var/spegla/pkg"
  10. mirror () {
  11. ( pkg=$1
  12. echo "spegla-mirror: spawning mirror for <$pkg>" >>$VARDIR/spegla-mirror.log
  13. $BINDIR/spegla \
  14. --section=common --configfile=$ETCDIR/spegla.conf \
  15. --section=$pkg --configfile=$ETCDIR/spegla.conf \
  16. --lockfile=$PKGDIR/$pkg.lck \
  17. --logfile=$PKGDIR/$pkg.log \
  18. >>$VARDIR/spegla-mirror.log 2>&1
  19. echo "spegla-mirror: terminated mirror for <$pkg>" >>$VARDIR/spegla-mirror.log
  20. ) >/dev/null 2>&1 &
  21. }
  22. if [ $# -gt 0 ]; then
  23. for pkg in $*; do
  24. mirror $pkg
  25. done
  26. else
  27. for pkg in `egrep '^\[[a-zA-Z].*\]' $ETCDIR/spegla.conf |\
  28. grep -v common | sed -e 's/\[\(.*\)\]/\1/'`; do
  29. mirror $pkg
  30. done
  31. fi