Files
helm-charts/paperless-ngx/templates/pre-post-consumption-scripts.configmap.yaml
T
jklein a69542383e Conventions batch 1: icons, template file names, cosmetics
- Add icon: to all 17 Chart.yaml (official project icons); removes the
  last helm lint --strict INFO finding across the repo
- Rename template files to the <app>.<kind>.yaml scheme (apache-tika,
  gotenberg, teamspeak-server PVC, paperless-ngx configmap) - pure
  git mv, no content changes
- template-chart: fix missing space in {{ .Chart.Name}} and rename the
  ConfigMap resource -config-map -> -configmap (chart is never published)
- rallly: fix typos in required messages (rallySecret -> ralllySecret,
  databseSecret -> databaseSecret)
- README: document the deliberate PVC-name exception from the naming
  scheme (renames would provision new empty volumes)
- Patch-bump all 16 published charts

Rendered resources are byte-identical for all published charts (only
helm's '# Source:' comments change for the renamed files); the only
render change is the template-chart ConfigMap name.

Part of #32
2026-08-22 15:21:52 +02:00

53 lines
1.3 KiB
YAML

{{- if false }}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ .Release.Name }}-{{ .Chart.Name }}-pre-post-consumption-scripts
data:
pre-consume-script: |-
#!/bin/sh
set -x
# Pre-Consumption Scripts:
{{- range $key, $value := .Values.paperless.scripts.preConsumptionScripts }}
/scripts/{{ $value }}
{{- end }}
post-consume-script: |-
#!/bin/sh
set -x
# Post-Consumption Scripts:
{{- range $key, $value := .Values.paperless.scripts.postConsumptionScripts }}
/scripts/{{ $value }}
{{- end }}
remove-blank-lines: |-
#!/bin/bash
set -e -o pipefail
export LC_ALL=C
#IN="$1"
IN="$DOCUMENT_WORKING_PATH"
PAGES=$(pdfinfo "$IN" | grep ^Pages: | tr -dc '0-9')
THRESHOLD=0.002
non_blank() {
for i in $(seq 1 $PAGES) ; do
PERCENT=$(gs -o - -dFirstPage=${i} -dLastPage=${i} -sDEVICE=inkcov "${IN}" | grep CMYK | nawk 'BEGIN { sum=0; } {sum += $1 + $2 + $3 + $4;} END { printf "%.5f\n", sum } ')
if awk "BEGIN { exit !($PERCENT > $THRESHOLD) }"; then
echo $i
else
>&2 echo Color-sum is $PERCENT: will remove blank page $i of $IN
fi
done
}
NON_BLANK=$(non_blank)
if [ -n "$NON_BLANK" ]; then
NON_BLANK=$(echo $NON_BLANK | tr ' ' ",")
qpdf "$IN" --replace-input --pages . $NON_BLANK --
fi
{{- end }}