mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-03-13 16:34:22 +01:00
rename
This commit is contained in:
34
webtrees/rootfs/scripts/00-aaa_dockerfile_backup.sh
Normal file
34
webtrees/rootfs/scripts/00-aaa_dockerfile_backup.sh
Normal file
@@ -0,0 +1,34 @@
|
||||
#!/bin/bash
|
||||
# If dockerfile failed install manually
|
||||
if [ ! -f "/usr/bin/bashio" ]; then
|
||||
echo "Bashio does not exist, executing script"
|
||||
(
|
||||
################
|
||||
# Install apps #
|
||||
################
|
||||
apt-get clean &&
|
||||
apt-get update &&
|
||||
apt-get install -y \
|
||||
jq \
|
||||
curl &&
|
||||
apt-get clean
|
||||
|
||||
################
|
||||
# Modify image #
|
||||
################
|
||||
# Change data location
|
||||
grep -rl "/var/www/webtrees" /etc/ | xargs sed -i 's|/var/www/webtrees|/data/webtrees|g'
|
||||
|
||||
###################
|
||||
# Install bashio #
|
||||
##################
|
||||
BASHIO_VERSION=0.13.1
|
||||
mkdir -p /tmp/bashio
|
||||
curl -L -f -s "https://github.com/hassio-addons/bashio/archive/v${BASHIO_VERSION}.tar.gz" |
|
||||
tar -xzf - --strip 1 -C /tmp/bashio
|
||||
mv /tmp/bashio/lib /usr/lib/bashio
|
||||
ln -s /usr/lib/bashio/bashio /usr/bin/bashio
|
||||
rm -rf /tmp/bashio
|
||||
) >/dev/null
|
||||
|
||||
fi
|
||||
39
webtrees/rootfs/scripts/00-banner.sh
Normal file
39
webtrees/rootfs/scripts/00-banner.sh
Normal file
@@ -0,0 +1,39 @@
|
||||
#!/usr/bin/with-contenv bashio
|
||||
# ==============================================================================
|
||||
# Displays a simple add-on banner on startup
|
||||
# ==============================================================================
|
||||
|
||||
if bashio::supervisor.ping; then
|
||||
bashio::log.blue \
|
||||
'-----------------------------------------------------------'
|
||||
bashio::log.blue " Add-on: $(bashio::addon.name)"
|
||||
bashio::log.blue " $(bashio::addon.description)"
|
||||
bashio::log.blue \
|
||||
'-----------------------------------------------------------'
|
||||
|
||||
bashio::log.blue " Add-on version: $(bashio::addon.version)"
|
||||
if bashio::var.true "$(bashio::addon.update_available)"; then
|
||||
bashio::log.magenta ' There is an update available for this add-on!'
|
||||
bashio::log.magenta \
|
||||
" Latest add-on version: $(bashio::addon.version_latest)"
|
||||
bashio::log.magenta ' Please consider upgrading as soon as possible.'
|
||||
else
|
||||
bashio::log.green ' You are running the latest version of this add-on.'
|
||||
fi
|
||||
|
||||
bashio::log.blue " System: $(bashio::info.operating_system)" \
|
||||
" ($(bashio::info.arch) / $(bashio::info.machine))"
|
||||
bashio::log.blue " Home Assistant Core: $(bashio::info.homeassistant)"
|
||||
bashio::log.blue " Home Assistant Supervisor: $(bashio::info.supervisor)"
|
||||
|
||||
bashio::log.blue \
|
||||
'-----------------------------------------------------------'
|
||||
bashio::log.blue \
|
||||
' Please, share the above information when looking for help'
|
||||
bashio::log.blue \
|
||||
' or support in, e.g., GitHub, forums'
|
||||
bashio::log.green \
|
||||
' https://github.com/alexbelgium/hassio-addons'
|
||||
bashio::log.blue \
|
||||
'-----------------------------------------------------------'
|
||||
fi
|
||||
89
webtrees/rootfs/scripts/99-run.sh
Normal file
89
webtrees/rootfs/scripts/99-run.sh
Normal file
@@ -0,0 +1,89 @@
|
||||
#!/usr/bin/env bashio
|
||||
|
||||
####################
|
||||
# GLOBAL VARIABLES #
|
||||
####################
|
||||
|
||||
export BASE_URL=$(bashio::config 'BASE_URL'):$(bashio::addon.port 80)
|
||||
#export LANG=$(bashio::config 'LANG')
|
||||
export DB_TYPE=$(bashio::config 'DB_TYPE')
|
||||
[ $DB_TYPE = "sqlite" ] && bashio::log.info "Using a local sqlite database $WEBTREES_HOME/$DB_NAME please wait then login. Default credentials : $WT_USER : $WT_PASS"
|
||||
|
||||
################
|
||||
# SSL CONFIG #
|
||||
################
|
||||
|
||||
bashio::config.require.ssl
|
||||
if bashio::config.true 'ssl'; then
|
||||
|
||||
#set variables
|
||||
CERTFILE=$(bashio::config 'certfile')
|
||||
KEYFILE=$(bashio::config 'keyfile')
|
||||
|
||||
#Replace variables
|
||||
sed -i "s|/certs/webtrees.crt|/ssl/$CERTFILE|g" /etc/apache2/sites-available/default-ssl.conf
|
||||
sed -i "s|/certs/webtrees.key|/ssl/$KEYFILE|g" /etc/apache2/sites-available/default-ssl.conf
|
||||
sed -i "s|/certs/webtrees.crt|/ssl/$CERTFILE|g" /etc/apache2/sites-available/webtrees-ssl.conf
|
||||
sed -i "s|/certs/webtrees.key|/ssl/$KEYFILE|g" /etc/apache2/sites-available/webtrees-ssl.conf
|
||||
|
||||
#Send env variables
|
||||
export HTTPS=true
|
||||
export SSL=true
|
||||
BASE_URL=$BASE_URL:$(bashio::addon.port 443)
|
||||
export BASE_URL="${BASE_URL/http:/https:}"
|
||||
|
||||
#Communication
|
||||
bashio::log.info "Ssl enabled. If webui don't work, disable ssl or check your certificate paths"
|
||||
fi
|
||||
|
||||
##############
|
||||
# LAUNCH APP #
|
||||
##############
|
||||
|
||||
bashio::log.info "Launching app, please wait"
|
||||
|
||||
# Change data location
|
||||
echo "... update data with image"
|
||||
OLD_WEBTREES_HOME=$WEBTREES_HOME
|
||||
export WEBTREES_HOME="/share/webtrees"
|
||||
cp -rn /var/www/webtrees "$(dirname "$OLD_WEBTREES_HOME")" &>/dev/null || true
|
||||
mkdir -p $WEBTREES_HOME
|
||||
|
||||
echo "... update permissions"
|
||||
chown -R www-data:www-data $OLD_WEBTREES_HOME
|
||||
chown -R www-data:www-data $WEBTREES_HOME
|
||||
|
||||
# Make links with share
|
||||
echo "... make links with data in /share"
|
||||
for VOL in "data" "media" "modules_v4"; do
|
||||
mkdir -p $OLD_WEBTREES_HOME/$VOL
|
||||
cp -rn $OLD_WEBTREES_HOME/$VOL $WEBTREES_HOME || true
|
||||
rm -r $OLD_WEBTREES_HOME/$VOL || true
|
||||
ln -s $WEBTREES_HOME/$VOL $OLD_WEBTREES_HOME || true
|
||||
done
|
||||
chown -R www-data:www-data $WEBTREES_HOME
|
||||
|
||||
# Correct base url if needed
|
||||
echo "... align base url with latest addon value"
|
||||
if [ -f $WEBTREES_HOME/data/config.ini.php ]; then
|
||||
echo "Aligning base_url addon config"
|
||||
LINE=$(sed -n '/base_url/=' $WEBTREES_HOME/data/config.ini.php)
|
||||
sed -i "$LINE a base_url=\"$BASE_URL\"" $WEBTREES_HOME/data/config.ini.php
|
||||
sed -i "$LINE d" $WEBTREES_HOME/data/config.ini.php
|
||||
fi || true
|
||||
|
||||
# Execute main script
|
||||
echo "/docker-entrypoint.sh"
|
||||
cd /
|
||||
./docker-entrypoint.sh
|
||||
|
||||
############
|
||||
# END INFO #
|
||||
############
|
||||
|
||||
DB_NAME=$(echo $DB_NAME | tr -d '"')
|
||||
|
||||
bashio::log.info "Data is stored in $WEBTREES_HOME"
|
||||
bashio::log.info "Webui can be accessed at : $BASE_URL"
|
||||
|
||||
exec apache2-foreground
|
||||
Reference in New Issue
Block a user