feat(paperless-ngx): initial chart
This commit is contained in:
16 files changed
+499
No files matched your search
@@ -0,0 +1,53 @@
|
||||
{{- 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 }}
|
||||
Reference in new issue
Block a user