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