mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-01-16 01:18:19 +01:00
19 lines
859 B
Plaintext
19 lines
859 B
Plaintext
#!/usr/bin/with-contenv bashio
|
|
|
|
# Install OCR if requested
|
|
if bashio::config.has_value 'OCR'; then
|
|
if $(bashio::config 'OCR') = true; then
|
|
echo "Installing OCR"
|
|
apk add --quiet --no-cache tesseract-ocr || apk add --quiet --no-cache tesseract-ocr@community
|
|
# Install additional language if requested
|
|
if bashio::config.has_value 'OCRLANG'; then
|
|
LANG=$(bashio::config 'OCRLANG')
|
|
apk add --quiet --no-cache tesseract-ocr-data-$LANG || apk add --quiet --no-cache tesseract-ocr-data-$LANG@community \
|
|
&& bashio::log.info "OCR Language installed : $LANG" || bashio::log.fatal "Couldn't install OCR lang $LANG. Please check its format is conform"
|
|
fi
|
|
elif $(bashio::config 'OCR') = false; then
|
|
bashio::log.info 'Removing OCR'
|
|
apk del tesseract-ocr.* || true
|
|
fi
|
|
fi
|