mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-07-05 13:38:47 +02:00
New logic
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
- New standardized logic for Dockerfile build and packages installation
|
||||
- OCR repaired
|
||||
- Improve SMB mount code to v1.5 ; accepts several network disks separated by commas (//123.12.12.12/share,//123.12.12.12/hello) that are mount to /mnt/$sharename
|
||||
|
||||
|
||||
@@ -1,37 +1,14 @@
|
||||
#################
|
||||
# 1 Build Image #
|
||||
#################
|
||||
|
||||
ARG BUILD_FROM
|
||||
ARG BUILD_VERSION
|
||||
|
||||
FROM ${BUILD_FROM}
|
||||
|
||||
# Add bashio
|
||||
ENV BASHIO_VERSION=0.14.3
|
||||
ENV PACKAGES="jq \
|
||||
curl \
|
||||
cifs-utils \
|
||||
keyutils \
|
||||
samba \
|
||||
smbclient"
|
||||
|
||||
RUN \
|
||||
################
|
||||
# Install apps #
|
||||
################
|
||||
apt-get clean \
|
||||
&& apt-get update \
|
||||
&& apt-get install -y --no-install-recommends ${PACKAGES} \
|
||||
\
|
||||
##################
|
||||
# Install bashio #
|
||||
##################
|
||||
&& mkdir -p /tmp/bashio \
|
||||
&& curl -L -f -s "https://github.com/hassio-addons/bashio/archive/v${BASHIO_VERSION}.tar.gz" \
|
||||
| tar -xzf - --strip 1 -C /tmp/bashio \
|
||||
&& mv /tmp/bashio/lib /usr/lib/bashio \
|
||||
&& ln -s /usr/lib/bashio/bashio /usr/bin/bashio \
|
||||
&& rm -rf /tmp/bashio || true
|
||||
|
||||
# Copy root filesystem
|
||||
COPY rootfs /
|
||||
##################
|
||||
# 2 Modify Image #
|
||||
##################
|
||||
|
||||
RUN \
|
||||
# Allow UID and GID setting
|
||||
@@ -42,9 +19,43 @@ RUN \
|
||||
&& sed -i "s| /config| /data/config|g" /etc/cont-init.d/* \
|
||||
&& sed -i "s| /config| /data/config|g" /defaults/* || true
|
||||
|
||||
VOLUME [ "/data" ]
|
||||
##################
|
||||
# 3 Install apps #
|
||||
##################
|
||||
|
||||
# Add rootfs
|
||||
COPY rootfs/ /
|
||||
|
||||
# Manual apps
|
||||
ENV PACKAGES="jq \
|
||||
curl \
|
||||
cifs-utils \
|
||||
keyutils \
|
||||
samba \
|
||||
smbclient"
|
||||
|
||||
# Automatic apps & bashio
|
||||
RUN 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); 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); fi && \
|
||||
curl -L -f -s "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/zzz_templates/automatic_packages.sh" --output /automatic_packages.sh && \
|
||||
chmod 777 /automatic_packages.sh && \
|
||||
/automatic_packages.sh "${PACKAGES:-}" && \
|
||||
rm /automatic_packages.sh || printf '%s\n' "${PACKAGES:-}" > /ENVFILE
|
||||
|
||||
################
|
||||
# 4 Entrypoint #
|
||||
################
|
||||
|
||||
#RUN chmod 777 /entrypoint.sh
|
||||
#WORKDIR /
|
||||
#ENTRYPOINT [ "/usr/bin/env" ]
|
||||
#CMD [ "/entrypoint.sh" ]
|
||||
#SHELL ["/bin/bash", "-o", "pipefail", "-c"]
|
||||
|
||||
############
|
||||
# 5 Labels #
|
||||
############
|
||||
|
||||
### LABELS
|
||||
ARG BUILD_ARCH
|
||||
ARG BUILD_DATE
|
||||
ARG BUILD_DESCRIPTION
|
||||
|
||||
@@ -1,29 +1,18 @@
|
||||
#!/bin/bash
|
||||
# If dockerfile failed install manually
|
||||
if [ ! -f "/usr/bin/bashio" ]; then
|
||||
echo "Bashio does not exist, executing script"
|
||||
if [ -e "/ENVFILE" ]; then
|
||||
echo "Executing script"
|
||||
PACKAGES=$(</ENVFILE)
|
||||
(
|
||||
################
|
||||
# Install apps #
|
||||
################
|
||||
PACKAGES="${PACKAGES:="curl"}"
|
||||
|
||||
apt-get clean \
|
||||
&& apt-get update \
|
||||
&& apt-get install -y --no-install-recommends ${PACKAGES} 2>/dev/null \
|
||||
|| apk add --no-cache ${PACKAGES}
|
||||
|
||||
###################
|
||||
# Install bashio #
|
||||
##################
|
||||
|
||||
mkdir -p /tmp/bashio
|
||||
curl -L -f -s "https://github.com/hassio-addons/bashio/archive/v${BASHIO_VERSION}.tar.gz" |
|
||||
tar -xzf - --strip 1 -C /tmp/bashio
|
||||
mv /tmp/bashio/lib /usr/lib/bashio
|
||||
ln -s /usr/lib/bashio/bashio /usr/bin/bashio
|
||||
rm -rf /tmp/bashio
|
||||
|
||||
#######################
|
||||
# Automatic installer #
|
||||
#######################
|
||||
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); 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); fi &&
|
||||
curl -L -f -s "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/zzz_templates/automatic_packages.sh" --output /automatic_packages.sh &&
|
||||
chmod 777 /automatic_packages.sh &&
|
||||
eval /./automatic_packages.sh "$PACKAGES" &&
|
||||
rm /automatic_packages.sh
|
||||
) >/dev/null
|
||||
|
||||
fi
|
||||
|
||||
@@ -4,17 +4,17 @@
|
||||
OCRLANG="$(bashio::config "ocrlang")"
|
||||
|
||||
if [ -n "$OCRLANG" ]; then
|
||||
LINE=$(sed -n '/OCR_LANGUAGES/=' /data/config/papermerge.conf.py)
|
||||
LINE=$(sed -n '/OCR_LANGUAGES/=' /data/config/papermerge.conf.py)
|
||||
bashio::log.info "OCRLANG variable is set, processing the language packages"
|
||||
apt-get update >/dev/null
|
||||
for i in $(echo "$OCRLANG" | tr "," " "); do
|
||||
if apt-cache show tesseract-ocr-"${i}" > /dev/null 2>&1; then
|
||||
if apt-cache show tesseract-ocr-"${i}" >/dev/null 2>&1; then
|
||||
echo "installing tesseract-ocr-${i}" >/dev/null
|
||||
apt-get install -y tesseract-ocr-"${i}" >/dev/null
|
||||
apt-get install -yqq tesseract-ocr-"${i}" >/dev/null
|
||||
else
|
||||
echo "package tesseract-ocr-${i} not found in the repository, skipping"
|
||||
fi
|
||||
sed -i "$LINE a \"${i}\": \"${i}\"," /data/config/papermerge.conf.py
|
||||
bashio::log.info "... ${i} installed"
|
||||
sed -i "$LINE a \"${i}\": \"${i}\"," /data/config/papermerge.conf.py
|
||||
bashio::log.info "... ${i} installed"
|
||||
done
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user