mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-05-30 04:14:04 +02:00
New logic
This commit is contained in:
@@ -1,39 +1,44 @@
|
||||
#################
|
||||
# 1 Build Image #
|
||||
#################
|
||||
|
||||
FROM troglobit/inadyn:latest
|
||||
|
||||
# Base system
|
||||
ENV BASHIO_VERSION=0.14.3
|
||||
ARG BUILD_ARCH
|
||||
##################
|
||||
# 2 Modify Image #
|
||||
##################
|
||||
|
||||
ARG BUILD_ARCH
|
||||
ENV LANG='C.UTF-8'\
|
||||
TERM='xterm-256color'\
|
||||
GOPATH='/opt/go'
|
||||
|
||||
##################
|
||||
# 3 Install apps #
|
||||
##################
|
||||
|
||||
# Add rootfs
|
||||
COPY rootfs/ /
|
||||
|
||||
# Manual apps
|
||||
ENV PACKAGES="curl \
|
||||
jq \
|
||||
bash \
|
||||
xz build-base libressl-dev ca-certificates npm"
|
||||
build-base libressl-dev ca-certificates npm"
|
||||
|
||||
RUN \
|
||||
################
|
||||
# Install apps #
|
||||
################
|
||||
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 \
|
||||
\
|
||||
####################
|
||||
# Install mustache #
|
||||
####################
|
||||
&& apk add --no-cache \
|
||||
# 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
|
||||
|
||||
# Install mustache
|
||||
RUN apk add --no-cache \
|
||||
go \
|
||||
npm \
|
||||
xz \
|
||||
# && npm install mustache-cli --global
|
||||
&& apk upgrade --no-cache &&\
|
||||
apk add --no-cache --virtual .build-deps\
|
||||
@@ -43,19 +48,22 @@ RUN \
|
||||
go get -u github.com/quantumew/mustache-cli &&\
|
||||
cp $GOPATH/bin/* /usr/bin/ && \
|
||||
rm -rf $GOPATH /var/cache/apk/* /tmp/src &&\
|
||||
apk del .build-deps xz build-base
|
||||
apk del .build-deps xz build-base || true
|
||||
|
||||
# Copy root filesystem
|
||||
COPY rootfs /
|
||||
################
|
||||
# 4 Entrypoint #
|
||||
################
|
||||
|
||||
WORKDIR /
|
||||
RUN chmod 777 /run.sh
|
||||
RUN chmod 777 /entrypoint.sh
|
||||
ENTRYPOINT [ "/usr/bin/env" ]
|
||||
CMD [ "/run.sh" ]
|
||||
|
||||
CMD [ "/entrypoint.sh" ]
|
||||
VOLUME [ "/data" ]
|
||||
|
||||
### LABELS
|
||||
############
|
||||
# 5 Labels #
|
||||
############
|
||||
|
||||
ARG BUILD_ARCH
|
||||
ARG BUILD_DATE
|
||||
ARG BUILD_DESCRIPTION
|
||||
|
||||
17
inadyn/rootfs/entrypoint.sh
Normal file
17
inadyn/rootfs/entrypoint.sh
Normal file
@@ -0,0 +1,17 @@
|
||||
#!/bin/bash
|
||||
|
||||
echo "Starting..."
|
||||
|
||||
####################
|
||||
# Starting scripts #
|
||||
####################
|
||||
|
||||
cd /
|
||||
for SCRIPTS in scripts/*; do
|
||||
[ -e "$SCRIPTS" ] || continue
|
||||
echo "$SCRIPTS: executing"
|
||||
chown $(id -u):$(id -g) $SCRIPTS
|
||||
chmod a+x $SCRIPTS
|
||||
sed -i 's|/usr/bin/with-contenv bashio|/usr/bin/env bashio|g' $SCRIPTS || true
|
||||
./$SCRIPTS || echo "$SCRIPTS: exiting $?"
|
||||
done
|
||||
18
inadyn/rootfs/scripts/00-aaa_dockerfile_backup.sh
Normal file
18
inadyn/rootfs/scripts/00-aaa_dockerfile_backup.sh
Normal file
@@ -0,0 +1,18 @@
|
||||
#!/bin/bash
|
||||
# If dockerfile failed install manually
|
||||
if [ -e "/ENVFILE" ]; then
|
||||
echo "Executing script"
|
||||
PACKAGES=$(</ENVFILE)
|
||||
(
|
||||
#######################
|
||||
# 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
|
||||
39
inadyn/rootfs/scripts/00-banner.sh
Normal file
39
inadyn/rootfs/scripts/00-banner.sh
Normal file
@@ -0,0 +1,39 @@
|
||||
#!/usr/bin/with-contenv bashio
|
||||
# ==============================================================================
|
||||
# Displays a simple add-on banner on startup
|
||||
# ==============================================================================
|
||||
|
||||
if bashio::supervisor.ping; then
|
||||
bashio::log.blue \
|
||||
'-----------------------------------------------------------'
|
||||
bashio::log.blue " Add-on: $(bashio::addon.name)"
|
||||
bashio::log.blue " $(bashio::addon.description)"
|
||||
bashio::log.blue \
|
||||
'-----------------------------------------------------------'
|
||||
|
||||
bashio::log.blue " Add-on version: $(bashio::addon.version)"
|
||||
if bashio::var.true "$(bashio::addon.update_available)"; then
|
||||
bashio::log.magenta ' There is an update available for this add-on!'
|
||||
bashio::log.magenta \
|
||||
" Latest add-on version: $(bashio::addon.version_latest)"
|
||||
bashio::log.magenta ' Please consider upgrading as soon as possible.'
|
||||
else
|
||||
bashio::log.green ' You are running the latest version of this add-on.'
|
||||
fi
|
||||
|
||||
bashio::log.blue " System: $(bashio::info.operating_system)" \
|
||||
" ($(bashio::info.arch) / $(bashio::info.machine))"
|
||||
bashio::log.blue " Home Assistant Core: $(bashio::info.homeassistant)"
|
||||
bashio::log.blue " Home Assistant Supervisor: $(bashio::info.supervisor)"
|
||||
|
||||
bashio::log.blue \
|
||||
'-----------------------------------------------------------'
|
||||
bashio::log.blue \
|
||||
' Please, share the above information when looking for help'
|
||||
bashio::log.blue \
|
||||
' or support in, e.g., GitHub, forums'
|
||||
bashio::log.green \
|
||||
' https://github.com/alexbelgium/hassio-addons'
|
||||
bashio::log.blue \
|
||||
'-----------------------------------------------------------'
|
||||
fi
|
||||
11
inadyn/rootfs/scripts/99-run.sh
Normal file
11
inadyn/rootfs/scripts/99-run.sh
Normal file
@@ -0,0 +1,11 @@
|
||||
#!/usr/bin/env bashio
|
||||
|
||||
#################
|
||||
# Create config #
|
||||
#################
|
||||
mustache-cli /data/options.json /templates/inadyn.mustache >/etc/inadyn.conf
|
||||
|
||||
##############
|
||||
# Launch App #
|
||||
##############
|
||||
/usr/sbin/inadyn --foreground
|
||||
Reference in New Issue
Block a user