summaryrefslogtreecommitdiffstats
path: root/bin/gen-DSA
diff options
context:
space:
mode:
authorRaphael Geissert <geissert@debian.org>2012-09-05 18:58:39 +0000
committerRaphael Geissert <geissert@debian.org>2012-09-05 18:58:39 +0000
commit8031c750590278f20aca2d9dc1433e65d35abd6d (patch)
tree60db554fe86563d26874fc47265aae18aed7564f /bin/gen-DSA
parent1157ba81a003fa5c63b30412a696aa0f52e1b17f (diff)
Code cleanup
git-svn-id: svn+ssh://svn.debian.org/svn/secure-testing@20102 e39458fd-73e7-0310-bf30-c45bca0a0e42
Diffstat (limited to 'bin/gen-DSA')
-rwxr-xr-xbin/gen-DSA59
1 files changed, 30 insertions, 29 deletions
diff --git a/bin/gen-DSA b/bin/gen-DSA
index 5e9ff81939..afd7679270 100755
--- a/bin/gen-DSA
+++ b/bin/gen-DSA
@@ -44,12 +44,6 @@ if [ "$1" = "--save" ]; then
shift
fi
-DSAID=
-if printf '%s' "$1" | grep -Eq '^(DSA-|)[0-9]+(-[0-9]+|)$'; then
- DSAID="${1#DSA-}"
- shift
-fi
-
toupper() {
printf '%s' "$1" | tr '[:lower:]' '[:upper:]'
}
@@ -75,6 +69,24 @@ error() {
printf "${RED}error:${NORMAL} %s\n" "$1"
}
+check_spelling() {
+ if which aspell >/dev/null && echo test | aspell -l en list 2>/dev/null; then
+ aspell -l en list
+ elif which enchant >/dev/null && echo test | enchant -l -d en 2>/dev/null; then
+ enchant -l -d en
+ fi
+}
+
+setvar() {
+ local var="$1" value="$2"
+
+ if [ -z "$value" ]; then
+ value="$(eval 'printf "%s" "$'"$var"'"')"
+ fi
+
+ sed -i "s=\$$var=$value=g" "$tmpf"
+}
+
if which tput >/dev/null; then
RED=$(tput setaf 1)
YELLOW=$(tput setaf 3)
@@ -87,6 +99,12 @@ else
NORMAL=''
fi
+DSAID=
+if printf '%s' "$1" | grep -Eq '^(DSA-|)[0-9]+(-[0-9]+|)$'; then
+ DSAID="${1#DSA-}"
+ shift
+fi
+
PACKAGE="$(tolower "$1")"
VULNERABILITY="$2"
CVE="$(toupper "$3")"
@@ -142,32 +160,15 @@ if dsa_exists "$DSAID"; then
exit 1
fi
-if which aspell >/dev/null && echo test | aspell -l en list 2>/dev/null; then
- echo "$VULNERABILITY" | aspell -l en list |
- while read word; do
- warn "possible spelling mistake: $word!" >&2
- done
-elif which enchant >/dev/null && echo test | enchant -l -d en 2>/dev/null; then
- echo "$VULNERABILITY" | enchant -l -d en |
- while read word; do
- warn "possible spelling mistake: $word!" >&2
- done
-fi
-
-setvar() {
- local var="$1" value="$2"
-
- if [ -z "$value" ]; then
- value="$(eval 'printf "%s" "$'"$var"'"')"
- fi
-
- sed -i "s=\$$var=$value=g" "$tmpf"
-}
+echo "$VULNERABILITY" | check_spelling |
+while read word; do
+ warn "possible spelling mistake: $word!" >&2
+done
tmpf=$(mktemp)
cat doc/DSA.template > $tmpf
-name_length=$(echo -n "$DEBFULLNAME" | wc -c)
+name_length=${#DEBFULLNAME}
spacing=$((24-$name_length))
SPACEDDEBFULLNAME="$DEBFULLNAME"
while [ $spacing -gt 0 ]; do
@@ -176,7 +177,7 @@ while [ $spacing -gt 0 ]; do
done
DATE="$(date +"%B %d, %Y")"
-date_length=$(echo -n "$DATE" | wc -c)
+date_length=${#DATE}
spacing=$((22-$date_length))
SPACEDDATE="$DATE"
while [ $spacing -gt 0 ]; do

© 2014-2024 Faster IT GmbH | imprint | privacy policy