From 502a74064cdf20b1ad90e5ea5e9c47dc74b033a6 Mon Sep 17 00:00:00 2001 From: "Mosher, Jaymes (jm616v)" Date: Mon, 20 Nov 2023 00:56:51 -0700 Subject: [PATCH] Add optional pre/post install commands to divingbell-apt Change-Id: I3fdee4b128bfba80bd827fb6a64b800652cdee2f --- divingbell/Chart.yaml | 2 +- divingbell/templates/bin/_apt.sh.tpl | 24 ++++++++++++++++++++---- divingbell/values.yaml | 2 ++ 3 files changed, 23 insertions(+), 5 deletions(-) diff --git a/divingbell/Chart.yaml b/divingbell/Chart.yaml index 56c5816..af2cdbe 100644 --- a/divingbell/Chart.yaml +++ b/divingbell/Chart.yaml @@ -15,4 +15,4 @@ apiVersion: v1 description: divingbell name: divingbell -version: 0.1.3 +version: 0.1.4 diff --git a/divingbell/templates/bin/_apt.sh.tpl b/divingbell/templates/bin/_apt.sh.tpl index b2981b7..174ebda 100644 --- a/divingbell/templates/bin/_apt.sh.tpl +++ b/divingbell/templates/bin/_apt.sh.tpl @@ -59,6 +59,14 @@ wait_for_dpkg_availability(){ ################################################ #Stage 1 +#Optional pre-install command +################################################ +{{- if .Values.conf.apt.pre_install }} +{{ .Values.conf.apt.pre_install }} +{{- end }} + +################################################ +#Stage 2 #Collect data ################################################ @@ -68,7 +76,7 @@ load_package_list_with_versions $(dpkg -l | awk 'NR>5 {print $2"="$3}') declare -A package_info; while read -r name version; do package_info["$name"]="$version N/A N/A"; done < <(dpkg -l | awk '/^ii/ {gsub(/:[^ ]*/, "", $2); print $2, $3}') ################################################ -#Stage 2 +#Stage 3 #Add repositories and install/upgrade packages ################################################ @@ -164,7 +172,7 @@ fi {{- end }} ################################################ -#Stage 3 +#Stage 4 #Remove packages not present in conf.apt anymore ################################################ @@ -250,7 +258,7 @@ fi {{- end }} ###################################################### -#Stage 4 +#Stage 5 #Remove blacklisted packages in conf.apt.blacklistpkgs ###################################################### @@ -264,7 +272,7 @@ dpkg --configure -a --force-confold,confdef {{- end }} ###################################################### -#Stage 5 +#Stage 6 #Verify that all package versions are correct and latest ###################################################### {{- if .Values.conf.apt.upgrade }} @@ -301,6 +309,14 @@ for pkg in "${!package_info[@]}"; do fi done {{- end }} + +###################################################### +#Stage 7 +#Run optional post-install command +###################################################### +{{- if .Values.conf.apt.post_install }} +{{ .Values.conf.apt.post_install }} +{{- end }} log.INFO 'Putting the daemon to sleep.' EOF diff --git a/divingbell/values.yaml b/divingbell/values.yaml index cd5c18b..9437772 100644 --- a/divingbell/values.yaml +++ b/divingbell/values.yaml @@ -35,6 +35,8 @@ conf: - telnetd-ssl - nis - ntpdate + pre_install: null + post_install: null # perm: # rerun_policy: always # 86400 = 1 day