mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-05-27 02:44:05 +02:00
entrypoint logic
This commit is contained in:
@@ -31,16 +31,16 @@ RUN \
|
|||||||
########################################
|
########################################
|
||||||
# Correct upstream image folders links #
|
# Correct upstream image folders links #
|
||||||
########################################
|
########################################
|
||||||
&& mkdir -p -m 777 /config/filebrowser
|
&& mkdir -p -m 777 /config/filebrowser || true
|
||||||
|
|
||||||
# Copy root filesystem
|
# Copy root filesystem
|
||||||
COPY rootfs /
|
COPY rootfs /
|
||||||
|
|
||||||
VOLUME [ "/data" ]
|
VOLUME [ "/data" ]
|
||||||
WORKDIR /
|
WORKDIR /
|
||||||
RUN chmod 777 /run.sh
|
RUN chmod 777 /entrypoint.sh
|
||||||
ENTRYPOINT [ "/usr/bin/env" ]
|
ENTRYPOINT [ "/usr/bin/env" ]
|
||||||
CMD [ "/run.sh" ]
|
CMD [ "/entrypoint.sh" ]
|
||||||
|
|
||||||
|
|
||||||
### LABELS
|
### LABELS
|
||||||
|
|||||||
12
filebrowser/rootfs/entrypoint.sh
Normal file
12
filebrowser/rootfs/entrypoint.sh
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
cd /scripts
|
||||||
|
for SCRIPTS in *; do
|
||||||
|
[ -e "$SCRIPTS" ] || continue
|
||||||
|
echo $SCRIPTS
|
||||||
|
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 &&
|
||||||
|
true || true # Prevents script crash on failure
|
||||||
|
done
|
||||||
36
filebrowser/rootfs/scripts/00-aaa.sh
Normal file
36
filebrowser/rootfs/scripts/00-aaa.sh
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
if [ ! -f "/usr/bin/bashio" ]; then
|
||||||
|
echo "Bashio does not exist, executing script"
|
||||||
|
|
||||||
|
################
|
||||||
|
# Install apps #
|
||||||
|
################
|
||||||
|
apk add --no-cache \
|
||||||
|
curl \
|
||||||
|
jq \
|
||||||
|
bash \
|
||||||
|
cifs-utils \
|
||||||
|
keyutils \
|
||||||
|
samba \
|
||||||
|
samba-client \
|
||||||
|
bind-tools \
|
||||||
|
nginx
|
||||||
|
|
||||||
|
###################
|
||||||
|
# Install bashio #
|
||||||
|
##################
|
||||||
|
BASHIO_VERSION=0.13.1
|
||||||
|
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
|
||||||
|
|
||||||
|
########################################
|
||||||
|
# Correct upstream image folders links #
|
||||||
|
########################################
|
||||||
|
mkdir -p -m 777 /config/filebrowser || true
|
||||||
|
|
||||||
|
echo "Bashio installed"
|
||||||
|
fi
|
||||||
@@ -1,18 +1,5 @@
|
|||||||
#!/usr/bin/env bashio
|
#!/usr/bin/env bashio
|
||||||
|
|
||||||
###########
|
|
||||||
# SCRIPTS #
|
|
||||||
###########
|
|
||||||
|
|
||||||
for SCRIPTS in "/00-banner.sh" "/92-local_mounts.sh" "/92-smb_mounts.sh"; do
|
|
||||||
echo $SCRIPTS
|
|
||||||
chown $(id -u):$(id -g) $SCRIPTS
|
|
||||||
chmod a+x $SCRIPTS
|
|
||||||
sed -i 's|/usr/bin/with-contenv bashio|/usr/bin/env bashio|g' $SCRIPTS
|
|
||||||
/.$SCRIPTS &&
|
|
||||||
true # Prevents script crash on failure
|
|
||||||
done
|
|
||||||
|
|
||||||
###################
|
###################
|
||||||
# SSL CONFIG v1.0 #
|
# SSL CONFIG v1.0 #
|
||||||
###################
|
###################
|
||||||
@@ -27,9 +27,9 @@ RUN \
|
|||||||
|
|
||||||
VOLUME [ "/data" ]
|
VOLUME [ "/data" ]
|
||||||
WORKDIR /
|
WORKDIR /
|
||||||
RUN chmod 777 /run.sh
|
RUN chmod 777 /entrypoint.sh
|
||||||
ENTRYPOINT [ "/bin/bash" ]
|
ENTRYPOINT [ "/bin/bash" ]
|
||||||
CMD [ "/run.sh" ]
|
CMD [ "/entrypoint.sh" ]
|
||||||
|
|
||||||
# use /data instead of /config for hass.io environment
|
# use /data instead of /config for hass.io environment
|
||||||
# && sed -i "s|/config|/share/freqtrade|g" /etc/services.d/freqtrade/run \
|
# && sed -i "s|/config|/share/freqtrade|g" /etc/services.d/freqtrade/run \
|
||||||
|
|||||||
13
freqtrade/rootfs/entrypoint.sh
Normal file
13
freqtrade/rootfs/entrypoint.sh
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
echo "Starting"
|
||||||
|
|
||||||
|
if [ ! -f /data/config.json ]; then
|
||||||
|
echo "building userdir"
|
||||||
|
freqtrade create-userdir --userdir /data
|
||||||
|
echo "building initial config"
|
||||||
|
freqtrade new-config --config /data/config.json
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Starting app"
|
||||||
|
freqtrade trade --logfile /data/logs/freqtrade.log --db-url sqlite://///data/tradesv3.sqlite --config /data/config.json --strategy SampleStrategy
|
||||||
@@ -6,37 +6,37 @@
|
|||||||
|
|
||||||
if bashio::supervisor.ping; then
|
if bashio::supervisor.ping; then
|
||||||
bashio::log.blue \
|
bashio::log.blue \
|
||||||
'-----------------------------------------------------------'
|
'-----------------------------------------------------------'
|
||||||
bashio::log.blue " Add-on: $(bashio::addon.name)"
|
bashio::log.blue " Add-on: $(bashio::addon.name)"
|
||||||
bashio::log.blue " $(bashio::addon.description)"
|
bashio::log.blue " $(bashio::addon.description)"
|
||||||
bashio::log.blue \
|
bashio::log.blue \
|
||||||
'-----------------------------------------------------------'
|
'-----------------------------------------------------------'
|
||||||
|
|
||||||
bashio::log.blue " Add-on version: $(bashio::addon.version)"
|
bashio::log.blue " Add-on version: $(bashio::addon.version)"
|
||||||
if bashio::var.true "$(bashio::addon.update_available)"; then
|
if bashio::var.true "$(bashio::addon.update_available)"; then
|
||||||
bashio::log.magenta ' There is an update available for this add-on!'
|
bashio::log.magenta ' There is an update available for this add-on!'
|
||||||
bashio::log.magenta \
|
bashio::log.magenta \
|
||||||
" Latest add-on version: $(bashio::addon.version_latest)"
|
" Latest add-on version: $(bashio::addon.version_latest)"
|
||||||
bashio::log.magenta ' Please consider upgrading as soon as possible.'
|
bashio::log.magenta ' Please consider upgrading as soon as possible.'
|
||||||
else
|
else
|
||||||
bashio::log.green ' You are running the latest version of this add-on.'
|
bashio::log.green ' You are running the latest version of this add-on.'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
bashio::log.blue " System: $(bashio::info.operating_system)" \
|
bashio::log.blue " System: $(bashio::info.operating_system)" \
|
||||||
" ($(bashio::info.arch) / $(bashio::info.machine))"
|
" ($(bashio::info.arch) / $(bashio::info.machine))"
|
||||||
bashio::log.blue " Home Assistant Core: $(bashio::info.homeassistant)"
|
bashio::log.blue " Home Assistant Core: $(bashio::info.homeassistant)"
|
||||||
bashio::log.blue " Home Assistant Supervisor: $(bashio::info.supervisor)"
|
bashio::log.blue " Home Assistant Supervisor: $(bashio::info.supervisor)"
|
||||||
|
|
||||||
bashio::log.blue \
|
bashio::log.blue \
|
||||||
'-----------------------------------------------------------'
|
'-----------------------------------------------------------'
|
||||||
bashio::log.blue \
|
bashio::log.blue \
|
||||||
' Please, share the above information when looking for help'
|
' Please, share the above information when looking for help'
|
||||||
bashio::log.blue \
|
bashio::log.blue \
|
||||||
' or support in, e.g., GitHub, forums or the Discord chat.'
|
' or support in, e.g., GitHub, forums or the Discord chat.'
|
||||||
bashio::log.green \
|
bashio::log.green \
|
||||||
' https://github.com/alexbelgium/hassio-addons'
|
' https://github.com/alexbelgium/hassio-addons'
|
||||||
bashio::log.blue \
|
bashio::log.blue \
|
||||||
'-----------------------------------------------------------'
|
'-----------------------------------------------------------'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
################
|
################
|
||||||
@@ -129,8 +129,7 @@ if [ $VERBOSE = true ]; then
|
|||||||
nohup java -jar /joal/joal.jar --joal-conf=/data/joal --spring.main.web-environment=true --server.port="8081" --joal.ui.path.prefix=${UIPATH} --joal.ui.secret-token=$TOKEN
|
nohup java -jar /joal/joal.jar --joal-conf=/data/joal --spring.main.web-environment=true --server.port="8081" --joal.ui.path.prefix=${UIPATH} --joal.ui.secret-token=$TOKEN
|
||||||
else
|
else
|
||||||
nohup java -jar /joal/joal.jar --joal-conf=/data/joal --spring.main.web-environment=true --server.port="8081" --joal.ui.path.prefix=${UIPATH} --joal.ui.secret-token=$TOKEN >/dev/null
|
nohup java -jar /joal/joal.jar --joal-conf=/data/joal --spring.main.web-environment=true --server.port="8081" --joal.ui.path.prefix=${UIPATH} --joal.ui.secret-token=$TOKEN >/dev/null
|
||||||
fi \
|
fi &
|
||||||
&
|
|
||||||
bashio::log.info "Please wait, loading..."
|
bashio::log.info "Please wait, loading..."
|
||||||
|
|
||||||
# Wait for transmission to become available
|
# Wait for transmission to become available
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ COPY rootfs /
|
|||||||
ARG BASHIO_VERSION=0.13.1
|
ARG BASHIO_VERSION=0.13.1
|
||||||
ENV WEBTREES_HOME="/data/webtrees"
|
ENV WEBTREES_HOME="/data/webtrees"
|
||||||
WORKDIR $WEBTREES_HOME
|
WORKDIR $WEBTREES_HOME
|
||||||
ENTRYPOINT ["/run.sh"]
|
|
||||||
VOLUME ["/data"]
|
VOLUME ["/data"]
|
||||||
|
|
||||||
RUN \
|
RUN \
|
||||||
@@ -36,14 +35,16 @@ RUN \
|
|||||||
# Modify image #
|
# Modify image #
|
||||||
################
|
################
|
||||||
# Change data location
|
# Change data location
|
||||||
&& grep -rl "/var/www/webtrees" /etc/ | xargs sed -i 's|/var/www/webtrees|/data/webtrees|g' \
|
&& grep -rl "/var/www/webtrees" /etc/ | xargs sed -i 's|/var/www/webtrees|/data/webtrees|g' || true
|
||||||
\
|
|
||||||
# Add entry script
|
# Add entry script
|
||||||
&& chown root:root /run.sh \
|
RUN chown root:root /entrypoint.sh \
|
||||||
&& chmod a+x /run.sh \
|
&& chmod 777 /entrypoint.sh \
|
||||||
# Add end script
|
# Add end script
|
||||||
&& sed -i '$ d' /docker-entrypoint.sh
|
&& sed -i '$ d' /docker-entrypoint.sh
|
||||||
|
|
||||||
|
ENTRYPOINT ["/entrypoint.sh"]
|
||||||
|
|
||||||
### LABELS
|
### LABELS
|
||||||
ARG BUILD_ARCH
|
ARG BUILD_ARCH
|
||||||
ARG BUILD_DATE
|
ARG BUILD_DATE
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#!/bin/bah
|
#!/bin/bash
|
||||||
|
|
||||||
echo "Starting"
|
echo "Starting"
|
||||||
|
|
||||||
33
webtrees/rootfs/script/00-aaa.sh
Normal file
33
webtrees/rootfs/script/00-aaa.sh
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
if [ ! -f "/usr/bin/bashio" ]; then
|
||||||
|
echo "Bashio does not exist, executing script"
|
||||||
|
|
||||||
|
################
|
||||||
|
# Install apps #
|
||||||
|
################
|
||||||
|
apt-get clean &&
|
||||||
|
apt-get update &&
|
||||||
|
apt-get install -y \
|
||||||
|
jq \
|
||||||
|
curl &&
|
||||||
|
apt-get clean
|
||||||
|
|
||||||
|
################
|
||||||
|
# Modify image #
|
||||||
|
################
|
||||||
|
# Change data location
|
||||||
|
grep -rl "/var/www/webtrees" /etc/ | xargs sed -i 's|/var/www/webtrees|/data/webtrees|g'
|
||||||
|
|
||||||
|
###################
|
||||||
|
# Install bashio #
|
||||||
|
##################
|
||||||
|
BASHIO_VERSION=0.13.1
|
||||||
|
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
|
||||||
|
|
||||||
|
echo "Bashio installed"
|
||||||
|
fi
|
||||||
@@ -1,18 +1,5 @@
|
|||||||
#!/usr/bin/env bashio
|
#!/usr/bin/env bashio
|
||||||
|
|
||||||
###########
|
|
||||||
# SCRIPTS #
|
|
||||||
###########
|
|
||||||
|
|
||||||
for SCRIPTS in "/00-banner.sh"; do
|
|
||||||
echo $SCRIPTS
|
|
||||||
chown $(id -u):$(id -g) $SCRIPTS
|
|
||||||
chmod a+x $SCRIPTS
|
|
||||||
sed -i 's|/usr/bin/with-contenv bashio|/usr/bin/env bashio|g' $SCRIPTS
|
|
||||||
/.$SCRIPTS &&
|
|
||||||
true # Prevents script crash on failure
|
|
||||||
done
|
|
||||||
|
|
||||||
####################
|
####################
|
||||||
# GLOBAL VARIABLES #
|
# GLOBAL VARIABLES #
|
||||||
####################
|
####################
|
||||||
@@ -28,25 +15,25 @@ export DB_TYPE=$(bashio::config 'DB_TYPE')
|
|||||||
|
|
||||||
bashio::config.require.ssl
|
bashio::config.require.ssl
|
||||||
if bashio::config.true 'ssl'; then
|
if bashio::config.true 'ssl'; then
|
||||||
|
|
||||||
#set variables
|
#set variables
|
||||||
CERTFILE=$(bashio::config 'certfile')
|
CERTFILE=$(bashio::config 'certfile')
|
||||||
KEYFILE=$(bashio::config 'keyfile')
|
KEYFILE=$(bashio::config 'keyfile')
|
||||||
|
|
||||||
#Replace variables
|
#Replace variables
|
||||||
sed -i "s|/certs/webtrees.crt|/ssl/$CERTFILE|g" /etc/apache2/sites-available/default-ssl.conf
|
sed -i "s|/certs/webtrees.crt|/ssl/$CERTFILE|g" /etc/apache2/sites-available/default-ssl.conf
|
||||||
sed -i "s|/certs/webtrees.key|/ssl/$KEYFILE|g" /etc/apache2/sites-available/default-ssl.conf
|
sed -i "s|/certs/webtrees.key|/ssl/$KEYFILE|g" /etc/apache2/sites-available/default-ssl.conf
|
||||||
sed -i "s|/certs/webtrees.crt|/ssl/$CERTFILE|g" /etc/apache2/sites-available/webtrees-ssl.conf
|
sed -i "s|/certs/webtrees.crt|/ssl/$CERTFILE|g" /etc/apache2/sites-available/webtrees-ssl.conf
|
||||||
sed -i "s|/certs/webtrees.key|/ssl/$KEYFILE|g" /etc/apache2/sites-available/webtrees-ssl.conf
|
sed -i "s|/certs/webtrees.key|/ssl/$KEYFILE|g" /etc/apache2/sites-available/webtrees-ssl.conf
|
||||||
|
|
||||||
#Send env variables
|
#Send env variables
|
||||||
export HTTPS=true
|
export HTTPS=true
|
||||||
export SSL=true
|
export SSL=true
|
||||||
BASE_URL=$BASE_URL:$(bashio::addon.port 443)
|
BASE_URL=$BASE_URL:$(bashio::addon.port 443)
|
||||||
export BASE_URL="${BASE_URL/http:/https:}"
|
export BASE_URL="${BASE_URL/http:/https:}"
|
||||||
|
|
||||||
#Communication
|
#Communication
|
||||||
bashio::log.info "Ssl enabled. If webui don't work, disable ssl or check your certificate paths"
|
bashio::log.info "Ssl enabled. If webui don't work, disable ssl or check your certificate paths"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
##############
|
##############
|
||||||
@@ -69,20 +56,20 @@ chown -R www-data:www-data $WEBTREES_HOME
|
|||||||
# Make links with share
|
# Make links with share
|
||||||
echo "... make links with data in /share"
|
echo "... make links with data in /share"
|
||||||
for VOL in "data" "media" "modules_v4"; do
|
for VOL in "data" "media" "modules_v4"; do
|
||||||
mkdir -p $OLD_WEBTREES_HOME/$VOL
|
mkdir -p $OLD_WEBTREES_HOME/$VOL
|
||||||
cp -rn $OLD_WEBTREES_HOME/$VOL $WEBTREES_HOME || true
|
cp -rn $OLD_WEBTREES_HOME/$VOL $WEBTREES_HOME || true
|
||||||
rm -r $OLD_WEBTREES_HOME/$VOL || true
|
rm -r $OLD_WEBTREES_HOME/$VOL || true
|
||||||
ln -s $WEBTREES_HOME/$VOL $OLD_WEBTREES_HOME || true
|
ln -s $WEBTREES_HOME/$VOL $OLD_WEBTREES_HOME || true
|
||||||
done
|
done
|
||||||
chown -R www-data:www-data $WEBTREES_HOME
|
chown -R www-data:www-data $WEBTREES_HOME
|
||||||
|
|
||||||
# Correct base url if needed
|
# Correct base url if needed
|
||||||
echo "... align base url with latest addon value"
|
echo "... align base url with latest addon value"
|
||||||
if [ -f $WEBTREES_HOME/data/config.ini.php ]; then
|
if [ -f $WEBTREES_HOME/data/config.ini.php ]; then
|
||||||
echo "Aligning base_url addon config"
|
echo "Aligning base_url addon config"
|
||||||
LINE=$(sed -n '/base_url/=' $WEBTREES_HOME/data/config.ini.php)
|
LINE=$(sed -n '/base_url/=' $WEBTREES_HOME/data/config.ini.php)
|
||||||
sed -i "$LINE a base_url=\"$BASE_URL\"" $WEBTREES_HOME/data/config.ini.php
|
sed -i "$LINE a base_url=\"$BASE_URL\"" $WEBTREES_HOME/data/config.ini.php
|
||||||
sed -i "$LINE d" $WEBTREES_HOME/data/config.ini.php
|
sed -i "$LINE d" $WEBTREES_HOME/data/config.ini.php
|
||||||
fi || true
|
fi || true
|
||||||
|
|
||||||
# Execute main script
|
# Execute main script
|
||||||
Reference in New Issue
Block a user