bundles/scansnap: introduce, add to home.nas

This commit is contained in:
Franzi 2021-04-21 17:58:16 +02:00
parent 5e49e3204b
commit b5fb5dd6c2
Signed by: kunsi
GPG key ID: 12E3D2136B818350
5 changed files with 120 additions and 2 deletions

View file

@ -0,0 +1,16 @@
#!/bin/bash
set -euo pipefail
DATE=$(date +%F_%H-%M-%S)
OUTFILE="/tmp/${DATE}"
scanimage --source 'ADF Duplex' --format tiff --mode Gray --resolution 300 --page-width 210 --page-height 297.3 -x 210 -y 297.3 --batch=${OUTFILE}_p%04d.tiff
convert ${OUTFILE}_*.tiff ${OUTFILE}.pdf
ocrmypdf -l deu ${OUTFILE}.pdf ${OUTFILE}.OCR.pdf
rm -f ${OUTFILE}_*.tiff
rm -f ${OUTFILE}.pdf
mv "${OUTFILE}.OCR.pdf" "/srv/scansnap/${DATE}.pdf"

View file

@ -0,0 +1,52 @@
global {
debug = true
debug-level = 2
user = saned
group = scanner
saned = "/usr/sbin/saned"
saned_opt = {}
saned_env = { "SANE_CONFIG_DIR=/etc/scanbd" }
scriptdir = /etc/scanbd/scripts
timeout = 500
pidfile = "/var/run/scanbd.pid"
environment {
device = "SCANBD_DEVICE"
action = "SCANBD_ACTION"
}
function function_knob {
filter = "^message.*"
desc = "The value of the function knob / wheel / selector"
env = "SCANBD_FUNCTION"
}
function function_mode {
filter = "^mode.*"
desc = "Color mode"
env = "SCANBD_FUNCTION_MODE"
}
multiple_actions = false
action scan {
filter = "^scan.*"
numerical-trigger {
from-value = 1
to-value = 0
}
desc = "Scan to file"
script = "scan.sh"
}
}
include(scanner.d/avision.conf)
include(scanner.d/fujitsu.conf)
include(scanner.d/hp.conf)
include(scanner.d/pixma.conf)
include(scanner.d/snapscan.conf)
include(scanner.d/canon.conf)
include(scanner.d/plustek.conf)

25
bundles/scansnap/items.py Normal file
View file

@ -0,0 +1,25 @@
directories = {
'/etc/scanbd/scripts': {
'purge': True,
},
}
files = {
'/etc/scanbd/scanbd.conf': {
'triggers': {
'svc_systemd:scanbd:restart',
},
},
'/etc/scanbd/scripts/scan.sh': {
'mode': '0755',
},
}
svc_systemd = {
'scanbd': {
'needs': {
'file:/etc/scanbd/scanbd.conf',
'pkg_apt:scanbd',
},
},
}

View file

@ -0,0 +1,16 @@
defaults = {
'apt': {
'packages': {
'sane-utils': {},
'scanbd': {},
'imagemagick': {},
'ocrmypdf': {},
'tesseract-ocr-deu': {},
},
},
'backups': {
'paths': {
'/src/scansnap',
},
},
}

View file

@ -7,6 +7,7 @@ nodes['home.nas'] = {
'mosquitto',
'netdata',
'nfs-server',
'scansnap',
'smartd',
'vmhost',
'zfs',
@ -111,11 +112,16 @@ nodes['home.nas'] = {
},
'nfs-server': {
'shares': {
'/storage/download': {
'172.19.138.27/32(rw,all_squash,anonuid=65534,anongid=1012,no_subtree_check)',
},
'/storage/nas': {
'172.19.138.0/24(ro,all_squash,anonuid=65534,anongid=65534,no_subtree_check)',
},
'/storage/download': {
'172.19.138.27/32(rw,all_squash,anonuid=65534,anongid=1012,no_subtree_check)',
'/srv/scansnap': {
# uid 121 -> saned
# gid 120 -> scanner
'172.19.138.0/24(rw,all_squash,anonuid=121,anongid=120,no_subtree_check)',
},
},
},
@ -198,6 +204,9 @@ nodes['home.nas'] = {
'storage/nas': {
'mountpoint': '/storage/nas',
},
'storage/scan': {
'mountpoint': '/srv/scansnap',
},
},
'snapshots': {
'retain_per_dataset': {