mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-05-21 16:21:51 +02:00
new logic entrypoint
This commit is contained in:
@@ -8,15 +8,16 @@ SHELL ["/bin/bash", "-o", "pipefail", "-c"]
|
|||||||
ARG BUILD_VERSION
|
ARG BUILD_VERSION
|
||||||
ARG BUILD_UPSTREAM="2.1.27"
|
ARG BUILD_UPSTREAM="2.1.27"
|
||||||
ENV BASHIO_VERSION=0.14.3
|
ENV BASHIO_VERSION=0.14.3
|
||||||
|
ENV PACKAGES="wget \
|
||||||
|
jq \
|
||||||
|
nginx"
|
||||||
|
|
||||||
RUN \
|
RUN \
|
||||||
#Install bashio
|
#Install bashio
|
||||||
apt-get clean \
|
apt-get clean \
|
||||||
&& apt-get update \
|
&& apt-get update \
|
||||||
&& apt-get install -y --no-install-recommends \
|
&& apt-get install -y --no-install-recommends ${PACKAGES} \
|
||||||
wget \
|
\
|
||||||
jq \
|
|
||||||
nginx \
|
|
||||||
##################
|
##################
|
||||||
# Install bashio #
|
# Install bashio #
|
||||||
##################
|
##################
|
||||||
@@ -28,10 +29,11 @@ RUN \
|
|||||||
--strip 1 -C /tmp/bashio \
|
--strip 1 -C /tmp/bashio \
|
||||||
\
|
\
|
||||||
&& mv /tmp/bashio/lib /usr/lib/bashio \
|
&& mv /tmp/bashio/lib /usr/lib/bashio \
|
||||||
&& ln -s /usr/lib/bashio/bashio /usr/bin/bashio \
|
&& ln -s /usr/lib/bashio/bashio /usr/bin/bashio || true
|
||||||
\
|
|
||||||
|
RUN \
|
||||||
#Install Joal
|
#Install Joal
|
||||||
&& wget -O /tmp/joal.tar.gz "https://github.com/anthonyraymond/joal/releases/download/$BUILD_UPSTREAM/joal.tar.gz" \
|
wget -O /tmp/joal.tar.gz "https://github.com/anthonyraymond/joal/releases/download/$BUILD_UPSTREAM/joal.tar.gz" \
|
||||||
&& mkdir -p /data/joal \
|
&& mkdir -p /data/joal \
|
||||||
&& tar zxvf /tmp/joal.tar.gz -C /data/joal \
|
&& tar zxvf /tmp/joal.tar.gz -C /data/joal \
|
||||||
&& rm /data/joal/jack-of* \
|
&& rm /data/joal/jack-of* \
|
||||||
@@ -43,11 +45,12 @@ RUN \
|
|||||||
|
|
||||||
VOLUME [ "/data" ]
|
VOLUME [ "/data" ]
|
||||||
|
|
||||||
# Copy root filesystem
|
# copy local files
|
||||||
COPY rootfs /
|
COPY rootfs/ /
|
||||||
RUN chmod 777 /run.sh
|
#WORKDIR /
|
||||||
|
RUN chmod 777 /entrypoint.sh
|
||||||
ENTRYPOINT [ "/run.sh" ]
|
ENTRYPOINT [ "/usr/bin/env" ]
|
||||||
|
CMD [ "/entrypoint.sh" ]
|
||||||
|
|
||||||
### LABELS
|
### LABELS
|
||||||
ARG BUILD_ARCH
|
ARG BUILD_ARCH
|
||||||
|
|||||||
44
joal/rootfs/entrypoint.sh
Normal file
44
joal/rootfs/entrypoint.sh
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
echo "Starting..."
|
||||||
|
|
||||||
|
###################################
|
||||||
|
# Export all addon options as env #
|
||||||
|
###################################
|
||||||
|
|
||||||
|
# For all keys in options.json
|
||||||
|
JSONSOURCE="/data/options.json"
|
||||||
|
|
||||||
|
# Export keys as env variables
|
||||||
|
echo "All addon options were exported as variables"
|
||||||
|
mapfile -t arr < <(jq -r 'keys[]' ${JSONSOURCE})
|
||||||
|
for KEYS in ${arr[@]}; do
|
||||||
|
# export key
|
||||||
|
VALUE=$(jq .$KEYS ${JSONSOURCE})
|
||||||
|
export ${KEYS}=${VALUE//[\"\']/} &>/dev/null
|
||||||
|
done
|
||||||
|
|
||||||
|
################
|
||||||
|
# Set timezone #
|
||||||
|
################
|
||||||
|
if [ ! -z "TZ" ] && [ -f /etc/localtime ]; then
|
||||||
|
if [ -f /usr/share/zoneinfo/$TZ ]; then
|
||||||
|
echo "Timezone set from $(cat /etc/timezone) to $TZ"
|
||||||
|
ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ >/etc/timezone
|
||||||
|
else
|
||||||
|
echo "WARNING : Timezone $TZ is invalid, it will be kept to default value of $(cat /etc/timezone)"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
####################
|
||||||
|
# Starting scripts #
|
||||||
|
####################
|
||||||
|
|
||||||
|
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
|
||||||
29
joal/rootfs/scripts/00-aaa_dockerfile_backup.sh
Normal file
29
joal/rootfs/scripts/00-aaa_dockerfile_backup.sh
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# If dockerfile failed install manually
|
||||||
|
if [ ! -f "/usr/bin/bashio" ]; then
|
||||||
|
echo "Bashio does not exist, executing script"
|
||||||
|
(
|
||||||
|
################
|
||||||
|
# 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
|
||||||
|
|
||||||
|
) >/dev/null
|
||||||
|
|
||||||
|
fi
|
||||||
39
joal/rootfs/scripts/00-banner.sh
Normal file
39
joal/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
|
||||||
@@ -1,44 +1,5 @@
|
|||||||
#!/usr/bin/env bashio
|
#!/usr/bin/env bashio
|
||||||
|
|
||||||
##########
|
|
||||||
# BANNER #
|
|
||||||
##########
|
|
||||||
|
|
||||||
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 or the Discord chat.'
|
|
||||||
bashio::log.green \
|
|
||||||
' https://github.com/alexbelgium/hassio-addons'
|
|
||||||
bashio::log.blue \
|
|
||||||
'-----------------------------------------------------------'
|
|
||||||
fi
|
|
||||||
|
|
||||||
################
|
################
|
||||||
# JOAL SETTING #
|
# JOAL SETTING #
|
||||||
################
|
################
|
||||||
Reference in New Issue
Block a user