diff --git a/epicgamesfree/CHANGELOG.md b/epicgamesfree/CHANGELOG.md new file mode 100644 index 000000000..1a7f5e790 --- /dev/null +++ b/epicgamesfree/CHANGELOG.md @@ -0,0 +1,3 @@ +## 4.1.0 (21-07-2022) + +- Initial release diff --git a/epicgamesfree/Dockerfile b/epicgamesfree/Dockerfile new file mode 100644 index 000000000..daeec4ea3 --- /dev/null +++ b/epicgamesfree/Dockerfile @@ -0,0 +1,102 @@ +#============================# +# ALEXBELGIUM'S DOCKERFILE # +#============================# +# _.------. +# _.-` ('>.-`"""-. +# '.--'` _'` _ .--.) +# -' '-.-';` ` +# ' - _.' ``'--. +# '---` .-'""` +# /` +#=== Home Assistant Addon ===# + +################# +# 1 Build Image # +################# + +ARG BUILD_FROM +ARG BUILD_VERSION +FROM ${BUILD_FROM} + +################## +# 2 Modify Image # +################## + +# Set S6 wait time +ENV S6_CMD_WAIT_FOR_SERVICES=1 \ + S6_CMD_WAIT_FOR_SERVICES_MAXTIME=0 \ + S6_SERVICES_GRACETIME=0 + +################## +# 3 Install apps # +################## + +# Add rootfs +COPY rootfs/ / + +# Corrects permissions for s6 v3 +RUN if [ -d /etc/cont-init.d ]; then chmod -R 755 /etc/cont-init.d; fi && \ + if [ -d /etc/services.d ]; then chmod -R 755 /etc/services.d; fi && \ + if [ -f /entrypoint.sh ]; then chmod 755 /entrypoint.sh; fi + +# Modules +ARG MODULES="00-banner.sh" + +# Automatic modules download +RUN 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) >/dev/null; 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) >/dev/null; fi \ + && apt-get update && apt-get install -yqq --no-install-recommends ca-certificates || apk add --no-cache ca-certificates >/dev/null || true \ + && mkdir -p /etc/cont-init.d \ + && for scripts in $MODULES; do echo "$scripts" && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/$scripts" -o /etc/cont-init.d/"$scripts" && [ "$(sed -n '/\/bin/p;q' /etc/cont-init.d/"$scripts")" != "" ] || (echo "script failed to install $scripts" && exit 1); done \ + && chmod -R 755 /etc/cont-init.d || printf '%s\n' "${MODULES}" >/MODULESFILE + +# Manual apps +ENV PACKAGES="" + +# Automatic apps & bashio +RUN 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) >/dev/null; 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) >/dev/null; fi \ + && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/automatic_packages.sh" --output /automatic_packages.sh \ + && chmod 777 /automatic_packages.sh \ + && eval /./automatic_packages.sh "${PACKAGES:-}" \ + && rm /automatic_packages.sh + +################ +# 4 Entrypoint # +################ + +RUN chmod 777 /entrypoint.sh +#WORKDIR / +ENTRYPOINT [ "/usr/bin/env" ] +CMD [ "/entrypoint.sh" ] +#SHELL ["/bin/bash", "-o", "pipefail", "-c"] + +############ +# 5 Labels # +############ + +ARG BUILD_ARCH +ARG BUILD_DATE +ARG BUILD_DESCRIPTION +ARG BUILD_NAME +ARG BUILD_REF +ARG BUILD_REPOSITORY +ARG BUILD_VERSION +LABEL \ + io.hass.name="${BUILD_NAME}" \ + io.hass.description="${BUILD_DESCRIPTION}" \ + io.hass.arch="${BUILD_ARCH}" \ + io.hass.type="addon" \ + io.hass.version=${BUILD_VERSION} \ + maintainer="alexbelgium (https://github.com/alexbelgium)" \ + org.opencontainers.image.title="${BUILD_NAME}" \ + org.opencontainers.image.description="${BUILD_DESCRIPTION}" \ + org.opencontainers.image.vendor="Home Assistant Add-ons" \ + org.opencontainers.image.authors="alexbelgium (https://github.com/alexbelgium)" \ + org.opencontainers.image.licenses="MIT" \ + org.opencontainers.image.url="https://github.com/alexbelgium" \ + org.opencontainers.image.source="https://github.com/${BUILD_REPOSITORY}" \ + org.opencontainers.image.documentation="https://github.com/${BUILD_REPOSITORY}/blob/main/README.md" \ + org.opencontainers.image.created=${BUILD_DATE} \ + org.opencontainers.image.revision=${BUILD_REF} \ + org.opencontainers.image.version=${BUILD_VERSION} diff --git a/epicgamesfree/README.md b/epicgamesfree/README.md new file mode 100644 index 000000000..2d156e90c --- /dev/null +++ b/epicgamesfree/README.md @@ -0,0 +1,49 @@ +# Home assistant add-on: Epic Games Free + +[![Donate][donation-badge]](https://www.buymeacoffee.com/alexbelgium) + +![Version](https://img.shields.io/badge/dynamic/json?label=Version&query=%24.version&url=https%3A%2F%2Fraw.githubusercontent.com%2Falexbelgium%2Fhassio-addons%2Fmaster%2Fepicgamesfree%2Fconfig.json) +![Ingress](https://img.shields.io/badge/dynamic/json?label=Ingress&query=%24.ingress&url=https%3A%2F%2Fraw.githubusercontent.com%2Falexbelgium%2Fhassio-addons%2Fmaster%2Fepicgamesfree%2Fconfig.json) +![Arch](https://img.shields.io/badge/dynamic/json?color=success&label=Arch&query=%24.arch&url=https%3A%2F%2Fraw.githubusercontent.com%2Falexbelgium%2Fhassio-addons%2Fmaster%2Fepicgamesfree%2Fconfig.json) + +[![Codacy Badge](https://app.codacy.com/project/badge/Grade/9c6cf10bdbba45ecb202d7f579b5be0e)](https://www.codacy.com/gh/alexbelgium/hassio-addons/dashboard?utm_source=github.com&utm_medium=referral&utm_content=alexbelgium/hassio-addons&utm_campaign=Badge_Grade) +[![GitHub Super-Linter](https://github.com/alexbelgium/hassio-addons/workflows/Lint%20Code%20Base/badge.svg)](https://github.com/marketplace/actions/super-linter) +[![Builder](https://github.com/alexbelgium/hassio-addons/workflows/Builder/badge.svg)](https://github.com/alexbelgium/hassio-addons/actions/workflows/builder.yaml) + +[donation-badge]: https://img.shields.io/badge/Buy%20me%20a%20coffee-%23d32f2f?logo=buy-me-a-coffee&style=flat&logoColor=white + +_Thanks to everyone having starred my repo! To star it click on the image below, then it will be on top right. Thanks!_ + +[![Stargazers repo roster for @alexbelgium/hassio-addons](https://reporoster.com/stars/alexbelgium/hassio-addons)](https://github.com/alexbelgium/hassio-addons/stargazers) + +## About + +[Epic Games Store Weekly Free Games](https://github.com/claabs/epicgames-freegames-node) : automatically login and redeem promotional free games from the Epic Games Store. Handles multiple accounts, 2FA, captcha bypass, captcha notifications, and scheduled runs. +This addon is based on the docker image https://hub.docker.com/r/charlocharlie/epicgames-freegames + +## Configuration + +Webui can be found at . + +There are no addon options. All configuration is done through the config.json file located in /config/addons_config/epicgamesfree/config.json + +If this file doesn't exist, it will be created at first boot. + +## Installation + +The installation of this add-on is pretty straightforward and not different in comparison to installing any other add-on. + +1. Add my add-ons repository to your home assistant instance (in supervisor addons store at top right, or click button below if you have configured my HA) + [![Open your Home Assistant instance and show the add add-on repository dialog with a specific repository URL pre-filled.](https://my.home-assistant.io/badges/supervisor_add_addon_repository.svg)](https://my.home-assistant.io/redirect/supervisor_add_addon_repository/?repository_url=https%3A%2F%2Fgithub.com%2Falexbelgium%2Fhassio-addons) +1. Install this add-on. +1. Click the `Save` button to store your configuration. +1. Set the add-on options to your preferences +1. Start the add-on. +1. Check the logs of the add-on to see if everything went well. +1. Open the webUI and adapt the software options + +## Support + +Create an issue on github + +[repository]: https://github.com/alexbelgium/hassio-addons diff --git a/epicgamesfree/apparmor.txt b/epicgamesfree/apparmor.txt new file mode 100644 index 000000000..b5ee2c35c --- /dev/null +++ b/epicgamesfree/apparmor.txt @@ -0,0 +1,69 @@ +#include + +profile epicgamesfree_addon flags=(attach_disconnected,mediate_deleted) { + #include + + capability, + file, + signal, + mount, + umount, + remount, + network udp, + network tcp, + network dgram, + network stream, + network inet, + network inet6, + network netlink raw, + network unix dgram, + + capability setgid, + capability setuid, + capability sys_admin, + capability dac_read_search, + capability dac_override, + # capability sys_rawio, + +# S6-Overlay + /init ix, + /run/{s6,s6-rc*,service}/** ix, + /package/** ix, + /command/** ix, + /run/{,**} rwk, + /dev/tty rw, + /bin/** ix, + /usr/bin/** ix, + /usr/lib/bashio/** ix, + /etc/s6/** rix, + /run/s6/** rix, + /etc/services.d/** rwix, + /etc/cont-init.d/** rwix, + /etc/cont-finish.d/** rwix, + /init rix, + /var/run/** mrwkl, + /var/run/ mrwkl, + /dev/i2c-1 mrwkl, + # Files required + /dev/sda1 mrwkl, + /dev/sdb1 mrwkl, + /dev/nvme0 mrwkl, + /dev/nvme1 mrwkl, + /dev/mmcblk0p1 mrwkl, + /dev/* mrwkl, + /udev/* mrwkl, + /tmp/** mrkwl, + /dev/fuse/** mrkwl, + /dev/** mrkwl, + /sys/firmware/** mrkwl, + + # Data access + /data/** rw, + + # suppress ptrace denials when using 'docker ps' or using 'ps' inside a container + ptrace (trace,read) peer=docker-default, + + # docker daemon confinement requires explict allow rule for signal + signal (receive) set=(kill,term) peer=/usr/bin/docker, + +} diff --git a/epicgamesfree/build.json b/epicgamesfree/build.json new file mode 100644 index 000000000..a3e39fb3f --- /dev/null +++ b/epicgamesfree/build.json @@ -0,0 +1,9 @@ +{ + "build_from": { + "aarch64": "ghcr.io/claabs/epicgames-freegames-node:latest", + "amd64": "ghcr.io/claabs/epicgames-freegames-node:latest" + }, + "codenotary": { + "signer": "alexandrep.github@gmail.com" + } +} \ No newline at end of file diff --git a/epicgamesfree/config.json b/epicgamesfree/config.json new file mode 100644 index 000000000..a1384ed2d --- /dev/null +++ b/epicgamesfree/config.json @@ -0,0 +1,23 @@ +{ + "arch": [ + "aarch64", + "amd64" + ], + "codenotary": "alexandrep.github@gmail.com", + "description": "Automatically login and redeem promotional free games from the Epic Games Store", + "image": "ghcr.io/alexbelgium/epicgamesfree-{arch}", + "init": false, + "map": [ + "config:rw" + ], + "name": "Epic Games Free", + "ports": { + "3000/tcp": null + }, + "ports_description": { + "3000/tcp": "web interface" + }, + "slug": "epicgamesfree", + "url": "https://github.com/alexbelgium/hassio-addons", + "version": "4.1.0" +} \ No newline at end of file diff --git a/epicgamesfree/icon.png b/epicgamesfree/icon.png new file mode 100644 index 000000000..cf250a0dd Binary files /dev/null and b/epicgamesfree/icon.png differ diff --git a/epicgamesfree/logo.png b/epicgamesfree/logo.png new file mode 100644 index 000000000..cf250a0dd Binary files /dev/null and b/epicgamesfree/logo.png differ diff --git a/epicgamesfree/rootfs/entrypoint.sh b/epicgamesfree/rootfs/entrypoint.sh new file mode 100644 index 000000000..85d8a9212 --- /dev/null +++ b/epicgamesfree/rootfs/entrypoint.sh @@ -0,0 +1,27 @@ +#!/bin/bash +echo "Starting..." + +############################ +# Backup Dockerfile Script # +############################ + +if [ -f /etc/cont-init.d/00-aaa_dockerfile_backup.sh ]; then + chown "$(id -u)":"$(id -g)" /etc/cont-init.d/00-aaa_dockerfile_backup.sh + chmod +x /etc/cont-init.d/00-aaa_dockerfile_backup.sh + /./etc/cont-init.d/00-aaa_dockerfile_backup.sh + rm /etc/cont-init.d/00-aaa_dockerfile_backup.sh +fi + +#################### +# Starting scripts # +#################### + +for SCRIPTS in /etc/cont-init.d/*; do + [ -e "$SCRIPTS" ] || continue + echo "$SCRIPTS: executing" + chown "$(id -u)":"$(id -g)" "$SCRIPTS" + chmod a+x "$SCRIPTS" + # Change shebang if no s6 supervision + sed -i 's|/usr/bin/with-contenv bashio|/usr/bin/env bashio|g' "$SCRIPTS" + /."$SCRIPTS" || echo "$SCRIPTS: exiting $?" +done diff --git a/epicgamesfree/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh b/epicgamesfree/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh new file mode 100644 index 000000000..b983e4efc --- /dev/null +++ b/epicgamesfree/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh @@ -0,0 +1,50 @@ +#!/bin/bash + +# If dockerfile failed install manually + +############################## +# Automatic modules download # +############################## +if [ -e "/MODULESFILE" ]; then + MODULES=$(/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash) >/dev/null; 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) >/dev/null; fi \ + && apt-get update && apt-get install -yqq --no-install-recommends ca-certificates || apk add --no-cache ca-certificates >/dev/null || true \ + && mkdir -p /etc/cont-init.d \ + && for scripts in $MODULES; do echo "$scripts" && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/$scripts" -o /etc/cont-init.d/"$scripts" && [ "$(sed -n '/\/bin/p;q' /etc/cont-init.d/"$scripts")" != "" ] || (echo "script failed to install $scripts" && exit 1); done \ + && chmod -R 755 /etc/cont-init.d +fi + +####################### +# Automatic installer # +####################### +if [ -e "/ENVFILE" ]; then + PACKAGES=$(/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash) >/dev/null; 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) >/dev/null; fi \ + && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/automatic_packages.sh" --output /automatic_packages.sh \ + && chmod 777 /automatic_packages.sh \ + && eval /./automatic_packages.sh "${PACKAGES:-}" \ + && rm /automatic_packages.sh +fi + +if [ -e "/MODULESFILE" ] && [ ! -f /entrypoint.sh ]; then + for scripts in $MODULES; do + echo "$scripts : executing" + chown "$(id -u)":"$(id -g)" /etc/cont-init.d/"$scripts" + chmod a+x /etc/cont-init.d/"$scripts" + /./etc/cont-init.d/"$scripts" || echo "/etc/cont-init.d/$scripts: exiting $?" + rm /etc/cont-init.d/"$scripts" + done | tac +fi + +####################### +# Correct permissions # +####################### +[ -d /etc/services.d ] && chmod -R 777 /etc/services.d +[ -d /etc/cont-init.d ] && chmod -R 777 /etc/cont-init.d diff --git a/epicgamesfree/rootfs/etc/cont-init.d/20-folders.sh b/epicgamesfree/rootfs/etc/cont-init.d/20-folders.sh new file mode 100644 index 000000000..28d8f6849 --- /dev/null +++ b/epicgamesfree/rootfs/etc/cont-init.d/20-folders.sh @@ -0,0 +1,7 @@ +#!/usr/bin/with-contenv bashio +# shellcheck shell=bash + +# Define home +HOME="/config/addons_config/epicgamesfree" +mkdir -p $HOME +chmod -R 777 $HOME diff --git a/epicgamesfree/rootfs/etc/cont-init.d/99-run.sh b/epicgamesfree/rootfs/etc/cont-init.d/99-run.sh new file mode 100644 index 000000000..d26135e71 --- /dev/null +++ b/epicgamesfree/rootfs/etc/cont-init.d/99-run.sh @@ -0,0 +1,30 @@ +#!/usr/bin/env bashio +# shellcheck shell=bash + +############## +# Initialize # +############## + +# Copy default config.json +HOME="/config/addons_config/epicgamesfree" +if [ ! -f "$HOME"/config.json ]; then + cp /templates/config.json "$HOME"/config.json + chmod 777 "$HOME"/config.json + bashio::log.warning "A default config.json file was copied in $HOME. Please customize according to https://github.com/claabs/epicgames-freegames-node#json-configuration before restarting the addon" + bashio::exit.nok +fi + +# Make symlink + +if [ -f /usr/app/config/config.json ]; then rm /usr/app/config/config.json; fi +ln -s "$HOME"/config.json /usr/app/config/config.json + +############## +# Launch App # +############## + +echo " " +bashio::log.info "Starting the app" +echo " " + +/./usr/local/bin/docker-entrypoint.sh diff --git a/epicgamesfree/rootfs/templates/config.json b/epicgamesfree/rootfs/templates/config.json new file mode 100644 index 000000000..44b03621e --- /dev/null +++ b/epicgamesfree/rootfs/templates/config.json @@ -0,0 +1,63 @@ +{ + "runOnStartup": true, + "cronSchedule": "5 16 * * *", + "logLevel": "info", + "webPortalConfig": { + "baseUrl": "https://epic.exmaple.com", + }, + "accounts": [ + { + "email": "example@gmail.com", + "password": "abc1234", + "totp": "EMNCF83ULU3K3PXPJBSWY3DPEHPK3PXPJWY3DPEHPK3YI69R39NE" + }, + ], + "notifiers": [ + // You may configure as many of any notifier as needed + // Here are some examples of each type + { + "type": "email", + "smtpHost": "smtp.gmail.com", + "smtpPort": 587, + "emailSenderAddress": "hello@gmail.com", + "emailSenderName": "Epic Games Captchas", + "emailRecipientAddress": "hello@gmail.com", + "secure": false, + "auth": { + "user": "hello@gmail.com", + "pass": "abc123", + }, + }, + { + "type": "discord", + "webhookUrl": "https://discord.com/api/webhooks/123456789123456789/A-abcdefghijklmn-abcdefghijklmnopqrst12345678-abcdefghijklmnop123456", + // Optional list of users or roles to mention + "mentionedUsers": [ + "914360712086843432" + ], + "mentionedRoles": [ + "734548250895319070" + ], + }, + { + "type": "telegram", + "token": "644739147:AAGMPo-Jz3mKRnHRTnrPEDi7jUF1vqNOD5k", + "chatId": "-987654321", + }, + { + "type": "apprise", + "apiUrl": "http://192.168.1.2:8000", + "urls": "mailto://user:pass@gmail.com", + }, + { + "type": "pushover", + "token": "a172fyyl9gw99p2xi16tq8hnib48p2", + "userKey": "uvgidym7l5ggpwu2r8i1oy6diaapll", + }, + { + "type": "gotify", + "apiUrl": "https://gotify.net", + "token": "SnL-wAvmfo_QT", + }, + ], +} \ No newline at end of file diff --git a/epicgamesfree/updater.json b/epicgamesfree/updater.json new file mode 100644 index 000000000..794cb2b7d --- /dev/null +++ b/epicgamesfree/updater.json @@ -0,0 +1,9 @@ +{ + "github_fulltag": "false", + "last_update": "19-07-2022", + "repository": "alexbelgium/hassio-addons", + "slug": "epicgamesfree", + "source": "github", + "upstream_repo": "claabs/epicgames-freegames-node", + "upstream_version": "4.1.0" +} \ No newline at end of file