3 export SCRIPTVARS=/srv/ftp.debian.org/dak/config/debian/vars
6 # Tarball to read, compressed with gzip
7 INPUT="${1:?"Usage: $0 filename"}"
9 # Regular expression used to validate tag lines
10 CHECKRE='^[a-z0-9A-Z.+-]+[[:space:]]+Tag[[:space:]]+[a-z0-9:. ,{}+-]+$'
12 # This must end with /
13 TARGET=/srv/ftp.debian.org/scripts/external-overrides/
15 # Read the main directory from the tarball
16 DIR="`tar ztf \"$INPUT\" | tac | tail -n 1`"
18 # Create temporary files where to store the validated data
20 OUTMAIN="`mktemp \"$TARGET\"tag.new.XXXXXX`"
21 OUTCONTRIB="`mktemp \"$TARGET\"tag.contrib.new.XXXXXX`"
22 OUTNONFREE="`mktemp \"$TARGET\"tag.non-free.new.XXXXXX`"
24 # If we fail somewhere, cleanup the temporary files
32 # Extract the data into the temporary files
33 tar -O -zxf "$INPUT" "$DIR"tag | grep -E "$CHECKRE" > "$OUTMAIN"
34 tar -O -zxf "$INPUT" "$DIR"tag.contrib | grep -E "$CHECKRE" > "$OUTCONTRIB"
35 tar -O -zxf "$INPUT" "$DIR"tag.non-free | grep -E "$CHECKRE" > "$OUTNONFREE"
37 # Move the data to the final location
38 mv "$OUTMAIN" "$TARGET"tag
39 mv "$OUTCONTRIB" "$TARGET"tag.contrib
40 mv "$OUTNONFREE" "$TARGET"tag.non-free
42 chmod 644 "$TARGET"tag "$TARGET"tag.contrib "$TARGET"tag.non-free
44 (cd $TARGET && $scriptsdir/mk-extra-overrides.sh)