X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=scripts%2Fdebian%2Fbyhand-tag;h=f9840cfd89237aba5b0c25a2a783ea55fecae6cf;hb=555ead275da590d2325c2fa4ef2652547100d72b;hp=e05fd2f3b574d58003b579140359873b0c0c77ec;hpb=b6c67dcc88fb1b49cb322eabb03e34567811fde0;p=dak.git diff --git a/scripts/debian/byhand-tag b/scripts/debian/byhand-tag index e05fd2f3..f9840cfd 100755 --- a/scripts/debian/byhand-tag +++ b/scripts/debian/byhand-tag @@ -1,7 +1,8 @@ -#!/bin/sh +#!/bin/bash set -u set -e +set -o pipefail export SCRIPTVARS=/srv/ftp-master.debian.org/dak/config/debian/vars . $SCRIPTVARS @@ -33,9 +34,18 @@ cleanup() { trap cleanup EXIT # Extract the data into the temporary files -tar -O -zxf "$INPUT" "$DIR"/tag | grep -E "$CHECKRE" > "$OUTMAIN" -tar -O -zxf "$INPUT" "$DIR"/tag.contrib | grep -E "$CHECKRE" > "$OUTCONTRIB" -tar -O -zxf "$INPUT" "$DIR"/tag.non-free | grep -E "$CHECKRE" > "$OUTNONFREE" +tar -O -zxf "$INPUT" "$DIR"/tag > "$OUTMAIN" +tar -O -zxf "$INPUT" "$DIR"/tag.contrib > "$OUTCONTRIB" +tar -O -zxf "$INPUT" "$DIR"/tag.non-free > "$OUTNONFREE" + +# check temporary files for invalid contents +status=0 +grep -vq -E "$CHECKRE" "$OUTMAIN" "$OUTCONTRIB" "$OUTNONFREE" || status=$? +# checking just $? != 0 is not enough. grep can return 2 on other errors. +if [ $status != 1 ]; then + echo "Aborting automatic import (invalid data found)." >&2 + exit 1 +fi # Move the data to the final location mv "$OUTMAIN" "$TARGET"tag