import_dataset.sh 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. #!/bin/bash
  2. # Copyright (C) 2008,2010 Joerg Jaspert <joerg@debian.org>
  3. # Permission is hereby granted, free of charge, to any person obtaining
  4. # a copy of this software and associated documentation files (the
  5. # "Software"), to deal in the Software without restriction, including
  6. # without limitation the rights to use, copy, modify, merge, publish,
  7. # distribute, sublicense, and/or sell copies of the Software, and to
  8. # permit persons to whom the Software is furnished to do so, subject to
  9. # the following conditions:
  10. #
  11. # The above copyright notice and this permission notice shall be
  12. # included in all copies or substantial portions of the Software.
  13. #
  14. # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  15. # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  16. # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  17. # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
  18. # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
  19. # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  20. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  21. set -e
  22. set -u
  23. # Load up some standard variables
  24. export SCRIPTVARS=/srv/ftp-master.debian.org/dak/config/debian/vars
  25. . $SCRIPTVARS
  26. IMPORTSUITE=${1:-"testing"}
  27. BRITNEY=""
  28. MD5SUM="${SSH_ORIGINAL_COMMAND}"
  29. case "${IMPORTSUITE}" in
  30. testing)
  31. DO_CHANGELOG="true"
  32. ;;
  33. testing-debug|wheezy-updates|jessie-updates|stretch-updates)
  34. DO_CHANGELOG="false"
  35. ;;
  36. *)
  37. echo "You are so wrong here that I can't even believe it. Sod off."
  38. exit 42
  39. ;;
  40. esac
  41. # Change to a known safe location
  42. cd $masterdir
  43. echo "Importing new data for ${IMPORTSUITE} into database"
  44. if [ "x${DO_CHANGELOG}x" = "xtruex" ]; then
  45. rm -f ${ftpdir}/dists/${IMPORTSUITE}/ChangeLog
  46. BRITNEY=" --britney"
  47. fi
  48. tmpfile=$(mktemp)
  49. trap "rm -f ${tmpfile}" EXIT
  50. cat > ${tmpfile}
  51. if ! echo "${MD5SUM} ${tmpfile}" | md5sum -c --quiet; then
  52. exit 42
  53. fi
  54. dak control-suite --set ${IMPORTSUITE} ${BRITNEY} < ${tmpfile}
  55. if [ "x${DO_CHANGELOG}x" = "xtruex" ]; then
  56. NOW=$(date "+%Y%m%d%H%M")
  57. cd ${ftpdir}/dists/${IMPORTSUITE}/
  58. mv ChangeLog ChangeLog.${NOW}
  59. ln -s ChangeLog.${NOW} ChangeLog
  60. find . -maxdepth 1 -mindepth 1 -type f -mmin +2880 -name 'ChangeLog.*' -delete
  61. fi
  62. #echo "Regenerating Packages/Sources files, be patient"
  63. #dak generate-packages-sources2 -s ${IMPORTSUITE} >/dev/null
  64. echo "Done"
  65. exit 0