[Git][security-tracker-team/security-tracker][master] 2 commits: gen-DSA: switch to getopt, add --no-color option

Salvatore Bonaccorso (@carnil) carnil at debian.org
Tue Feb 17 17:26:05 GMT 2026



Salvatore Bonaccorso pushed to branch master at Debian Security Tracker / security-tracker


Commits:
e8473725 by Sébastien Delafond at 2026-02-17T13:46:37+01:00
gen-DSA: switch to getopt, add --no-color option

- - - - -
0dbe1163 by Salvatore Bonaccorso at 2026-02-17T18:26:03+01:00
Merge branch 'gen-dsa-no-color' into 'master'

gen-DSA: add --no-color option

See merge request security-tracker-team/security-tracker!268
- - - - -


1 changed file:

- bin/gen-DSA


Changes:

=====================================
bin/gen-DSA
=====================================
@@ -52,37 +52,56 @@ export LC_ALL=C
     exit 1
 }
 
-[ $# -ge 1 ] || {
-    echo "usage: $0 [--save] [--embargoed|--unembargo] [$IDMODE] package[.changes] [regression] [cve(s) [bugnumber(s)]] "
+usage() {
+    echo "usage: $0 [--save] [--embargoed|--unembargo] [--no-color] [$IDMODE] package[.changes] [regression] [cve(s) [bugnumber(s)]] "
     echo "       '$IDMODE' is the $IDMODE number, required when issuing a revision"
     echo "       'cve(s)' and 'bugnumber(s)' can be passed in any order but"
     echo "         always AFTER the description"
-    echo ""
+    echo
     echo "       When specifying package.changes the package name, version, additional bug(s) and cve(s)"
     echo "       are parsed from the .changes file."
-    echo ""
+    echo
     echo "       If it doesn't like your bug number, prefix it with # and report"
-    exit 1
-} >&2
+}
 
-save=false
-if [ "$1" = "--save" ]; then
-    save=true
-    shift
-fi
+ARGS=$(getopt --options "e,h,n,s,u" --longoptions "embargoed,help,no-color,save,unembargo" -- "$@" || { usage >&2 ; exit 1 ;})
 
-embargoed=false
-if [ "$1" = "--embargoed" ]; then
-    embargoed=true
-    shift
-fi
+eval set -- "$ARGS"
 
+save=false
+embargoed=false
 unembargo=false
-if [ "$1" = "--unembargo" ]; then
-    unembargo=true
-    shift
-    set -- "$1"
-fi
+color=true
+while true ; do
+    case "$1" in
+	-e|--embargoed)
+	    embargoed=true
+	    shift
+	    continue ;;
+	-h|--help)
+	    usage >&2
+	    exit 0 ;;
+        -n|--no-color)
+            color=false
+            shift
+            continue ;;
+	-s|--save)
+	    save=true
+	    shift
+	    continue ;;
+	-u|--unembargo)
+	    unembargo=true
+	    shift
+	    continue ;;
+	--)
+	    shift
+	    break ;;
+	*)
+	    echo $1
+	    echo "internal error" >&1
+	    exit 1 ;;
+    esac
+done
 
 toupper() {
     printf '%s' "$1" | tr '[:lower:]' '[:upper:]'
@@ -149,7 +168,7 @@ setvar() {
     sed -i "s=\$$var=$value=g" "$tmpf"
 }
 
-if command -v tput >/dev/null; then
+if $color && [ -z "$NO_COLOR" ] && command -v tput >/dev/null ; then
     RED=$(tput setaf 1)
     YELLOW=$(tput setaf 3)
     MAGENTA=$(tput setaf 5)



View it on GitLab: https://salsa.debian.org/security-tracker-team/security-tracker/-/compare/a938db704cf8d814831d225c17de6f924baff58e...0dbe11635e441bdb7e24847912ad4571bbc5b360

-- 
View it on GitLab: https://salsa.debian.org/security-tracker-team/security-tracker/-/compare/a938db704cf8d814831d225c17de6f924baff58e...0dbe11635e441bdb7e24847912ad4571bbc5b360
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-security-tracker-commits/attachments/20260217/e542f8dd/attachment-0001.htm>


More information about the debian-security-tracker-commits mailing list