mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-01-11 02:11:01 +01:00
Deprecated nobuild
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
#!/usr/bin/with-contenv bashio
|
||||
# shellcheck shell=bash
|
||||
set -e
|
||||
|
||||
# ==============================================================================
|
||||
# Displays a simple add-on banner on startup
|
||||
# ==============================================================================
|
||||
|
||||
echo ""
|
||||
bashio::log.yellow "####################"
|
||||
bashio::log.yellow "# ADDON deprecated #"
|
||||
bashio::log.yellow "####################"
|
||||
echo ""
|
||||
|
||||
sleep 5
|
||||
15
zzz_archived_papermerge/rootfs/etc/cont-init.d/00-folders.sh
Normal file
15
zzz_archived_papermerge/rootfs/etc/cont-init.d/00-folders.sh
Normal file
@@ -0,0 +1,15 @@
|
||||
#!/usr/bin/with-contenv bashio
|
||||
# shellcheck shell=bash
|
||||
set -e
|
||||
|
||||
# Config location
|
||||
CONFIGLOCATION="$(bashio::config 'CONFIG_LOCATION')"
|
||||
|
||||
# Text
|
||||
bashio::log.info "Setting config location to $CONFIGLOCATION"
|
||||
|
||||
# Adapt files
|
||||
sed -i "s|/data/config|$CONFIGLOCATION|g" /etc/cont-init.d/*
|
||||
|
||||
# Avoid tamper issues
|
||||
chown -R root:root "$CONFIGLOCATION"/custom*
|
||||
59
zzz_archived_papermerge/rootfs/etc/cont-init.d/91-OCR.sh
Normal file
59
zzz_archived_papermerge/rootfs/etc/cont-init.d/91-OCR.sh
Normal file
@@ -0,0 +1,59 @@
|
||||
#!/usr/bin/with-contenv bashio
|
||||
# shellcheck shell=bash
|
||||
set -e
|
||||
|
||||
# Allow OCR setting
|
||||
OCRLANG="$(bashio::config "ocrlang")"
|
||||
|
||||
#Define location place
|
||||
CONFIGLOCATION="$(bashio::config "CONFIG_LOCATION")"
|
||||
#If it's a file, get the folder
|
||||
if [ ! -d "$CONFIGLOCATION" ]; then
|
||||
CONFIGLOCATION="$(dirname "$CONFIGLOCATION")"
|
||||
fi
|
||||
|
||||
#Correct previous bug
|
||||
sed -i "s|OCRLANG|OCR_LANGUAGES|g" "$CONFIGLOCATION"/papermerge.conf.py
|
||||
|
||||
languageCount=$(echo "$OCRLANG" | tr -cd ',' | wc -c)
|
||||
languageCount=$((languageCount + 1))
|
||||
bashio::log.info "Configuring ${languageCount} languages"
|
||||
|
||||
if [ -n "$OCRLANG" ]; then
|
||||
lineStart=$(sed -n '/OCR_LANGUAGES/=' "$CONFIGLOCATION"/papermerge.conf.py)
|
||||
bashio::log.info "OCRLANG variable is set, processing the language packages"
|
||||
lineEnd=$(sed -n '/}/=' "$CONFIGLOCATION"/papermerge.conf.py)
|
||||
sed -i "${lineStart},${lineEnd}d" "$CONFIGLOCATION"/papermerge.conf.py || true
|
||||
|
||||
bashio::log.info "Writing new configuration"
|
||||
echo "OCR_LANGUAGES = {" >>"$CONFIGLOCATION"/papermerge.conf.py
|
||||
|
||||
languages=$(echo "$OCRLANG" | tr "," "\n")
|
||||
|
||||
apt-get update >/dev/null
|
||||
|
||||
i=0
|
||||
for language in $languages; do
|
||||
bashio::log.info "Processing language ${language}"
|
||||
if apt-cache show tesseract-ocr-"${language}" >/dev/null 2>&1; then
|
||||
bashio::log.info "Installing tesseract-ocr-${language}"
|
||||
apt-get install -yqq tesseract-ocr-"${language}" >/dev/null
|
||||
languageFullName=$(apt-cache show tesseract-ocr-"${language}" | grep -E '^(Description|Description-en):' | grep -oE '[^ ]+$')
|
||||
bashio::log.info "${language} identified as ${languageFullName}"
|
||||
i=$((i + 1))
|
||||
if [[ $i -eq $languageCount ]]; then
|
||||
echo " \"$language\" : \"$languageFullName\"" >>"$CONFIGLOCATION"/papermerge.conf.py
|
||||
elif [[ $i -eq 1 ]]; then
|
||||
echo " \"$language\" : \"$languageFullName\"," >>"$CONFIGLOCATION"/papermerge.conf.py
|
||||
bashio::log.info "Setting default language to ${language}"
|
||||
sed -i "s/^OCR_DEFAULT_LANGUAGE = \"eng\"/OCR_DEFAULT_LANGUAGE = \"${language}\"/g" "$CONFIGLOCATION"/papermerge.conf.py
|
||||
else
|
||||
echo " \"$language\" : \"$languageFullName\"," >>"$CONFIGLOCATION"/papermerge.conf.py
|
||||
fi
|
||||
bashio::log.info "... ${language} installed"
|
||||
else
|
||||
bashio::log.info "Package tesseract-ocr-${language} not found in the repository, skipping"
|
||||
fi
|
||||
done
|
||||
echo "}" >>"$CONFIGLOCATION"/papermerge.conf.py
|
||||
fi
|
||||
@@ -0,0 +1,74 @@
|
||||
#!/usr/bin/with-contenv bashio
|
||||
# shellcheck shell=bash
|
||||
set -e
|
||||
|
||||
##################
|
||||
# SELECT FOLDERS #
|
||||
##################
|
||||
|
||||
#Set media dir
|
||||
MEDIADIR=$(bashio::config 'storage_dir')
|
||||
#clean data
|
||||
sed -i '/MEDIA_DIR/d' /data/config/papermerge.conf.py
|
||||
#add data
|
||||
sed -i "2 i\MEDIA_DIR = \"$MEDIADIR\"" /data/config/papermerge.conf.py
|
||||
bashio::log.info "Storage dir set to $MEDIADIR"
|
||||
|
||||
#Set import dir
|
||||
IMPORTDIR=$(bashio::config 'import_dir')
|
||||
#clean data
|
||||
sed -i '/IMPORTER_DIR/d' /data/config/papermerge.conf.py || true
|
||||
#add data
|
||||
sed -i "2 i\IMPORTER_DIR = \"$IMPORTDIR\"" /data/config/papermerge.conf.py
|
||||
bashio::log.info "Import dir set to $IMPORTDIR"
|
||||
|
||||
##################
|
||||
# CREATE FOLDERS #
|
||||
##################
|
||||
|
||||
#if [ ! -d /data/config ]; then
|
||||
# echo "Creating /config"
|
||||
# mkdir -p /config
|
||||
#fi
|
||||
#chown -R "$PUID:$PGID" /config
|
||||
|
||||
if [ ! -d "$MEDIADIR" ]; then
|
||||
echo "Creating $MEDIADIR"
|
||||
mkdir -p "$MEDIADIR"
|
||||
fi
|
||||
chown -R "$PUID:$PGID" "$MEDIADIR"
|
||||
|
||||
if [ ! -d "$IMPORTDIR" ]; then
|
||||
echo "Creating $IMPORTDIR"
|
||||
mkdir -p "$IMPORTDIR"
|
||||
fi
|
||||
chown -R "$PUID:$PGID" "$IMPORTDIR"
|
||||
|
||||
##################
|
||||
# CONFIGURE IMAP #
|
||||
##################
|
||||
|
||||
IMAPHOST=$(bashio::config 'imaphost')
|
||||
IMAPUSERNAME=$(bashio::config 'imapusername')
|
||||
IMAPPASSWORD=$(bashio::config 'imappassword')
|
||||
|
||||
if [ "$IMAPHOST" != "null" ]; then
|
||||
printf "\nIMPORT_MAIL_HOST = \"%s\"" "$IMAPHOST" >>/data/config/papermerge.conf.py
|
||||
bashio::log.info "IMPORT_MAIL_HOST set to $IMAPHOST"
|
||||
|
||||
if [ "$IMAPUSERNAME" != "null" ]; then
|
||||
printf "\nIMPORT_MAIL_USER = \"%s\"" "$IMAPUSERNAME" >>/data/config/papermerge.conf.py
|
||||
bashio::log.info "IMPORT_MAIL_USER set to $IMAPUSERNAME"
|
||||
else
|
||||
bashio::log.info "! IMAPHOST has been set, but no IMAPUSERNAME. Please check your configuration!"
|
||||
fi
|
||||
|
||||
if [ "$IMAPPASSWORD" != "null" ]; then
|
||||
printf "\nIMPORT_MAIL_PASS = \"%s\"" "$IMAPPASSWORD" >>/data/config/papermerge.conf.py
|
||||
IMAPPASSWORDMASKED=$(echo "$IMAPPASSWORD" | sed -r 's/./x/g')
|
||||
bashio::log.info "IMPORT_MAIL_PASS set to $IMAPPASSWORDMASKED"
|
||||
else
|
||||
bashio::log.info "! IMAPHOST has been set, but no IMAPPASSWORD. Please check your configuration!"
|
||||
fi
|
||||
|
||||
fi
|
||||
Reference in New Issue
Block a user