This commit is contained in:
Alexandre
2022-01-15 22:28:07 +01:00
parent b29737890f
commit c6ac6eb921
5 changed files with 46 additions and 41 deletions

View File

@@ -34,17 +34,6 @@ FROM ${BUILD_FROM}
# Copy local files # Copy local files
COPY rootfs/ / COPY rootfs/ /
# Modules
ARG MODULES="00-banner.sh"
# Automatic modules download
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 && \
mkdir -p /tmpscripts /etc/cont-init.d && \
for scripts in $MODULES; do curl -L -f -s "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/zzz_templates/$scripts" -o /tmpscripts/"$scripts"; done && \
if [ -d /etc/cont-init.d ]; then /bin/cp -rf /tmpscripts/* /etc/cont-init.d/ && chmod -R 755 /etc/cont-init.d; fi && \
rm -rf /tmpscripts || printf '%s\n' "${MODULES:-}" > /MODULESFILE
# Manual apps # Manual apps
ENV PACKAGES="cron" ENV PACKAGES="cron"
@@ -62,7 +51,7 @@ RUN if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get
RUN chmod 777 /entrypoint.sh RUN chmod 777 /entrypoint.sh
ENTRYPOINT [ "/usr/bin/env" ] ENTRYPOINT [ "/usr/bin/env" ]
CMD [ "/entrypoint.sh" ] CMD [ "/entrypoint.sh" ]
############ ############
# 5 Labels # # 5 Labels #

View File

@@ -1,13 +1,22 @@
{ {
"apparmor": true, "apparmor": true,
"arch": ["aarch64", "amd64", "armv7", "armhf"], "arch": [
"aarch64",
"amd64",
"armv7",
"armhf"
],
"boot": "auto", "boot": "auto",
"description": "A free and open source personal finance manager", "description": "A free and open source personal finance manager",
"devices": [], "devices": [],
"environment": { "environment": {
"TRUSTED_PROXIES": "**" "TRUSTED_PROXIES": "**"
}, },
"map": ["config:rw", "share:rw", "ssl"], "map": [
"config:rw",
"share:rw",
"ssl"
],
"name": "Firefly iii", "name": "Firefly iii",
"options": { "options": {
"DB_CONNECTION": "sqlite_internal", "DB_CONNECTION": "sqlite_internal",
@@ -32,9 +41,11 @@
"Updates": "list(|hourly|daily|weekly)?" "Updates": "list(|hourly|daily|weekly)?"
}, },
"slug": "fireflyiii", "slug": "fireflyiii",
"services": ["mysql:want"], "services": [
"mysql:want"
],
"upstream": "5.6.10", "upstream": "5.6.10",
"url": "https://github.com/alexbelgium/hassio-addons", "url": "https://github.com/alexbelgium/hassio-addons",
"version": "5.6.10-3", "version": "5.6.10",
"webui": "[PROTO:ssl]://[HOST]:[PORT:8080]" "webui": "[PROTO:ssl]://[HOST]:[PORT:8080]"
} }

View File

@@ -18,7 +18,7 @@ for KEYS in "${arr[@]}"; do
if ! bashio::config.false "verbose"; then bashio::log.blue "$line"; fi if ! bashio::config.false "verbose"; then bashio::log.blue "$line"; fi
export $line export $line
# Export the variable to run scripts # Export the variable to run scripts
line="${KEYS}=${VALUE//[\"\']/}" line="${KEYS}=${VALUE//[\"\']/} &>/dev/null"
sed -i "1a export $line" /etc/services.d/*/*run* 2>/dev/null || true sed -i "1a export $line" /etc/services.d/*/*run* 2>/dev/null || true
sed -i "1a export $line" /etc/cont-init.d/*run* 2>/dev/null || true sed -i "1a export $line" /etc/cont-init.d/*run* 2>/dev/null || true
done done

View File

@@ -84,7 +84,8 @@ while IFS= read -r line; do
export $line export $line
# Export the variable # Export the variable
sed -i "1a export $line" /etc/services.d/*/*run* 2>/dev/null || true sed -i "1a export $line" /etc/services.d/*/*run* 2>/dev/null || true
sed -i "1a export $line" /etc/services.d/*run* 2>/dev/null || true sed -i "1a export $line" /scripts/*run* 2>/dev/null || true
sed -i "1a export $line" /etc/cont-init.d/*run* 2>/dev/null || true
# Show in log # Show in log
if ! bashio::config.false "verbose"; then bashio::log.blue "$line"; fi if ! bashio::config.false "verbose"; then bashio::log.blue "$line"; fi
else else

View File

@@ -4,17 +4,15 @@
# Init # # Init #
######## ########
# Change data location # APP_KEY
echo "Update data location" APP_KEY="$(bashio::config 'APP_KEY')"
mkdir -p /data/fireflyiii
# Check APP_KEY format # Check APP_KEY format
if [ ! ${#APP_KEY} = 32 ]; then bashio::exit.nok "Your APP_KEY has ${#APP_KEY} instead of 32 characters"; fi if [ ! ${#APP_KEY} = 32 ]; then bashio::exit.nok "Your APP_KEY has ${#APP_KEY} instead of 32 characters"; fi
# Backup APP_KEY file # Backup APP_KEY file
bashio::log.info "Backuping APP_KEY to /config/addons_config/fireflyiii/APP_KEY_BACKUP.txt" bashio::log.info "Backuping APP_KEY to /config/addons_config/fireflyiii/APP_KEY_BACKUP.txt"
bashio::log.warning "Changing this value will require to reset your database" bashio::log.warning "Changing this value will require to reset your database"
APP_KEY="$(bashio::config 'APP_KEY')"
# Get current app_key # Get current app_key
mkdir -p /config/addons_config/fireflyiii mkdir -p /config/addons_config/fireflyiii
@@ -23,7 +21,7 @@ CURRENT=$(sed -e '/^[<blank><tab>]*$/d' /config/addons_config/fireflyiii/APP_KEY
# Save if new # Save if new
if [ "$CURRENT" != "$APP_KEY" ]; then if [ "$CURRENT" != "$APP_KEY" ]; then
echo "$APP_KEY" >>/config/addons_config/fireflyiii/APP_KEY_BACKUP.txt echo "$APP_KEY" >>/config/addons_config/fireflyiii/APP_KEY_BACKUP.txt
fi fi
################### ###################
@@ -38,15 +36,21 @@ sqlite_internal)
bashio::log.info "Using built in sqlite" bashio::log.info "Using built in sqlite"
# Set variable # Set variable
export DB_CONNECTION=sqlite export DB_CONNECTION=sqlite
#export DB_DATABASE=/config/addons_config/fireflyiii/database/database.sqlite
# Creating database # Creating database
mkdir -p /config/addons_config/fireflyiii/database mkdir -p /config/addons_config/fireflyiii/database
touch /config/addons_config/fireflyiii/database/database.sqlite
chown -R www-data:www-data /config/addons_config/fireflyiii/database
chmod 775 /config/addons_config/fireflyiii/database/database.sqlite
# Creating symlink
rm -r /var/www/html/storage/database rm -r /var/www/html/storage/database
ln -snf /config/addons_config/fireflyiii/database /var/www/html/storage ln -s /config/addons_config/fireflyiii/database /var/www/html/storage/database
chown -R www-data:www-data /config/addons_config/fireflyiii # chown -R www-data:www-data /config/addons_config/fireflyiii
chown -R www-data:www-data /var/www/html/storage # chown -R www-data:www-data /var/www/html/storage/database
chmod -R 777 /var/www/html/storage/database
touch /var/www/html/storage/database/database.sqlite # mkdir -p /config/addons_config/fireflyiii/database
# touch /var/www/html/storage/database/database.sqlite
# touch /config/addons_config/fireflyiii/database/database.sqlite
;; ;;
# Use MariaDB # Use MariaDB
@@ -54,9 +58,9 @@ mariadb_addon)
bashio::log.info "Using MariaDB addon. Requirements : running MariaDB addon. Detecting values..." bashio::log.info "Using MariaDB addon. Requirements : running MariaDB addon. Detecting values..."
if ! bashio::services.available 'mysql'; then if ! bashio::services.available 'mysql'; then
bashio::log.fatal \ bashio::log.fatal \
"Local database access should be provided by the MariaDB addon" "Local database access should be provided by the MariaDB addon"
bashio::exit.nok \ bashio::exit.nok \
"Please ensure it is installed and started" "Please ensure it is installed and started"
fi fi
# Use values # Use values
@@ -77,9 +81,9 @@ mariadb_addon)
apt-get clean apt-get clean
bashio::log.info "Creating database for Firefly-iii if required" bashio::log.info "Creating database for Firefly-iii if required"
mysql \ mysql \
-u "${DB_USERNAME}" -p"${DB_PASSWORD}" \ -u "${DB_USERNAME}" -p"${DB_PASSWORD}" \
-h "${DB_HOST}" -P "${DB_PORT}" \ -h "${DB_HOST}" -P "${DB_PORT}" \
-e "CREATE DATABASE IF NOT EXISTS \`firefly\` ;" -e "CREATE DATABASE IF NOT EXISTS \`firefly\` ;"
;; ;;
# Use remote # Use remote
@@ -94,6 +98,12 @@ mariadb_addon)
esac esac
# Install database
echo "updating database"
php artisan migrate:refresh --seed --quiet
php artisan firefly-iii:upgrade-database --quiet
php artisan passport:install --quiet
################ ################
# CRON OPTIONS # # CRON OPTIONS #
################ ################
@@ -114,12 +124,6 @@ fi
# LAUNCH APP # # LAUNCH APP #
############## ##############
# Install database
bashio::log.info "Updating database"
php artisan migrate --seed --quiet
php artisan firefly-iii:upgrade-database --quiet
php artisan passport:install --quiet
bashio::log.info "Please wait while the app is loading !" bashio::log.info "Please wait while the app is loading !"
/./usr/local/bin/entrypoint.sh /./usr/local/bin/entrypoint.sh