apt: Add whitelist for strict mode

This change adds a whitelist of packages that will be ignored when using
strict mode.

Change-Id: I9138f35a72618100e6094575271f6160336332f4
Signed-off-by: Drew Walters <andrew.walters@att.com>
This commit is contained in:
Drew Walters 2020-01-26 16:42:03 +00:00
parent 3cc1620319
commit fe270ec595
1 changed files with 17 additions and 0 deletions

View File

@ -193,9 +193,26 @@ if [ -f ${persist_path}/packages ]; then
{{- end }}
if [ ! -z "$TO_DELETE" ]; then
dpkg --configure -a
{{- if hasKey .Values.conf.apt "whitelistpkgs" }}
WHITELIST=({{ include "helm-toolkit.utils.joinListWithSpace" .Values.conf.apt.whitelistpkgs }})
{{- end }}
PURGE_LIST=""
while read -r pkg; do
{{- if hasKey .Values.conf.apt "whitelistpkgs" }}
found=false
for item in "${WHITELIST[@]}"; do
if [[ "${item}" == "${pkg}" ]]; then
found=true
break
fi
done
if [[ "${found}" == "false" ]]; then
PURGE_LIST="$PURGE_LIST $pkg"
fi
{{- else }}
PURGE_LIST="$PURGE_LIST $pkg"
{{- end }}
done <<< "$TO_DELETE"
DEBIAN_FRONTEND=noninteractive $APT_PURGE $PURGE_LIST
fi