mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-07-13 17:40:31 +02:00
initial build
This commit is contained in:
15
tandoor_recipes/rootfs/entrypoint.sh
Normal file
15
tandoor_recipes/rootfs/entrypoint.sh
Normal file
@@ -0,0 +1,15 @@
|
||||
#!/bin/bash
|
||||
echo "Starting..."
|
||||
|
||||
####################
|
||||
# Starting scripts #
|
||||
####################
|
||||
|
||||
for SCRIPTS in /scripts/*; do
|
||||
[ -e "$SCRIPTS" ] || continue
|
||||
echo "$SCRIPTS: executing"
|
||||
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" || echo "$SCRIPTS: exiting $?"
|
||||
done
|
||||
18
tandoor_recipes/rootfs/scripts/00-aaa_dockerfile_backup.sh
Normal file
18
tandoor_recipes/rootfs/scripts/00-aaa_dockerfile_backup.sh
Normal file
@@ -0,0 +1,18 @@
|
||||
#!/bin/bash
|
||||
# If dockerfile failed install manually
|
||||
if [ -e "/ENVFILE" ]; then
|
||||
echo "Executing script"
|
||||
PACKAGES=$(</ENVFILE)
|
||||
(
|
||||
#######################
|
||||
# Automatic installer #
|
||||
#######################
|
||||
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 &&
|
||||
curl -L -f -s "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/zzz_templates/automatic_packages.sh" --output /automatic_packages.sh &&
|
||||
chmod 777 /automatic_packages.sh &&
|
||||
eval /./automatic_packages.sh "$PACKAGES" &&
|
||||
rm /automatic_packages.sh
|
||||
) >/dev/null
|
||||
|
||||
fi
|
||||
6
tandoor_recipes/rootfs/scripts/20-folders.sh
Normal file
6
tandoor_recipes/rootfs/scripts/20-folders.sh
Normal file
@@ -0,0 +1,6 @@
|
||||
#!/usr/bin/with-contenv bashio
|
||||
|
||||
cp -r /opt/recipes /data/recipes
|
||||
chmod -R 755 /data/recipes
|
||||
mkdir -p /data/recipes/media
|
||||
mkdir -p /data/recipes/static
|
||||
62
tandoor_recipes/rootfs/scripts/99-run.sh
Normal file
62
tandoor_recipes/rootfs/scripts/99-run.sh
Normal file
@@ -0,0 +1,62 @@
|
||||
#!/usr/bin/with-contenv bashio
|
||||
|
||||
#####################
|
||||
# Export env values #
|
||||
#####################
|
||||
|
||||
export ALLOWED_HOSTS=$(bashio::config 'ALLOWED_HOSTS') && bashio::log.blue "ALLOWED_HOSTS=$ALLOWED_HOSTS"
|
||||
|
||||
###################
|
||||
# Define database #
|
||||
###################
|
||||
|
||||
bashio::log.info "Defining database"
|
||||
export DB_TYPE=$(bashio::config 'DB_TYPE')
|
||||
case $(bashio::config 'DB_TYPE') in
|
||||
|
||||
# Use sqlite
|
||||
sqlite)
|
||||
bashio::log.info "Using a local sqlite database"
|
||||
export DB_ENGINE="django.db.backends.sqlite3"
|
||||
export POSTGRES_DB="/data/recipes.db"
|
||||
;;
|
||||
|
||||
mariadb_addon)
|
||||
bashio::log.info "Using MariaDB addon. Requirements : running MariaDB addon. Discovering values..."
|
||||
if ! bashio::services.available 'mysql'; then
|
||||
bashio::log.fatal \
|
||||
"Local database access should be provided by the MariaDB addon"
|
||||
bashio::exit.nok \
|
||||
"Please ensure it is installed and started"
|
||||
fi
|
||||
|
||||
# Use values
|
||||
export DB_ENGINE=django.db.backends.postgresql
|
||||
export POSTGRES_HOST=$(bashio::services "mysql" "host") && bashio::log.blue "POSTGRES_HOST=$POSTGRES_HOST"
|
||||
export POSTGRES_PORT=$(bashio::services "mysql" "port") && bashio::log.blue "POSTGRES_PORT=$POSTGRES_PORT"
|
||||
export POSTGRES_DB=/data/recipes.db && bashio::log.blue "POSTGRES_DB=$POSTGRES_DB"
|
||||
export POSTGRES_USER=$(bashio::services "mysql" "username") && bashio::log.blue "POSTGRES_USER=$POSTGRES_USER"
|
||||
export POSTGRES_PASSWORD=$(bashio::services "mysql" "password") && bashio::log.blue "POSTGRES_PASSWORD=$POSTGRES_PASSWORD"
|
||||
|
||||
bashio::log.warning "Webtrees is using the Maria DB addon"
|
||||
bashio::log.warning "Please ensure this is included in your backups"
|
||||
bashio::log.warning "Uninstalling the MariaDB addon will remove any data"
|
||||
;;
|
||||
|
||||
postgresql_external)
|
||||
bashio::log.info "Using an external database, please populate all required fields in the addons config"
|
||||
export DB_ENGINE=django.db.backends.postgresql
|
||||
export POSTGRES_HOST=$(bashio::config "POSTGRES_HOST") && bashio::log.blue "POSTGRES_HOST=$POSTGRES_HOST"
|
||||
export POSTGRES_PORT=$(bashio::config "POSTGRES_PORT") && bashio::log.blue "POSTGRES_PORT=$POSTGRES_PORT"
|
||||
export POSTGRES_DB=$(bashio::config "POSTGRES_DB") && bashio::log.blue "POSTGRES_DB=$POSTGRES_DB"
|
||||
export POSTGRES_USER=$(bashio::config "POSTGRES_USER") && bashio::log.blue "POSTGRES_USER=$POSTGRES_USER"
|
||||
export POSTGRES_PASSWORD=$(bashio::config "POSTGRES_PASSWORD") && bashio::log.blue "POSTGRES_PASSWORD=$POSTGRES_PASSWORD"
|
||||
;;
|
||||
|
||||
esac
|
||||
|
||||
##############
|
||||
# Launch app #
|
||||
##############
|
||||
|
||||
/./opt/recipes/boot.sh
|
||||
Reference in New Issue
Block a user