mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-05-27 19:04:05 +02:00
Switch to paperless NGX
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
#!/bin/bash
|
||||
|
||||
# If dockerfile failed install manually
|
||||
|
||||
##############################
|
||||
# Automatic modules download #
|
||||
##############################
|
||||
if [ -e "/MODULESFILE" ]; then
|
||||
MODULES=$(</MODULESFILE)
|
||||
MODULES="${MODULES:-00-banner.sh}"
|
||||
echo "Executing modules script : $MODULES"
|
||||
|
||||
if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash) >/dev/null; fi \
|
||||
&& if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \
|
||||
&& mkdir -p /etc/cont-init.d \
|
||||
&& for scripts in $MODULES; do echo "$scripts" && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/$scripts" -o /etc/cont-init.d/"$scripts" && [ "$(sed -n '/\/bin/p;q' /etc/cont-init.d/"$scripts")" != "" ] || (echo "script failed to install $scripts" && exit 1); done \
|
||||
&& chmod -R 755 /etc/cont-init.d
|
||||
fi
|
||||
|
||||
#######################
|
||||
# Automatic installer #
|
||||
#######################
|
||||
if [ -e "/ENVFILE" ]; then
|
||||
PACKAGES=$(</ENVFILE)
|
||||
echo "Executing dependency script with custom elements : $PACKAGES"
|
||||
|
||||
if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash) >/dev/null; fi \
|
||||
&& if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \
|
||||
&& curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/automatic_packages.sh" --output /automatic_packages.sh \
|
||||
&& chmod 777 /automatic_packages.sh \
|
||||
&& eval /./automatic_packages.sh "${PACKAGES:-}" \
|
||||
&& rm /automatic_packages.sh
|
||||
fi
|
||||
19
paperless_ngx/rootfs/etc/cont-init.d/20-folders.sh
Normal file
19
paperless_ngx/rootfs/etc/cont-init.d/20-folders.sh
Normal file
@@ -0,0 +1,19 @@
|
||||
#!/usr/bin/with-contenv bashio
|
||||
# shellcheck shell=bash
|
||||
|
||||
slug=paperless
|
||||
|
||||
if [ ! -d /config/addons_config/$slug ]; then
|
||||
|
||||
if [ -d /config/$slug ]; then
|
||||
echo "Moving to new location /config/addons_config/$slug"
|
||||
mkdir -p /config/addons_config/$slug
|
||||
chmod 777 /config/addons_config/$slug
|
||||
mv /config/$slug/* /config/addons_config/$slug/
|
||||
rm -r /config/$slug
|
||||
fi
|
||||
|
||||
echo "Creating /config/addons_config/$slug"
|
||||
mkdir -p /config/addons_config/$slug
|
||||
chmod 777 /config/addons_config/$slug
|
||||
fi
|
||||
14
paperless_ngx/rootfs/etc/cont-init.d/91-pikepdf.sh
Normal file
14
paperless_ngx/rootfs/etc/cont-init.d/91-pikepdf.sh
Normal file
@@ -0,0 +1,14 @@
|
||||
#!/usr/bin/with-contenv bashio
|
||||
# shellcheck shell=bash
|
||||
|
||||
echo "Installing pikepdf..."
|
||||
(
|
||||
export DEBIAN_FRONTEND="noninteractive"
|
||||
export TERM="xterm-256color"
|
||||
apt-get update
|
||||
apt-get install -yq libxml2-dev libxslt-dev python-dev
|
||||
apt-get install -yq libjpeg-dev zlib1g-dev
|
||||
apt-get install -yq python3-dev build-essential
|
||||
pip install pikepdf --force-reinstall
|
||||
) >/dev/null
|
||||
echo "... success!"
|
||||
16
paperless_ngx/rootfs/etc/cont-init.d/93-multiocr.sh
Normal file
16
paperless_ngx/rootfs/etc/cont-init.d/93-multiocr.sh
Normal file
@@ -0,0 +1,16 @@
|
||||
#!/usr/bin/with-contenv bashio
|
||||
# shellcheck shell=bash
|
||||
|
||||
OCRLANG=$(bashio::config 'OCRLANG')
|
||||
if [ -n "$OCRLANG" ]; then
|
||||
apt-get update &>/dev/null
|
||||
echo "OCRLANG variable is set, processing the language packages"
|
||||
for i in ${OCRLANG//,/ }; do
|
||||
if apt-cache show tesseract-ocr-"${i}" >/dev/null 2>&1; then
|
||||
apt-get install -yq tesseract-ocr-"${i}"
|
||||
bashio::log.info "OCR Language installed : $i" || bashio::log.fatal "Couldn't install OCR lang $i. Please check its format is conform"
|
||||
else
|
||||
echo "package tesseract-ocr-${i} not found in the repository, skipping"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
12
paperless_ngx/rootfs/templates/config.yaml
Normal file
12
paperless_ngx/rootfs/templates/config.yaml
Normal file
@@ -0,0 +1,12 @@
|
||||
#============================#
|
||||
# ALEXBELGIUM'S ENV INJECTOR #
|
||||
#============================#
|
||||
#
|
||||
# All env variables set in this file will be enabled in the app
|
||||
# This allows enabling more options that normally available in the addon options
|
||||
# This file must be filled according to the yaml format. If the format is invalid, the addon will note an error. To validate your yaml, you can use the free online tool http://www.yamllint.com/
|
||||
|
||||
# EXAMPLE of the format (you need to remove the # for it to become active)
|
||||
# TZ: Europe/Paris
|
||||
PAPERLESS_OCR_LANGUAGE: eng
|
||||
PAPERLESS_OCR_MODE: skip
|
||||
Reference in New Issue
Block a user