Debian Codegraph @

libexec/list

raw
1 #!/bin/sh
2
3 # Linux Vulnerability Mitigation
4 # Copyright (C) 2026 Daniel Baumann <[email protected]>
5 #
6 # SPDX-License-Identifier: PD
7 #
8 # This program is free software: you have unlimited permission
9 # to copy, distribute and modify it.
10 #
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14
15 set -e
16
17 PROGRAM="linux-vulnerability-mitigation"
18 COMMAND="$(basename "${0}")"
19
20 SHARE="/usr/share/${PROGRAM}"
21
22 if [ -t 1 ] && [ -t 2 ]
23 then
24 WHITE="\033[1;33;37m"
25 NORMAL="\033[0m"
26 fi
27
28 Parameters ()
29 {
30 GETOPT_LONGOPTIONS="help,"
31 GETOPT_OPTIONS="h,"
32
33 PARAMETERS="$(getopt --longoptions ${GETOPT_LONGOPTIONS} --name="${COMMAND}" --options ${GETOPT_OPTIONS} --shell sh -- "${@}")"
34
35 # shellcheck disable=SC2181
36 if [ "${?}" != "0" ]
37 then
38 echo "'${COMMAND}': getopt exit" >&2
39 exit 1
40 fi
41
42 eval set -- "${PARAMETERS}"
43
44 while true
45 do
46 case "${1}" in
47 -h|--help)
48 Usage
49 ;;
50
51 --)
52 shift 1
53 break
54 ;;
55
56 *)
57 echo "'${COMMAND}': getopt error" >&2
58 exit 1
59 ;;
60 esac
61 done
62 }
63
64 Usage ()
65 {
66 echo "Usage: ${PROGRAM} ${COMMAND} [-h|--help]" >&2
67 echo
68 echo "See ${PROGRAM}-${COMMAND}(1), ${PROGRAM}(1) and ${PROGRAM}(7) for more information."
69 }
70
71 Parameters "${@}"
72
73 # Run
74 MITIGATIONS="$(find "${SHARE}/mitigations" -mindepth 1 -printf '%f\n' | sort -V)"
75
76 for MITIGATION in ${MITIGATIONS}
77 do
78 echo " ${WHITE}available ${NORMAL} ${MITIGATION} $(awk -F= '/^DATE=/ { print $2 }' "${SHARE}/mitigations/${MITIGATION}") $(awk -F= '/^NAME=/ { print $2 }' "${SHARE}/mitigations/${MITIGATION}")"
79 done