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 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
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
ENTRYPOINT [ "/usr/bin/env" ]
CMD [ "/entrypoint.sh" ]
CMD [ "/entrypoint.sh" ]
############
# 5 Labels #

View File

@@ -1,13 +1,22 @@
{
"apparmor": true,
"arch": ["aarch64", "amd64", "armv7", "armhf"],
"arch": [
"aarch64",
"amd64",
"armv7",
"armhf"
],
"boot": "auto",
"description": "A free and open source personal finance manager",
"devices": [],
"environment": {
"TRUSTED_PROXIES": "**"
},
"map": ["config:rw", "share:rw", "ssl"],
"map": [
"config:rw",
"share:rw",
"ssl"
],
"name": "Firefly iii",
"options": {
"DB_CONNECTION": "sqlite_internal",
@@ -32,9 +41,11 @@
"Updates": "list(|hourly|daily|weekly)?"
},
"slug": "fireflyiii",
"services": ["mysql:want"],
"services": [
"mysql:want"
],
"upstream": "5.6.10",
"url": "https://github.com/alexbelgium/hassio-addons",
"version": "5.6.10-3",
"version": "5.6.10",
"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
export $line
# 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/cont-init.d/*run* 2>/dev/null || true
done

View File

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

View File

@@ -4,17 +4,15 @@
# Init #
########
# Change data location
echo "Update data location"
mkdir -p /data/fireflyiii
# APP_KEY
APP_KEY="$(bashio::config 'APP_KEY')"
# Check APP_KEY format
if [ ! ${#APP_KEY} = 32 ]; then bashio::exit.nok "Your APP_KEY has ${#APP_KEY} instead of 32 characters"; fi
# Backup APP_KEY file
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"
APP_KEY="$(bashio::config 'APP_KEY')"
bashio::log.warning "Changing this value will require to reset your database"
# Get current app_key
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
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
###################
@@ -38,15 +36,21 @@ sqlite_internal)
bashio::log.info "Using built in sqlite"
# Set variable
export DB_CONNECTION=sqlite
#export DB_DATABASE=/config/addons_config/fireflyiii/database/database.sqlite
# Creating 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
ln -snf /config/addons_config/fireflyiii/database /var/www/html/storage
chown -R www-data:www-data /config/addons_config/fireflyiii
chown -R www-data:www-data /var/www/html/storage
chmod -R 777 /var/www/html/storage/database
touch /var/www/html/storage/database/database.sqlite
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 /var/www/html/storage/database
# 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
@@ -54,9 +58,9 @@ mariadb_addon)
bashio::log.info "Using MariaDB addon. Requirements : running MariaDB addon. Detecting values..."
if ! bashio::services.available 'mysql'; then
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 \
"Please ensure it is installed and started"
"Please ensure it is installed and started"
fi
# Use values
@@ -77,9 +81,9 @@ mariadb_addon)
apt-get clean
bashio::log.info "Creating database for Firefly-iii if required"
mysql \
-u "${DB_USERNAME}" -p"${DB_PASSWORD}" \
-h "${DB_HOST}" -P "${DB_PORT}" \
-e "CREATE DATABASE IF NOT EXISTS \`firefly\` ;"
-u "${DB_USERNAME}" -p"${DB_PASSWORD}" \
-h "${DB_HOST}" -P "${DB_PORT}" \
-e "CREATE DATABASE IF NOT EXISTS \`firefly\` ;"
;;
# Use remote
@@ -94,6 +98,12 @@ mariadb_addon)
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 #
################
@@ -114,12 +124,6 @@ fi
# 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 !"
/./usr/local/bin/entrypoint.sh