Files
hassio-addons/free_games_claimer/rootfs/etc/cont-init.d/99-run.sh
2023-05-25 14:20:40 +02:00

46 lines
1.2 KiB
Bash
Executable File

#!/usr/bin/env bashio
# shellcheck shell=bash
##############
# Initialize #
##############
# Delete file if existing
if [ -f /data/config.env ]; then
rm /data/config.env
fi
# Use new config file
HOME="$(bashio::config "CONFIG_LOCATION")"
HOME="$(dirname "$HOME")"
if [ ! -f "$HOME"/config.env ]; then
# Copy default config.env
cp /templates/config.env "$HOME"/config.env
chmod 777 "$HOME"/config.env
bashio::log.warning "A default config.env file was copied in $HOME. Please customize according to https://github.com/vogler/free-games-claimer/tree/main#configuration--options and restart the add-on"
else
bashio::log.warning "The config.env file found in $HOME will be used. Please customize according to https://github.com/vogler/free-games-claimer/tree/main#configuration--options and restart the add-on"
fi
cp "$HOME"/config.env /data/
# Permissions
chmod -R 777 "$HOME"
##############
# Launch App #
##############
cd /data || true
CMD_ARGUMENTS="$(bashio::config "CMD_ARGUMENTS")"
echo " "
bashio::log.info "Starting the app with arguments $CMD_ARGUMENTS"
echo " "
sed -i '$d' docker-entrypoint.sh
./docker-entrypoint.sh
# shellcheck disable=SC2086
$CMD_ARGUMENTS