diff options
author | Raphael Geissert <geissert@debian.org> | 2011-01-06 00:07:52 +0000 |
---|---|---|
committer | Raphael Geissert <geissert@debian.org> | 2011-01-06 00:07:52 +0000 |
commit | 25885c0ef56330406325fe1b2ccc8e656c7125be (patch) | |
tree | b3bd6f1cc2f0c4311b06f2cf5b8ef30cd164872b /bin/gen-DSA | |
parent | 0188273bc5a34063abeb084068b75b458f3ec52a (diff) |
A few more tweaks to bin/gen-DSA
Use --save instead of piping the output to a file
git-svn-id: svn+ssh://svn.debian.org/svn/secure-testing@15797 e39458fd-73e7-0310-bf30-c45bca0a0e42
Diffstat (limited to 'bin/gen-DSA')
-rwxr-xr-x | bin/gen-DSA | 44 |
1 files changed, 41 insertions, 3 deletions
diff --git a/bin/gen-DSA b/bin/gen-DSA index 3a82678ad9..886effbcd7 100755 --- a/bin/gen-DSA +++ b/bin/gen-DSA @@ -24,16 +24,24 @@ OLDSTABLE= STABLE=lenny TESTING=squeeze +export LANG=C + [ -f doc/DSA.template ] || { echo "error: call this script from the root of the repository" >&2 exit 1 } [ $# -ge 3 ] || { - echo "usage: $0 DSA package vulnerability [cve(s) [bugnumber]]" >&2 + echo "usage: $0 [--save] DSA package vulnerability [cve(s) [bugnumber]]" >&2 exit 1 } +save=false +if [ "$1" = "--save" ]; then + save=true + shift +fi + DSAID="$1" PACKAGE="$(printf '%s' "$2" | tr "[:upper:]" "[:lower:]")" VULNERABILITY="$3" @@ -96,5 +104,35 @@ for dist in $OLDSTABLE $STABLE $TESTING UNSTABLE; do [ -z "$version" ] || setvar "${dist}_VERSION" "$version" done -cat $tmpf -rm -f "$tmpf" + +if ! $save; then + cat $tmpf + echo + echo " ---- " + echo "Pass --save as the first parameter to save the text to DSA-$DSAID" + echo "(the data/DSA/list entry will also be added)" + rm -f "$tmpf" + exit +else + mv -i $tmpf "DSA-$DSAID" || { rm -f $tmpf; exit; } + dsa_entry=$(mktemp) + cat <<EOF > $dsa_entry +[$(date +"%d %b %Y")] DSA-$DSAID $PACKAGE - $VULNERABILITY +EOF + + if [ "$CVE" ]; then + CVE="$(printf '%s' "$CVE" | sed 's/[ ,;]+/ /g')" + printf "\t{%s}\n" "$CVE" >> $dsa_entry + fi + + for dist in $OLDSTABLE $STABLE; do + version="$(eval 'printf "%s" "$'"$dist"_VERSION'"')" + [ -z "$version" ] || \ + printf "\t[%s] - %s %s\n" "$dist" "$PACKAGE" "$version" >> $dsa_entry + done + tmp_list="$(mktemp)" + cat $dsa_entry data/DSA/list > $tmp_list + cat $tmp_list > data/DSA/list + rm -f $tmp_list + echo "DSA text written to ./DSA-$DSAID" +fi |