Debian Codegraph @

debian/linux-vulnerability-mitigation.postinst

raw
1 #!/bin/sh
2
3 set -e
4
5 RED="\033[1;33;31m"
6 NORMAL="\033[0m"
7
8 . /usr/share/debconf/confmodule
9
10 case "${1}" in
11 configure)
12 db_get linux-vulnerability-mitigation/mode
13 MODE="${RET:-auto}" # select w/o empty
14
15 db_get linux-vulnerability-mitigation/mitigations
16 MITIGATIONS="${RET}" # multiselect w/ empty
17
18 db_stop
19
20 MITIGATIONS_AVAILABLE="$(find /usr/share/linux-vulnerability-mitigation/mitigations -mindepth 1 -printf '%f\n' | sort -V)"
21
22 case "${MODE}" in
23 all)
24 linux-vulnerability-mitigation install --mitigations=ALL
25 ;;
26
27 auto)
28 linux-vulnerability-mitigation auto
29 ;;
30
31 none)
32 echo " ${RED}WARNING:${NORMAL} no mitigations have been selected"
33 echo " ${RED}WARNING:${NORMAL} run 'sudo dpkg-reconfigure -plow linux-vulnerability-mitigation'"
34 ;;
35
36 manual)
37 if [ -n "${MITIGATIONS}" ]
38 then
39 linux-vulnerability-mitigation install --mitigations=$(echo ${MITIGATIONS} | sed -e 's| |,|g')
40 fi
41 ;;
42 esac
43 ;;
44
45 abort-upgrade|abort-remove|abort-deconfigure)
46
47 ;;
48
49 *)
50 echo "postinst called with unknown argument \`${1}'" >&2
51 exit 1
52 ;;
53 esac
54
55 #DEBHELPER#
56
57 exit 0