fetch-all 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. #!/bin/sh
  2. # Sample script to use with fetch-makefile: fetch all distfiles
  3. # $OpenBSD: fetch-all,v 1.9 2009/06/04 15:15:48 sthen Exp $
  4. #
  5. # Copyright (c) 2000 Marc Espie.
  6. #
  7. # Redistribution and use in source and binary forms, with or without
  8. # modification, are permitted provided that the following conditions
  9. # are met:
  10. # 1. Redistributions of source code must retain the above copyright
  11. # notice, this list of conditions and the following disclaimer.
  12. # 2. Redistributions in binary form must reproduce the above copyright
  13. # notice, this list of conditions and the following disclaimer in the
  14. # documentation and/or other materials provided with the distribution.
  15. #
  16. # THIS SOFTWARE IS PROVIDED BY THE OPENBSD PROJECT AND CONTRIBUTORS
  17. # ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  18. # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  19. # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OPENBSD
  20. # PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  21. # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  22. # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  23. # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  24. # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  25. # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  26. # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  27. if [ "${FETCH_MANUALLY}" = "Yes" ]
  28. then
  29. exit 0
  30. fi
  31. file=`basename $1`
  32. dir=`dirname $1`
  33. mkdir -p $dir
  34. oldd=$PWD
  35. cd $dir
  36. for site in ${SITES}
  37. do
  38. if ${FETCH_CMD:-ftp} ${site}$file
  39. then
  40. echo -n "$site: "
  41. cd $oldd
  42. if [ -z "${CHECK}" ]
  43. then
  44. echo "$file: NO CHECKSUM"
  45. exit 0
  46. fi
  47. if echo "${CHECK}" | cksum -c
  48. then
  49. exit 0
  50. else
  51. cd $dir
  52. rm -f $1
  53. fi
  54. fi
  55. done
  56. echo "Fetch, no good distfile: $@, notify ${MAINTAINER}"
  57. exit 1