mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-01-11 02:11:01 +01:00
replace current version
This commit is contained in:
@@ -5,7 +5,7 @@ echo "Starting..."
|
||||
# Starting scripts #
|
||||
####################
|
||||
|
||||
for SCRIPTS in /scripts/*; do
|
||||
for SCRIPTS in /etc/cont-init.d/*; do
|
||||
[ -e "$SCRIPTS" ] || continue
|
||||
echo "$SCRIPTS: executing"
|
||||
chown "$(id -u)":"$(id -g)" "$SCRIPTS"
|
||||
|
||||
@@ -1,5 +1,22 @@
|
||||
#!/bin/bash
|
||||
#!/bin/bash
|
||||
# If dockerfile failed install manually
|
||||
if [ -e "/MODULESFILE" ]; then
|
||||
echo "Executing modules script"
|
||||
PACKAGES=$(</MODULESFILE)
|
||||
(
|
||||
##############################
|
||||
# Automatic modules download #
|
||||
##############################
|
||||
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
|
||||
) >/dev/null
|
||||
|
||||
fi
|
||||
|
||||
if [ -e "/ENVFILE" ]; then
|
||||
echo "Executing script"
|
||||
PACKAGES=$(</ENVFILE)
|
||||
|
||||
@@ -13,7 +13,7 @@ if [ ! ${#APP_KEY} = 32 ]; then bashio::exit.nok "Your APP_KEY has ${#APP_KEY} i
|
||||
|
||||
# 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"
|
||||
bashio::log.warning "Changing this value will require to reset your database"
|
||||
APP_KEY="$(bashio::config 'APP_KEY')"
|
||||
|
||||
# Get current app_key
|
||||
@@ -23,7 +23,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,6 +38,7 @@ 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
|
||||
rm -r /var/www/html/storage/database
|
||||
@@ -53,9 +54,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
|
||||
@@ -76,9 +77,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,8 +95,23 @@ mariadb_addon)
|
||||
esac
|
||||
|
||||
# Install database
|
||||
php artisan migrate --seed
|
||||
php artisan firefly-iii:upgrade-database
|
||||
bashio::log.info "Updating database"
|
||||
php artisan migrate --seed >/dev/null
|
||||
php artisan firefly-iii:upgrade-database >/dev/null
|
||||
|
||||
################
|
||||
# CRON OPTIONS #
|
||||
################
|
||||
|
||||
# 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 775 /etc/cron.${FREQUENCY}/cronupdate
|
||||
|
||||
##############
|
||||
# LAUNCH APP #
|
||||
|
||||
3
fireflyiii/rootfs/templates/cronupdate
Normal file
3
fireflyiii/rootfs/templates/cronupdate
Normal file
@@ -0,0 +1,3 @@
|
||||
#!/bin/bash
|
||||
|
||||
/usr/local/bin/php /var/www/html/artisan firefly:cron
|
||||
Reference in New Issue
Block a user