]> git.decadent.org.uk Git - dak.git/blob - scripts/debian/byhand-task
Add autobyhand support for task overrides (from tasksel)
[dak.git] / scripts / debian / byhand-task
1 #!/bin/sh -ue
2
3 # Tarball to read, compressed with gzip
4 INPUT="${1:?"Usage: $0 filename"}"
5
6 # Regular expression used to validate tag lines
7 CHECKRE='^[a-z0-9A-Z.+-]+[[:space:]]+Task[[:space:]]+[a-z0-9:. ,{}+-]+$'
8
9 # This must end with /
10 TARGET=/srv/ftp.debian.org/scripts/external-overrides/
11
12 # Read the main directory from the tarball
13 DIR="`tar ztf \"$INPUT\" | tac | tail -n 1`"
14
15 # Create temporary files where to store the validated data
16 umask 002
17 OUTMAIN="`mktemp \"$TARGET\"task.new.XXXXXX`"
18
19 # If we fail somewhere, cleanup the temporary files
20 cleanup() {
21         rm -f "$OUTMAIN"
22 }
23 trap cleanup EXIT
24
25 # Extract the data into the temporary files
26 tar -O -zxf "$INPUT" "$DIR"task | grep -E "$CHECKRE" > "$OUTMAIN"
27
28 # Move the data to the final location
29 mv "$OUTMAIN"           "$TARGET"task
30
31 chmod 644 "$TARGET"task
32
33 (cd $TARGET && ./mk-extra-overrides.sh)
34
35 trap - EXIT
36
37 exit 0