diff --git a/free_games_claimer/Dockerfile b/free_games_claimer/Dockerfile index b3681cc99..997f184da 100644 --- a/free_games_claimer/Dockerfile +++ b/free_games_claimer/Dockerfile @@ -69,11 +69,11 @@ RUN if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get # 4 Entrypoint # ################ -#RUN chmod 777 /entrypoint.sh +RUN chmod 777 /entrypoint.sh WORKDIR /data -#ENTRYPOINT [ "/usr/bin/env" ] -#CMD [ "/entrypoint.sh" ] -#SHELL ["/bin/bash", "-o", "pipefail", "-c"] +ENTRYPOINT [ "/usr/bin/env" ] +CMD [ "/entrypoint.sh" ] +SHELL ["/bin/bash", "-o", "pipefail", "-c"] ############ # 5 Labels # diff --git a/free_games_claimer/README.md b/free_games_claimer/README.md index d13e62454..8b7375563 100644 --- a/free_games_claimer/README.md +++ b/free_games_claimer/README.md @@ -33,7 +33,7 @@ This addon is based on the docker image https://github.com/vogler/free-games-cla Webui can be found at . -There are no addon options. All configuration files in yaml format (config and cookies) must be manually added in /config/addons_config/free_games_claimer/ according to the documentation here for config files (https://github.com/vogler/free-games-claimer#configuration--options) +There are no addon options. All configuration must be manually added in /config/addons_config/free_games_claimer/config.env according to the documentation here for config files (https://github.com/vogler/free-games-claimer#configuration--options) If this file doesn't exist, it will be created at first boot. diff --git a/free_games_claimer/config.json b/free_games_claimer/config.json index dd5c27eb2..17eaa90c8 100644 --- a/free_games_claimer/config.json +++ b/free_games_claimer/config.json @@ -54,7 +54,8 @@ "/dev/nvme2" ], "options": { - "CONFIG_LOCATION": "/config/addons_config/free_games_claimer/config.yaml" + "CMD_ARGUMENTS": "node epic-games; node prime-gaming; node gog", + "CONFIG_LOCATION": "/config/addons_config/free_games_claimer/config.env" }, "image": "ghcr.io/alexbelgium/free_games_claimer-{arch}", "init": false, @@ -71,10 +72,11 @@ "6080/tcp": "NOVNC port" }, "schema": { + "CMD_ARGUMENTS": "str", "CONFIG_LOCATION": "str" }, "slug": "free_games_claimer", "url": "https://github.com/alexbelgium/hassio-addons", - "version": "1.4", + "version": "1.4-test", "webui": "[PROTO:ssl]://[HOST]:[PORT:6080]" -} +} \ No newline at end of file diff --git a/free_games_claimer/rootfs/etc/cont-init.d/99-run.sh b/free_games_claimer/rootfs/etc/cont-init.d/99-run.sh index 644b0b329..8d34cca24 100755 --- a/free_games_claimer/rootfs/etc/cont-init.d/99-run.sh +++ b/free_games_claimer/rootfs/etc/cont-init.d/99-run.sh @@ -5,18 +5,25 @@ # Initialize # ############## +# Delete file if existing +if [ -f /data/data/config.env ]; then + rm /data/data/config.env +fi + +# Use new config file HOME="$(bashio::config "CONFIG_LOCATION")" HOME="$(dirname "$HOME")" -if [ ! -f "$HOME"/config.yaml ]; then - # Copy default config.yaml - cp /templates/config.yaml "$HOME"/config.yaml - chmod 777 "$HOME"/config.yaml - bashio::log.warning "A default config.yaml 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" +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" sleep 5 bashio::exit.nok else - bashio::log.warning "The config.yaml 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" + 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/data/ # Permissions chmod -R 777 "$HOME" @@ -27,6 +34,11 @@ chmod -R 777 "$HOME" cd /data || true +CMD_ARGUMENTS="$(bashio::config "CMD_ARGUMENTS")" + echo " " -bashio::log.info "Starting the app" +bashio::log.info "Starting the app with arguments $CMD_ARGUMENTS" echo " " + +# shellcheck disable=SC2086 +$CMD_ARGUMENTS || {node epic-games; node prime-gaming; node gog;} diff --git a/free_games_claimer/rootfs/templates/config.env b/free_games_claimer/rootfs/templates/config.env new file mode 100644 index 000000000..25beecd41 --- /dev/null +++ b/free_games_claimer/rootfs/templates/config.env @@ -0,0 +1,3 @@ +SHOW=1 +WIDTH=1280 +HEIGHT=1280 \ No newline at end of file diff --git a/free_games_claimer/rootfs/templates/config.yaml b/free_games_claimer/rootfs/templates/config.yaml deleted file mode 100644 index 29125e26f..000000000 --- a/free_games_claimer/rootfs/templates/config.yaml +++ /dev/null @@ -1,3 +0,0 @@ -SHOW: 1 -WIDTH: 1280 -HEIGHT: 1280 \ No newline at end of file