mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-01-10 09:51:02 +01:00
initial build
This commit is contained in:
27
fireflyiii_fints_importer/rootfs/entrypoint.sh
Normal file
27
fireflyiii_fints_importer/rootfs/entrypoint.sh
Normal file
@@ -0,0 +1,27 @@
|
||||
#!/bin/bash
|
||||
echo "Starting..."
|
||||
|
||||
############################
|
||||
# Backup Dockerfile Script #
|
||||
############################
|
||||
|
||||
if [ -f /etc/cont-init.d/00-aaa_dockerfile_backup.sh ]; then
|
||||
chown "$(id -u)":"$(id -g)" /etc/cont-init.d/00-aaa_dockerfile_backup.sh
|
||||
chmod +x /etc/cont-init.d/00-aaa_dockerfile_backup.sh
|
||||
/./etc/cont-init.d/00-aaa_dockerfile_backup.sh
|
||||
rm /etc/cont-init.d/00-aaa_dockerfile_backup.sh
|
||||
fi
|
||||
|
||||
####################
|
||||
# Starting scripts #
|
||||
####################
|
||||
|
||||
for SCRIPTS in /etc/cont-init.d/*; do
|
||||
[ -e "$SCRIPTS" ] || continue
|
||||
echo "$SCRIPTS: executing"
|
||||
chown "$(id -u)":"$(id -g)" "$SCRIPTS"
|
||||
chmod a+x "$SCRIPTS"
|
||||
# Change shebang if no s6 supervision
|
||||
sed -i 's|/usr/bin/with-contenv bashio|/usr/bin/env bashio|g' "$SCRIPTS"
|
||||
/."$SCRIPTS" || echo "$SCRIPTS: exiting $?"
|
||||
done
|
||||
@@ -0,0 +1,33 @@
|
||||
#!/bin/bash
|
||||
|
||||
# If dockerfile failed install manually
|
||||
|
||||
##############################
|
||||
# Automatic modules download #
|
||||
##############################
|
||||
if [ -e "/MODULESFILE" ]; then
|
||||
MODULES=$(</MODULESFILE)
|
||||
MODULES="${MODULES:-00-banner.sh}"
|
||||
echo "Executing modules script : $MODULES"
|
||||
|
||||
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) >/dev/null; 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) >/dev/null; fi \
|
||||
&& mkdir -p /etc/cont-init.d \
|
||||
&& for scripts in $MODULES; do echo "$scripts" && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/$scripts" -o /etc/cont-init.d/"$scripts" && [ "$(sed -n '/\/bin/p;q' /etc/cont-init.d/"$scripts")" != "" ] || (echo "script failed to install $scripts" && exit 1); done \
|
||||
&& chmod -R 755 /etc/cont-init.d
|
||||
fi
|
||||
|
||||
#######################
|
||||
# Automatic installer #
|
||||
#######################
|
||||
if [ -e "/ENVFILE" ]; then
|
||||
PACKAGES=$(</ENVFILE)
|
||||
echo "Executing dependency script with custom elements : $PACKAGES"
|
||||
|
||||
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) >/dev/null; 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) >/dev/null; fi \
|
||||
&& curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/automatic_packages.sh" --output /automatic_packages.sh \
|
||||
&& chmod 777 /automatic_packages.sh \
|
||||
&& eval /./automatic_packages.sh "${PACKAGES:-}" \
|
||||
&& rm /automatic_packages.sh
|
||||
fi
|
||||
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env bashio
|
||||
# shellcheck shell=bash
|
||||
|
||||
CONFIGSOURCE=$(bashio::config "CONFIG_LOCATION")
|
||||
CONFIGSOURCE=$(dirname "$CONFIGSOURCE")
|
||||
|
||||
# Create directory
|
||||
mkdir -p "$CONFIGSOURCE" || true
|
||||
mkdir -p "$CONFIGSOURCE/import_files" || true
|
||||
mkdir -p "$CONFIGSOURCE/configurations" || true
|
||||
|
||||
# Create symlinks
|
||||
cp -n /data/configurations $CONFIGSOURCE/configurations
|
||||
rm -r /data/configurations
|
||||
ln -s $CONFIGSOURCE/configurations /data/configurations
|
||||
|
||||
# Make sure permissions are right
|
||||
chown -R "$(id -u):$(id -g)" "$CONFIGSOURCE"
|
||||
61
fireflyiii_fints_importer/rootfs/etc/cont-init.d/99-run.sh
Normal file
61
fireflyiii_fints_importer/rootfs/etc/cont-init.d/99-run.sh
Normal file
@@ -0,0 +1,61 @@
|
||||
#!/usr/bin/env bashio
|
||||
# shellcheck shell=bash
|
||||
|
||||
CONFIGSOURCE=$(bashio::config "CONFIG_LOCATION")
|
||||
CONFIGSOURCE="$(dirname "$CONFIGSOURCE")"
|
||||
|
||||
#################
|
||||
# CONFIG IMPORT #
|
||||
#################
|
||||
|
||||
if [ "$(ls -A "$CONFIGSOURCE/configurations")" ]; then
|
||||
bashio::log.info "Configurations were found in $CONFIGSOURCE/configurations, they will be loaded."
|
||||
fi
|
||||
|
||||
################
|
||||
# CRON OPTIONS #
|
||||
################
|
||||
|
||||
if bashio::config.has_value 'Updates'; then
|
||||
|
||||
if [ "$(ls -A "${CONFIGSOURCE}"/import_files)" ]; then
|
||||
# Align update with options
|
||||
echo ""
|
||||
FREQUENCY=$(bashio::config 'Updates')
|
||||
bashio::log.info "$FREQUENCY updates"
|
||||
echo ""
|
||||
|
||||
# Sets cron // do not delete this message
|
||||
cp /templates/cronupdate /etc/cron."${FREQUENCY}"/
|
||||
chmod 777 /etc/cron."${FREQUENCY}"/cronupdate
|
||||
|
||||
# Sets cron to run with www-data user
|
||||
# sed -i 's|root|www-data|g' /etc/crontab
|
||||
|
||||
# Starts cron
|
||||
service cron start
|
||||
|
||||
# Export variables
|
||||
IMPORT_DIR_WHITELIST="${CONFIGSOURCE}/import_files"
|
||||
export IMPORT_DIR_WHITELIST
|
||||
|
||||
bashio::log.info "Automatic updates were requested. The files in ${CONFIGSOURCE}/import_files will be imported $FREQUENCY."
|
||||
|
||||
else
|
||||
bashio::log.fatal "Automatic updates were requested, but there are no configuration files in ${CONFIGSOURCE}/import_files. There will therefore be be no automatic updates."
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
##############
|
||||
# LAUNCH APP #
|
||||
##############
|
||||
|
||||
bashio::log.info "Please wait while the app is loading !"
|
||||
|
||||
if bashio::config.true 'silent'; then
|
||||
bashio::log.warning "Silent mode activated. Only errors will be shown. Please disable in addon options if you need to debug"
|
||||
php -S 0.0.0.0:8080 /app/index.php >/dev/null
|
||||
else
|
||||
php -S 0.0.0.0:8080 /app/index.php
|
||||
fi
|
||||
15
fireflyiii_fints_importer/rootfs/templates/cronupdate
Normal file
15
fireflyiii_fints_importer/rootfs/templates/cronupdate
Normal file
@@ -0,0 +1,15 @@
|
||||
#!/usr/bin/env bashio
|
||||
# shellcheck shell=bash
|
||||
|
||||
PATHTOFILES="$(bashio::config "CONFIG_LOCATION")"
|
||||
PATHTOFILES="$(dirname "${PATHTOFILES}")"
|
||||
|
||||
(
|
||||
bashio::log.info "Running update according to defined schedule. Files located in $PATHTOFILES will be imported"
|
||||
if bashio::config.true 'silent'; then
|
||||
bashio::log.warning "Silent mode activated. Only errors will be shown. Please disable in addon options if you need to debug"
|
||||
su -l www-data -s /bin/bash -c "/usr/local/bin/php /var/www/html/artisan importer:auto-import >/dev/null"
|
||||
else
|
||||
su -l www-data -s /bin/bash -c "/usr/local/bin/php /var/www/html/artisan importer:auto-import $PATHTOFILES/import_files"
|
||||
fi
|
||||
) &>/proc/1/fd/1
|
||||
Reference in New Issue
Block a user