mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-01-10 18:01:03 +01:00
entrypoint logic
This commit is contained in:
@@ -31,16 +31,16 @@ RUN \
|
||||
########################################
|
||||
# Correct upstream image folders links #
|
||||
########################################
|
||||
&& mkdir -p -m 777 /config/filebrowser
|
||||
&& mkdir -p -m 777 /config/filebrowser || true
|
||||
|
||||
# Copy root filesystem
|
||||
COPY rootfs /
|
||||
|
||||
VOLUME [ "/data" ]
|
||||
WORKDIR /
|
||||
RUN chmod 777 /run.sh
|
||||
RUN chmod 777 /entrypoint.sh
|
||||
ENTRYPOINT [ "/usr/bin/env" ]
|
||||
CMD [ "/run.sh" ]
|
||||
CMD [ "/entrypoint.sh" ]
|
||||
|
||||
|
||||
### 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
|
||||
|
||||
###########
|
||||
# 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 #
|
||||
###################
|
||||
@@ -27,9 +27,9 @@ RUN \
|
||||
|
||||
VOLUME [ "/data" ]
|
||||
WORKDIR /
|
||||
RUN chmod 777 /run.sh
|
||||
RUN chmod 777 /entrypoint.sh
|
||||
ENTRYPOINT [ "/bin/bash" ]
|
||||
CMD [ "/run.sh" ]
|
||||
CMD [ "/entrypoint.sh" ]
|
||||
|
||||
# use /data instead of /config for hass.io environment
|
||||
# && 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
|
||||
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)"
|
||||
" 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::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'
|
||||
' Please, share the above information when looking for help'
|
||||
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 \
|
||||
' https://github.com/alexbelgium/hassio-addons'
|
||||
' https://github.com/alexbelgium/hassio-addons'
|
||||
bashio::log.blue \
|
||||
'-----------------------------------------------------------'
|
||||
'-----------------------------------------------------------'
|
||||
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
|
||||
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
|
||||
fi \
|
||||
&
|
||||
fi &
|
||||
bashio::log.info "Please wait, loading..."
|
||||
|
||||
# Wait for transmission to become available
|
||||
|
||||
@@ -8,7 +8,6 @@ COPY rootfs /
|
||||
ARG BASHIO_VERSION=0.13.1
|
||||
ENV WEBTREES_HOME="/data/webtrees"
|
||||
WORKDIR $WEBTREES_HOME
|
||||
ENTRYPOINT ["/run.sh"]
|
||||
VOLUME ["/data"]
|
||||
|
||||
RUN \
|
||||
@@ -36,14 +35,16 @@ RUN \
|
||||
# Modify image #
|
||||
################
|
||||
# Change data location
|
||||
&& grep -rl "/var/www/webtrees" /etc/ | xargs sed -i 's|/var/www/webtrees|/data/webtrees|g' \
|
||||
\
|
||||
# Add entry script
|
||||
&& chown root:root /run.sh \
|
||||
&& chmod a+x /run.sh \
|
||||
&& grep -rl "/var/www/webtrees" /etc/ | xargs sed -i 's|/var/www/webtrees|/data/webtrees|g' || true
|
||||
|
||||
# Add entry script
|
||||
RUN chown root:root /entrypoint.sh \
|
||||
&& chmod 777 /entrypoint.sh \
|
||||
# Add end script
|
||||
&& sed -i '$ d' /docker-entrypoint.sh
|
||||
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
||||
|
||||
### LABELS
|
||||
ARG BUILD_ARCH
|
||||
ARG BUILD_DATE
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#!/bin/bah
|
||||
#!/bin/bash
|
||||
|
||||
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
|
||||
|
||||
###########
|
||||
# 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 #
|
||||
####################
|
||||
@@ -28,25 +15,25 @@ export DB_TYPE=$(bashio::config 'DB_TYPE')
|
||||
|
||||
bashio::config.require.ssl
|
||||
if bashio::config.true 'ssl'; then
|
||||
|
||||
#set variables
|
||||
CERTFILE=$(bashio::config 'certfile')
|
||||
KEYFILE=$(bashio::config 'keyfile')
|
||||
|
||||
#Replace variables
|
||||
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.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
|
||||
|
||||
#Send env variables
|
||||
export HTTPS=true
|
||||
export SSL=true
|
||||
BASE_URL=$BASE_URL:$(bashio::addon.port 443)
|
||||
export BASE_URL="${BASE_URL/http:/https:}"
|
||||
|
||||
#Communication
|
||||
bashio::log.info "Ssl enabled. If webui don't work, disable ssl or check your certificate paths"
|
||||
|
||||
#set variables
|
||||
CERTFILE=$(bashio::config 'certfile')
|
||||
KEYFILE=$(bashio::config 'keyfile')
|
||||
|
||||
#Replace variables
|
||||
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.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
|
||||
|
||||
#Send env variables
|
||||
export HTTPS=true
|
||||
export SSL=true
|
||||
BASE_URL=$BASE_URL:$(bashio::addon.port 443)
|
||||
export BASE_URL="${BASE_URL/http:/https:}"
|
||||
|
||||
#Communication
|
||||
bashio::log.info "Ssl enabled. If webui don't work, disable ssl or check your certificate paths"
|
||||
fi
|
||||
|
||||
##############
|
||||
@@ -69,20 +56,20 @@ chown -R www-data:www-data $WEBTREES_HOME
|
||||
# Make links with share
|
||||
echo "... make links with data in /share"
|
||||
for VOL in "data" "media" "modules_v4"; do
|
||||
mkdir -p $OLD_WEBTREES_HOME/$VOL
|
||||
cp -rn $OLD_WEBTREES_HOME/$VOL $WEBTREES_HOME || true
|
||||
rm -r $OLD_WEBTREES_HOME/$VOL || true
|
||||
ln -s $WEBTREES_HOME/$VOL $OLD_WEBTREES_HOME || true
|
||||
mkdir -p $OLD_WEBTREES_HOME/$VOL
|
||||
cp -rn $OLD_WEBTREES_HOME/$VOL $WEBTREES_HOME || true
|
||||
rm -r $OLD_WEBTREES_HOME/$VOL || true
|
||||
ln -s $WEBTREES_HOME/$VOL $OLD_WEBTREES_HOME || true
|
||||
done
|
||||
chown -R www-data:www-data $WEBTREES_HOME
|
||||
|
||||
# Correct base url if needed
|
||||
echo "... align base url with latest addon value"
|
||||
if [ -f $WEBTREES_HOME/data/config.ini.php ]; then
|
||||
echo "Aligning base_url addon config"
|
||||
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 d" $WEBTREES_HOME/data/config.ini.php
|
||||
echo "Aligning base_url addon config"
|
||||
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 d" $WEBTREES_HOME/data/config.ini.php
|
||||
fi || true
|
||||
|
||||
# Execute main script
|
||||
Reference in New Issue
Block a user