]> git.decadent.org.uk Git - dak.git/blob - scripts/debian/byhand-debian-faq
Add byhand script for debian-faq.
[dak.git] / scripts / debian / byhand-debian-faq
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
23 set -e
24 set -u
25
26 export SCRIPTVARS=/srv/ftp-master.debian.org/dak/config/debian/vars
27 . ${SCRIPTVARS}
28
29 scriptname=byhand-debian-faq
30
31 if [ $# -lt 4 ]; then
32     echo "usage: ${scriptname} <byhand-file> <version> <arch> <changes-file>" >&2
33     exit 1
34 fi
35
36 byhand_path="${1}"
37 byhand_file="${byhand_path##*/}"
38 version="${2}"
39 architecture="${3}"
40 changes="${4}"
41
42 suite="$(awk '/^Distribution:/ { print $2 }' < "${changes}")"
43 case "${suite}" in
44     unstable|sid)
45         : # okay
46         ;;
47     *)
48         echo "$0: not targeted at unstable" >&2
49         exit 1
50         ;;
51 esac
52
53 if [[ ! "${byhand_file}" =~ ^debian-faq\.en\.(html\.tar|txt|ps|pdf)\.gz$ ]]; then
54     echo "$0: unknown file '${byhand_file}'" >&2
55     exit 1
56 fi
57
58 target="${ftpdir}/doc/FAQ/"
59 if [ ! -d "${target}" ]; then
60     mkdir -p "${target}"
61 fi
62
63 cp --remove-destination "${byhand_path}" "${target}"
64 chmod 0644 "${target}/${byhand_file}"