byhand-debian-faq 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. #! /bin/bash
  2. #
  3. # byhand-debian-faq - automatic BYHAND handling for debian-faq
  4. #
  5. # This file is part of dak.
  6. #
  7. # Copyright 2013, Ansgar Burchardt <ansgar@debian.org>
  8. #
  9. # This program is free software; you can redistribute it and/or modify
  10. # it under the terms of the GNU General Public License as published by
  11. # the Free Software Foundation; either version 2 of the License, or
  12. # (at your option) any later version.
  13. #
  14. # This program is distributed in the hope that it will be useful,
  15. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. # GNU General Public License for more details.
  18. #
  19. # You should have received a copy of the GNU General Public License along
  20. # with this program; if not, write to the Free Software Foundation, Inc.,
  21. # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  22. set -e
  23. set -u
  24. export SCRIPTVARS=/srv/ftp-master.debian.org/dak/config/debian/vars
  25. . ${SCRIPTVARS}
  26. scriptname=byhand-debian-faq
  27. if [ $# -lt 4 ]; then
  28. echo "usage: ${scriptname} <byhand-file> <version> <arch> <changes-file>" >&2
  29. exit 1
  30. fi
  31. byhand_path="${1}"
  32. byhand_file="${byhand_path##*/}"
  33. version="${2}"
  34. architecture="${3}"
  35. changes="${4}"
  36. suite="$(awk '/^Distribution:/ { print $2 }' < "${changes}")"
  37. case "${suite}" in
  38. unstable|sid)
  39. : # okay
  40. ;;
  41. *)
  42. echo "$0: not targeted at unstable" >&2
  43. exit 1
  44. ;;
  45. esac
  46. if [[ ! "${byhand_file}" =~ ^debian-faq\.en\.(html\.tar|txt|ps|pdf)\.gz$ ]]; then
  47. echo "$0: unknown file '${byhand_file}'" >&2
  48. exit 1
  49. fi
  50. target="${ftpdir}/doc/FAQ/"
  51. if [ ! -d "${target}" ]; then
  52. mkdir -p "${target}"
  53. fi
  54. cp --remove-destination "${byhand_path}" "${target}"
  55. chmod 0644 "${target}/${byhand_file}"