diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 098acc0..c701e27 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -25,4 +25,4 @@ } }, "mounts": [ "type=volume,target=/var/lib/docker" ] -} \ No newline at end of file +} diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index 4988caa..51e55b7 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -1,2 +1,2 @@ --- -custom: https://buymeacoffee.com/mesteriisw +custom: https://www.buymeacoffee.com/alexbelgium diff --git a/.github/linters/.gitleaks.toml b/.github/linters/.gitleaks.toml index 97ce9a2..609662a 100644 --- a/.github/linters/.gitleaks.toml +++ b/.github/linters/.gitleaks.toml @@ -7,4 +7,4 @@ useDefault = false [allowlist] description = "global allowlist. whitelisting paths" -#paths = ['''/github/workspace/epicgamesfree/templates/config.json'''] +paths = ['''/github/workspace/epicgamesfree/templates/config.json'''] diff --git a/.github/paths-filter.yml b/.github/paths-filter.yml index 3f97f81..311aab5 100644 --- a/.github/paths-filter.yml +++ b/.github/paths-filter.yml @@ -1,4 +1,118 @@ # AUTO BUILDS # # From https://github.com/Poeschl/Hassio-Addons # name: slug/filename ; could be slug/config.* for all files +addons_updater: addons_updater/config.* # Image : yes +arpspoof: arpspoof/config.* # Image : yes +autobrr: autobrr/config.* # Image : yes +baikal: baikal/config.* # Image : yes +battybirdnet-pi: battybirdnet-pi/config.* # Image : yes +bazarr: bazarr/config.* # Image : yes +binance-trading-bot: binance-trading-bot/config.* # Image : yes +birdnet-go: birdnet-go/config.* # Image : yes +birdnet-pi: birdnet-pi/config.* # Image : yes +bitwarden: bitwarden/config.* # Image : yes +booksonic_air: booksonic_air/config.* # Image : yes +browserless_chrome: browserless_chrome/config.* # Image : yes +calibre: calibre/config.* # Image : yes +calibre_web: calibre_web/config.* # Image : yes +changedetection.io: changedetection.io/config.* # Image : yes +cloudcommander: cloudcommander/config.* # Image : yes +code-server: code-server/config.* # Image : yes +codex: codex/config.* # Image : yes +comixed: comixed/config.* # Image : yes +elasticsearch: elasticsearch/config.* # Image : yes +emby: emby/config.* # Image : yes +enedisgateway2mqtt: enedisgateway2mqtt/config.* # Image : yes +enedisgateway2mqtt_dev: enedisgateway2mqtt_dev/config.* # Image : yes +epicgamesfree: epicgamesfree/config.* # Image : yes +filebrowser: filebrowser/config.* # Image : yes +fireflyiii: fireflyiii/config.* # Image : yes +fireflyiii_data_importer: fireflyiii_data_importer/config.* # Image : yes +fireflyiii_fints_importer: fireflyiii_fints_importer/config.* # Image : yes +flaresolverr: flaresolverr/config.* # Image : yes +flexget: flexget/config.* # Image : yes +free_games_claimer: free_games_claimer/config.* # Image : yes +gazpar2mqtt: gazpar2mqtt/config.* # Image : yes gitea: gitea/config.* # Image : yes +grampsweb: grampsweb/config.* # Image : yes +grav: grav/config.* # Image : yes +guacamole: guacamole/config.* # Image : yes +immich: immich/config.* # Image : yes +immich_cuda: immich_cuda/config.* # Image : yes +immich_openvino: immich_openvino/config.* # Image : yes +immich_power_tools: immich_power_tools/config.* # Image : yes +inadyn: inadyn/config.* # Image : yes +jackett: jackett/config.* # Image : yes +jellyfin: jellyfin/config.* # Image : yes +jellyseerr: jellyseerr/config.* # Image : yes +joal: joal/config.* # Image : yes +joplin: joplin/config.* # Image : yes +kometa: kometa/config.* # Image : yes +lidarr: lidarr/config.* # Image : yes +linkwarden: linkwarden/config.* # Image : yes +mealie: mealie/config.* # Image : yes +mealie_api: mealie_api/config.* # Image : yes +mealie_frontend: mealie_frontend/config.* # IImage : yes # Image : yes +monica: monica/config.* # Image : yes +myelectricaldata: myelectricaldata/config.* # Image : yes +myelectricaldata_dev: myelectricaldata_dev/config.* # Image : yes +mylar3: mylar3/config.* # Image : yes +navidrome: navidrome/config.* # Image : yes +netalertx: netalertx/config.* # Image : yes +nextcloud: nextcloud/config.* # Image : yes +nzbget: nzbget/config.* # Image : yes +omada: omada/config.* # Image : yes +omada_v3: omada_v3/config.* # Image : yes +ombi: ombi/config.* # Image : yes +openproject: openproject/config.* # Image : yes +organizr: organizr/config.* # Image : yes +overleaf: overleaf/config.* # Image : yes +overseerr: overseerr/config.* # Image : yes +paperless_ngx: paperless_ngx/config.* # Image : yes +papermerge: papermerge/config.* # Image : yes +photoprism: photoprism/config.* # Image : yes +piwigo: piwigo/config.* # Image : yes +plex: plex/config.* # Image : yes +portainer: portainer/config.* # Image : yes +portainer_agent: portainer_agent/config.* # Image : yes +postgres: postgres/config.* # Image : yes +prowlarr: prowlarr/config.* # Image : yes +qbittorrent: qbittorrent/config.* # Image : yes +radarr: radarr/config.* # Image : yes +readarr: readarr/config.* # Image : yes +requestrr: requestrr/config.* # Image : yes +resiliosync: resiliosync/config.* # Image : yes +sabnzb: sabnzb/config.* # Image : yes +sabnzbd: sabnzbd/config.* # Image : yes +scrutiny: scrutiny/config.* # Image : yes +scrutiny_fa: scrutiny_fa/config.* # Image : yes +seafile: seafile/config.* # Image : yes +signalk: signalk/config.* # Image : yes +socks5-proxy: socks5-proxy/config.* # Image : yes +sonarr: sonarr/config.* # Image : yes +sponsorblockcast: sponsorblockcast/config.* # Image : yes +spotweb: spotweb/config.* # Image : yes +tandoor_recipes: tandoor_recipes/config.* # Image : yes +tdarr: tdarr/config.* # Image : yes +teamspeak: teamspeak/config.* # Image : yes +tor: tor/config.* # Image : yes +transmission: transmission/config.* # Image : yes +transmission_openvpn: transmission_openvpn/config.* # Image : yes +ubooquity: ubooquity/config.* # Image : yes +unpackerr: unpackerr/config.* # Image : yes +vaultwarden: vaultwarden/config.* # Image : yes +webtop: webtop/config.* # Image : yes +webtop_kde: webtop_kde/config.* # Image : yes +webtrees: webtrees/config.* # Image : yes +wger: wger/config.* # Image : yes +whatsapper: whatsapper/config.* # Image : yes +whoogle: whoogle/config.* # Image : yes +xteve: xteve/config.* # Image : yes +zoneminder: zoneminder/config.* # Image : yes +zzz_archived_bitwarden: zzz_archived_bitwarden/config.* # Image : yes +zzz_archived_code-server: zzz_archived_code-server/config.* # Image : yes +zzz_archived_paperless_ngx: zzz_archived_paperless_ngx/config.* # Image : yes +zzz_archived_plex_meta_manager: zzz_archived_plex_meta_manager/config.* # Image : yes +zzz_draft_birdnet-pi: zzz_draft_birdnet-pi/config.* # Image : yes +zzz_draft_overleaf: zzz_draft_overleaf/config.* # Image : yes +zzz_test: zzz_test/config.* # Image : yes diff --git a/.github/stars.svg b/.github/stars.svg new file mode 100644 index 0000000..8307bdd --- /dev/null +++ b/.github/stars.svg @@ -0,0 +1,719 @@ + + + +\nalexbelgium + + + + + + + +\npetersendev + + + + + + + +\nbruvv + + + + + + + +\nbaldarn + + + + + + + +\njokob-sk + + + + + + + +\nthor0215 + + + + + + + +\nnough + + + + + + + +\nm4dm4rtig4n + + + + + + + +\nelmerenges + + + + + + + +\nelahd + + + + + + + +\nwoutercoppens + + + + + + + +\nchocomega + + + + + + + +\nDeckoz2302 + + + + + + + +\ngabe565 + + + + + + + +\nblowk + + + + + + + +\nddcash + + + + + + + +\ndanbruno + + + + + + + +\nNODeeJay + + + + + + + +\nbaflo + + + + + + + +\nairtonix + + + + + + + +\nmarciogranzotto + + + + + + + +\ntyjtyj + + + + + + + +\nfkhofmann + + + + + + + +\nreedy + + + + + + + +\niBobik + + + + + + + +\nDDanii + + + + + + + +\nproffalken + + + + + + + +\nleokeba + + + + + + + +\noverride80 + + + + + + + +\nmyhomeiot + + + + + + + +\nmechanarchy + + + + + + + +\nghisch + + + + + + + +\nSilvioMessi + + + + + + + +\nMiSebCo + + + + + + + +\nEalenn + + + + + + + +\nzagi988 + + + + + + + +\nBerghsJelmer + + + + + + + +\nAlecRust + + + + + + + +\nandrew-codechimp + + + + + + + +\nstefanroelofs + + + + + + + +\nSpand0x + + + + + + + +\nSiriosDev + + + + + + + +\nShonP40 + + + + + + + +\nttocsr + + + + + + + +\ntasomaniac + + + + + + + +\nakrigator + + + + + + + +\nnkm8 + + + + + + + +\nnathang21 + + + + + + + +\nnwithan8 + + + + + + + +\nMiguelAngelLV + + + + + + + +\nMaxWinterstein + + + + + + + +\ntkurki + + + + + + + +\ntmcarr + + + + + + + +\nacervicius + + + + + + + +\ndavoloko + + + + + + + +\nmonkey-debugger + + + + + + + +\nmxwi + + + + + + + +\nnovisys + + + + + + + +\npullaf + + + + + + + +\nshennig84 + + + + + + + +\ntdn131 + + + + + + + +\nwesleygas + + + + + + + +\nyannpub + + + + + + + +\nphedoreanu + + + + + + + +\naigarius + + + + + + + +\nred-avtovo + + + + + + + +\nwandering-andy + + + + + + + +\nankushg + + + + + + + +\nALenfant + + + + + + + +\nayushtiwari134 + + + + + + + +\nbvhme + + + + + + + +\nChronoRadion + + + + + + + +\neroldan + + + + + + + +\nemmanuel-ferdman + + + + + + + +\nEpicLPer + + + + + + + +\ngieljnssns + + + + + + + +\nigorsantos07 + + + + + + + +\nImgBotApp + + + + + + + +\nkool2zero + + + + + + + +\nJaumeJames + + + + + + + +\njeffothy + + + + + + + +\nJohnnyPicnic + + + + + + + +\njoostlek + + + + + + + +\njpgimenez + + + + + + + +\nKairuByte + + + + + + + +\nApipa169 + + + + + + + +\nkvanzuijlen + + + + + + + +\nkylevandenelsen + + + + + + + +\nmanuel-gamma + + + + + + + + diff --git a/.github/stars2.svg b/.github/stars2.svg new file mode 100644 index 0000000..e69de29 diff --git a/.github/starsevol.svg b/.github/starsevol.svg new file mode 100644 index 0000000..70c8a89 --- /dev/null +++ b/.github/starsevol.svg @@ -0,0 +1 @@ +star-history.com2022202320242025 0.5k1.0k1.5kalexbelgium/hassio-addonsStar HistoryDateGitHub Stars \ No newline at end of file diff --git a/.github/stats.png b/.github/stats.png new file mode 100644 index 0000000..aac9367 Binary files /dev/null and b/.github/stats.png differ diff --git a/.github/stats_addons.png b/.github/stats_addons.png new file mode 100644 index 0000000..3b5dacd Binary files /dev/null and b/.github/stats_addons.png differ diff --git a/.github/workflows/archived_lint-checks.yaml b/.github/workflows/archived_lint-checks.yaml index c680e6f..7836389 100644 --- a/.github/workflows/archived_lint-checks.yaml +++ b/.github/workflows/archived_lint-checks.yaml @@ -3,9 +3,9 @@ name: Lint / Syntax checks on: push: - branches: [main] + branches: [master] pull_request: - branches: [main] + branches: [master] jobs: hadolint: @@ -50,16 +50,16 @@ jobs: fi done -# markdownlint: -# runs-on: ubuntu-latest -# steps: -# - name: ↩️ Checkout -# uses: actions/checkout@v4 -# with: -# # Full git history is needed to get a proper list of changed files within `super-linter` -# fetch-depth: 0 -# -# - name: 🔎 Run markdownlint -# uses: nosborn/github-action-markdown-cli@v3.3.0 -# with: -# config_file: .markdownlint.yaml + markdownlint: + runs-on: ubuntu-latest + steps: + - name: ↩️ Checkout + uses: actions/checkout@v4 + with: + # Full git history is needed to get a proper list of changed files within `super-linter` + fetch-depth: 0 + + - name: 🔎 Run markdownlint + uses: nosborn/github-action-markdown-cli@v3.3.0 + with: + config_file: .markdownlint.yaml diff --git a/.github/workflows/daily_README.yaml b/.github/workflows/daily_README.yaml index 703077b..cf42aa7 100644 --- a/.github/workflows/daily_README.yaml +++ b/.github/workflows/daily_README.yaml @@ -7,6 +7,7 @@ on: workflow_dispatch: null jobs: README_updater: + if: github.repository_owner == 'alexbelgium' runs-on: ubuntu-20.04 steps: - name: Checkout Repo diff --git a/.github/workflows/daily_stale.yml b/.github/workflows/daily_stale.yml index ca8d8ef..c6d9a5f 100644 --- a/.github/workflows/daily_stale.yml +++ b/.github/workflows/daily_stale.yml @@ -9,7 +9,7 @@ name: Mark stale issues and pull requests on: schedule: - - cron: '0 12 * * *' + - cron: '0 12 * * 0' workflow_dispatch: jobs: @@ -20,7 +20,7 @@ jobs: pull-requests: write steps: - - uses: actions/stale@v9.0.0 + - uses: actions/stale@v8 with: repo-token: ${{ secrets.GITHUB_TOKEN }} stale-issue-message: 'This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.' diff --git a/.github/workflows/helper_stats_graphs.yaml b/.github/workflows/helper_stats_graphs.yaml index 7070d4c..b26cc54 100644 --- a/.github/workflows/helper_stats_graphs.yaml +++ b/.github/workflows/helper_stats_graphs.yaml @@ -7,6 +7,7 @@ on: jobs: stats_graphs: + if: github.repository_owner == 'alexbelgium' runs-on: ubuntu-latest steps: - name: Checkout Repo @@ -230,11 +231,11 @@ jobs: run: | echo "Starting run" # Get stars - wget -S -O .github/stars.svg https://contrib.rocks/image?repo=Mesteriis/hassio-addons-avm || true + wget -S -O .github/stars.svg https://contrib.rocks/image?repo=alexbelgium/hassio-addons || true # Get stars2 - wget -S -O .github/stars2.svg https://git-lister.onrender.com/api/stars/Mesteriis/hassio-addons-avm?limit=30 || true + wget -S -O .github/stars2.svg https://git-lister.onrender.com/api/stars/alexbelgium/hassio-addons?limit=30 || true # Get stars evolution - wget -S -O .github/starsevol.svg "https://api.star-history.com/svg?repos=Mesteriis/hassio-addons-avm&type=Date" || true + wget -S -O .github/starsevol.svg "https://api.star-history.com/svg?repos=alexbelgium/hassio-addons&type=Date" || true - name: Commit if needed uses: EndBug/add-and-commit@v9 with: diff --git a/.github/workflows/on_issues.yml b/.github/workflows/on_issues.yml index 02cf1a9..dff9211 100644 --- a/.github/workflows/on_issues.yml +++ b/.github/workflows/on_issues.yml @@ -19,7 +19,7 @@ jobs: echo "Starting" # Get issues list - curl -s -L https://api.github.com/repos/Mesteriis/hassio-addons-avm/issues > issueslist + curl -s -L https://api.github.com/repos/alexbelgium/hassio-addons/issues > issueslist # Go through all folders, add to filters if not existing for f in $( find -- * -maxdepth 0 -type d | sort -r ); do if [ -f "$f"/config.json ]; then diff --git a/.github/workflows/onpr_automerge.old b/.github/workflows/onpr_automerge.old new file mode 100644 index 0000000..c6982e3 --- /dev/null +++ b/.github/workflows/onpr_automerge.old @@ -0,0 +1,40 @@ +# yamllint disable rule:line-length +# shellcheck disable=SC2043 +--- +name: automerge +on: + pull_request_review: + types: + - submitted + issue_comment: + types: created + check_suite: + types: + - completed + status: {} +jobs: + labeler: + runs-on: ubuntu-latest + steps: + - name: Add the automerge label + if: ${{ github.event.issue.pull_request && contains(github.event.comment.body, '/automerge') }} + uses: actions/github-script@v4 + with: + github-token: ${{secrets.GITHUB_TOKEN}} + script: | + github.issues.addLabels({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + labels: ['automerge'] + }) + automerge: + runs-on: ubuntu-latest + needs: [labeler] + steps: + - id: automerge + if: ${{ github.event.issue.pull_request }} + name: automerge + uses: "pascalgn/automerge-action@v0.16.2" + env: + GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" diff --git a/.github/workflows/onpush_builder.yaml b/.github/workflows/onpush_builder.yaml index 9a61509..8af3f9a 100644 --- a/.github/workflows/onpush_builder.yaml +++ b/.github/workflows/onpush_builder.yaml @@ -16,6 +16,7 @@ on: jobs: correct_path_filters: + if: github.repository_owner == 'alexbelgium' runs-on: ubuntu-latest steps: - name: ↩️ Checkout @@ -128,6 +129,20 @@ jobs: - name: Check out repository uses: actions/checkout@v4 + - name: Resolve Symlinks + run: | + # Find all symlinks and replace them with the real files or directories + find . -type l | while read -r link; do + target="$(readlink -f "$link")" + # Remove the symlink + rm "$link" + if [ -d "$target" ]; then + cp -R "$target" "$link" + else + cp "$target" "$link" + fi + done + - name: Get information id: info uses: home-assistant/actions/helpers/info@master @@ -169,7 +184,7 @@ jobs: - name: Build ${{ matrix.addon }} add-on id: builderstep if: steps.check.outputs.build_arch == 'true' - uses: home-assistant/builder@master + uses: home-assistant/builder@2025.02.0 env: CAS_API_KEY: ${{ secrets.CAS_API_KEY }} with: diff --git a/.github/workflows/onpush_superlinter.yml b/.github/workflows/onpush_superlinter.yml index 3e457aa..42e740b 100644 --- a/.github/workflows/onpush_superlinter.yml +++ b/.github/workflows/onpush_superlinter.yml @@ -9,9 +9,9 @@ name: Lint On Change on: push: - branches: [main] + branches: [ master ] pull_request: - branches: [main] + branches: [ master ] jobs: run-lint: @@ -20,6 +20,7 @@ jobs: - name: Checkout code uses: actions/checkout@v4 with: + # Full git history is needed to get a proper list of changed files within `super-linter` fetch-depth: 0 - name: Lint Code Base diff --git a/.github/workflows/weekly-supelinter.yaml b/.github/workflows/weekly-supelinter.yaml index 350975d..b30b2e1 100644 --- a/.github/workflows/weekly-supelinter.yaml +++ b/.github/workflows/weekly-supelinter.yaml @@ -14,6 +14,7 @@ on: jobs: make-executable: + if: github.repository_owner == 'alexbelgium' runs-on: ubuntu-latest steps: - name: Checkout Repo @@ -63,6 +64,7 @@ jobs: check_crlf: name: Check CRLF action + if: github.repository_owner == 'alexbelgium' runs-on: ubuntu-latest steps: diff --git a/.github/workflows/weekly_addons_updater b/.github/workflows/weekly_addons_updater index 3fef2f7..c3cdc5f 100644 --- a/.github/workflows/weekly_addons_updater +++ b/.github/workflows/weekly_addons_updater @@ -27,10 +27,10 @@ jobs: run: | mkdir -p /data echo "{" >> /data/config.json - echo " repository=\"Mesteriis/hassio-addons-avm\"," >> /data/config.json - echo " gituser=\"Mesteriis/hassio-addons-avm\"," >> /data/config.json - echo " gitapi=\"Mesteriis/hassio-addons-avm\"," >> /data/config.json - echo " gitmail=\"Mesteriis/hassio-addons-avm\"," >> /data/config.json + echo " repository=\"alexbelgium/hassio-addons\"," >> /data/config.json + echo " gituser=\"alexbelgium/hassio-addons\"," >> /data/config.json + echo " gitapi=\"alexbelgium/hassio-addons\"," >> /data/config.json + echo " gitmail=\"alexbelgium/hassio-addons\"," >> /data/config.json echo " verbose=false" >> /data/config.json echo "}" >> /data/config.json ./addons_updater/rootfs/etc/cont-init.d/99-run.sh diff --git a/.github/workflows/weekly_bashbeautify.yaml b/.github/workflows/weekly_bashbeautify.yaml index 5510f47..5ebe7f8 100644 --- a/.github/workflows/weekly_bashbeautify.yaml +++ b/.github/workflows/weekly_bashbeautify.yaml @@ -11,6 +11,7 @@ concurrency: jobs: lint-bash: + if: github.repository_owner == 'alexbelgium' name: Lint Bash Scripts runs-on: ubuntu-latest diff --git a/.github/workflows/weekly_crlftolf.yaml b/.github/workflows/weekly_crlftolf.yaml index 11d737a..525433a 100644 --- a/.github/workflows/weekly_crlftolf.yaml +++ b/.github/workflows/weekly_crlftolf.yaml @@ -8,6 +8,7 @@ on: jobs: crlf-to-lf: + if: github.repository_owner == 'alexbelgium' runs-on: ubuntu-latest steps: - name: Checkout repository contents @@ -24,6 +25,7 @@ jobs: fix-crlf: name: Fix CRLF Endings + if: github.repository_owner == 'alexbelgium' runs-on: ubuntu-latest # Use a Linux runner steps: - name: Checkout repository contents diff --git a/.github/workflows/weekly_reduceimagesize.yml b/.github/workflows/weekly_reduceimagesize.yml index 5234def..667ee43 100644 --- a/.github/workflows/weekly_reduceimagesize.yml +++ b/.github/workflows/weekly_reduceimagesize.yml @@ -9,6 +9,7 @@ on: jobs: calibre: + if: github.repository_owner == 'alexbelgium' name: calibreapp/image-actions runs-on: ubuntu-latest steps: diff --git a/.github/workflows/weekly_sortjson.yaml b/.github/workflows/weekly_sortjson.yaml index f64a845..655dd38 100644 --- a/.github/workflows/weekly_sortjson.yaml +++ b/.github/workflows/weekly_sortjson.yaml @@ -9,6 +9,7 @@ on: jobs: sort_json: + if: github.repository_owner == 'alexbelgium' runs-on: ubuntu-20.04 steps: - name: Checkout Repo diff --git a/.github/workflows/weekly_stats.yaml b/.github/workflows/weekly_stats.yaml index 036f698..a3734c6 100644 --- a/.github/workflows/weekly_stats.yaml +++ b/.github/workflows/weekly_stats.yaml @@ -8,6 +8,7 @@ on: jobs: stats_updater: + if: github.repository_owner == 'alexbelgium' runs-on: ubuntu-20.04 steps: - name: Checkout Repo @@ -38,22 +39,22 @@ jobs: if [ -f "$f"/config.json ] && jq -e '.image' "$f/config.json"; then SLUG="$(jq -r '.image' "$f/config.json" | awk -F 'alexbelgium/|-{arch' '{print $2}')" if [[ "$(jq '.arch[]' "$f/config.json")" == *"armv7"* ]]; then - ARCH=armv7 && COUNT="$(curl --connect-timeout 5 -f -s -L https://github.com/Mesteriis/hassio-addons-avm/pkgs/container/$SLUG-$ARCH/latest | awk '/Total downloads/{getline; print}' | awk -F '<|>' '{print $3}')" - until [ -n "$COUNT" ]; do COUNT="$(curl --connect-timeout 5 -f -s -L https://github.com/Mesteriis/hassio-addons-avm/pkgs/container/$SLUG-$ARCH/latest | awk '/Total downloads/{getline; print}' | awk -F '<|>' '{print $3}')" && sleep 5; ((c++)) && echo "repeat $c" && if [[ "$c" == 10 ]]; then count=0; fi; done + ARCH=armv7 && COUNT="$(curl --connect-timeout 5 -f -s -L https://github.com/alexbelgium/hassio-addons/pkgs/container/$SLUG-$ARCH/latest | awk '/Total downloads/{getline; print}' | awk -F '<|>' '{print $3}')" + until [ -n "$COUNT" ]; do COUNT="$(curl --connect-timeout 5 -f -s -L https://github.com/alexbelgium/hassio-addons/pkgs/container/$SLUG-$ARCH/latest | awk '/Total downloads/{getline; print}' | awk -F '<|>' '{print $3}')" && sleep 5; ((c++)) && echo "repeat $c" && if [[ "$c" == 10 ]]; then count=0; fi; done COUNT="${COUNT//,/}" COUNT1="$COUNT" echo "$COUNT $ARCH users with $SLUG" && DOWNLOADS="$(( DOWNLOADS + COUNT))" else COUNT1="-"; fi if [[ "$(jq '.arch[]' "$f/config.json")" == *"amd64"* ]]; then - ARCH=amd64 && COUNT="$(curl --connect-timeout 5 -f -s -L https://github.com/Mesteriis/hassio-addons-avm/pkgs/container/$SLUG-$ARCH/latest | awk '/Total downloads/{getline; print}' | awk -F '<|>' '{print $3}')" - until [ -n "$COUNT" ]; do COUNT="$(curl --connect-timeout 5 -f -s -L https://github.com/Mesteriis/hassio-addons-avm/pkgs/container/$SLUG-$ARCH/latest | awk '/Total downloads/{getline; print}' | awk -F '<|>' '{print $3}')" && sleep 5; ((c++)) && echo "repeat $c" && if [[ "$c" == 10 ]]; then count=0; fi; done + ARCH=amd64 && COUNT="$(curl --connect-timeout 5 -f -s -L https://github.com/alexbelgium/hassio-addons/pkgs/container/$SLUG-$ARCH/latest | awk '/Total downloads/{getline; print}' | awk -F '<|>' '{print $3}')" + until [ -n "$COUNT" ]; do COUNT="$(curl --connect-timeout 5 -f -s -L https://github.com/alexbelgium/hassio-addons/pkgs/container/$SLUG-$ARCH/latest | awk '/Total downloads/{getline; print}' | awk -F '<|>' '{print $3}')" && sleep 5; ((c++)) && echo "repeat $c" && if [[ "$c" == 10 ]]; then count=0; fi; done COUNT="${COUNT//,/}" COUNT2="$COUNT" echo "$COUNT $ARCH users with $SLUG" && DOWNLOADS="$(( DOWNLOADS + COUNT))" else COUNT2="-"; fi if [[ "$(jq '.arch[]' "$f/config.json")" == *"aarch64"* ]]; then - ARCH=aarch64 && COUNT="$(curl --connect-timeout 5 -f -s -L https://github.com/Mesteriis/hassio-addons-avm/pkgs/container/$SLUG-$ARCH/latest | awk '/Total downloads/{getline; print}' | awk -F '<|>' '{print $3}')" - until [ -n "$COUNT" ]; do COUNT="$(curl --connect-timeout 5 -f -s -L https://github.com/Mesteriis/hassio-addons-avm/pkgs/container/$SLUG-$ARCH/latest | awk '/Total downloads/{getline; print}' | awk -F '<|>' '{print $3}')" && sleep 5; ((c++)) && echo "repeat $c" && if [[ "$c" == 10 ]]; then count=0; fi; done + ARCH=aarch64 && COUNT="$(curl --connect-timeout 5 -f -s -L https://github.com/alexbelgium/hassio-addons/pkgs/container/$SLUG-$ARCH/latest | awk '/Total downloads/{getline; print}' | awk -F '<|>' '{print $3}')" + until [ -n "$COUNT" ]; do COUNT="$(curl --connect-timeout 5 -f -s -L https://github.com/alexbelgium/hassio-addons/pkgs/container/$SLUG-$ARCH/latest | awk '/Total downloads/{getline; print}' | awk -F '<|>' '{print $3}')" && sleep 5; ((c++)) && echo "repeat $c" && if [[ "$c" == 10 ]]; then count=0; fi; done COUNT="${COUNT//,/}" COUNT3="$COUNT" echo "$COUNT $ARCH users with $SLUG" && DOWNLOADS="$(( DOWNLOADS + COUNT))" diff --git a/.templates/.README.md b/.templates/.README.md index eb6dff3..1d0f9ea 100644 --- a/.templates/.README.md +++ b/.templates/.README.md @@ -4,25 +4,25 @@ [![Donate][donation-badge]](https://www.buymeacoffee.com/alexbelgium) [![Donate][paypal-badge]](https://www.paypal.com/donate/?hosted_button_id=DZFULJZTP3UQA) -![update-badge](https://img.shields.io/github/last-commit/Mesteriis/hassio-addons-avm?label=last%20update) +![update-badge](https://img.shields.io/github/last-commit/alexbelgium/hassio-addons?label=last%20update) [donation-badge]: https://img.shields.io/badge/Buy%20me%20a%20coffee%20(no%20paypal)-%23d32f2f?logo=buy-me-a-coffee&style=flat&logoColor=white [paypal-badge]: https://img.shields.io/badge/Buy%20me%20a%20coffee%20with%20Paypal-0070BA?logo=paypal&style=flat&logoColor=white -[![Codacy Badge](https://app.codacy.com/project/badge/Grade/9c6cf10bdbba45ecb202d7f579b5be0e)](https://www.codacy.com/gh/Mesteriis/hassio-addons-avm/dashboard?utm_source=github.com&utm_medium=referral&utm_content=Mesteriis/hassio-addons-avm&utm_campaign=Badge_Grade) -[![GitHub Super-Linter](https://img.shields.io/github/actions/workflow/status/Mesteriis/hassio-addons-avm/weekly-supelinter.yaml?label=Lint%20code%20base)](https://github.com/Mesteriis/hassio-addons-avm/actions/workflows/weekly-supelinter.yaml) -[![Builder](https://img.shields.io/github/actions/workflow/status/Mesteriis/hassio-addons-avm/onpush_builder.yaml?label=Builder)](https://github.com/Mesteriis/hassio-addons-avm/actions/workflows/onpush_builder.yaml) -[![Statistics](https://github.com/Mesteriis/hassio-addons-avm/workflows/Generate%20weekly%20stats/badge.svg)](https://github.com/Mesteriis/hassio-addons-avm/actions/workflows/weekly_stats.yaml) +[![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://img.shields.io/github/actions/workflow/status/alexbelgium/hassio-addons/weekly-supelinter.yaml?label=Lint%20code%20base)](https://github.com/alexbelgium/hassio-addons/actions/workflows/weekly-supelinter.yaml) +[![Builder](https://img.shields.io/github/actions/workflow/status/alexbelgium/hassio-addons/onpush_builder.yaml?label=Builder)](https://github.com/alexbelgium/hassio-addons/actions/workflows/onpush_builder.yaml) +[![Statistics](https://github.com/alexbelgium/hassio-addons/workflows/Generate%20weekly%20stats/badge.svg)](https://github.com/alexbelgium/hassio-addons/actions/workflows/weekly_stats.yaml) [support-badge]: https://camo.githubusercontent.com/f4dbb995049f512fdc97fcc9e022ac243fa38c408510df9d46c7467d0970d959/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f537570706f72742d7468726561642d677265656e2e737667 _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 @Mesteriis/hassio-addons-avm](https://reporoster.com/stars/Mesteriis/hassio-addons-avm)](https://github.com/Mesteriis/hassio-addons-avm/stargazers) +[![Stargazers repo roster for @alexbelgium/hassio-addons](https://reporoster.com/stars/alexbelgium/hassio-addons)](https://github.com/alexbelgium/hassio-addons/stargazers) _Thanks to all contributors !_ -[![contributors](https://contrib.rocks/image?repo=Mesteriis/hassio-addons-avm)](https://github.com/Mesteriis/hassio-addons-avm/graphs/contributors) +[![contributors](https://contrib.rocks/image?repo=alexbelgium/hassio-addons)](https://github.com/alexbelgium/hassio-addons/graphs/contributors) ## About @@ -38,7 +38,7 @@ home to the next level. [![Add repository on my Home Assistant][repository-badge]][repository-url] -If you want to do add the repository manually, please follow the procedure highlighted in the [Home Assistant website](https://home-assistant.io/hassio/installing_third_party_addons). Use the following URL to add this repository: https://github.com/Mesteriis/hassio-addons-avm +If you want to do add the repository manually, please follow the procedure highlighted in the [Home Assistant website](https://home-assistant.io/hassio/installing_third_party_addons). Use the following URL to add this repository: https://github.com/alexbelgium/hassio-addons ## Statistics @@ -61,17 +61,15 @@ If you want to do add the repository manually, please follow the procedure highl ### Total downloads evolution - + ### Specific downloads evolution - + ### Stars evolution - - - +[![Star History Chart](https://api.star-history.com/svg?repos=alexbelgium/hassio-addons&type=Date)](https://star-history.com/#alexbelgium/hassio-addons&Date) ## Add-ons provided by this repository diff --git a/.templates/00-aaa_dockerfile_backup.sh b/.templates/00-aaa_dockerfile_backup.sh index 470c194..576120b 100755 --- a/.templates/00-aaa_dockerfile_backup.sh +++ b/.templates/00-aaa_dockerfile_backup.sh @@ -15,7 +15,7 @@ if [ -e "/MODULESFILE" ]; then 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/Mesteriis/hassio-addons-avm/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 && + 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 @@ -28,7 +28,7 @@ if [ -e "/ENVFILE" ]; then 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/Mesteriis/hassio-addons-avm/master/.templates/ha_automatic_packages.sh" --output /ha_automatic_packages.sh && + curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/ha_automatic_packages.sh" --output /ha_automatic_packages.sh && chmod 777 /ha_automatic_packages.sh && eval /./ha_automatic_packages.sh "${PACKAGES:-}" && rm /ha_automatic_packages.sh diff --git a/.templates/00-banner.sh b/.templates/00-banner.sh index 5895f91..7f2aa2c 100755 --- a/.templates/00-banner.sh +++ b/.templates/00-banner.sh @@ -1,61 +1,91 @@ #!/usr/bin/with-contenv bashio -# shellcheck shell=bash +# shellcheck shell=bash disable=SC2016 set -e # ============================================================================== # 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)" +if ! bashio::supervisor.ping 2>/dev/null; then + # Degraded mode if no homeassistant 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.blue \ - '-----------------------------------------------------------' - bashio::log.green \ - ' Provided by: https://github.com/Mesteriis/hassio-addons-avm ' + bashio::log.blue "Starting addon without HA support" + bashio::log.blue "Version : ${BUILD_VERSION:-1.0}" + bashio::log.blue "Please use Docker Compose for env variables" bashio::log.blue \ '-----------------------------------------------------------' + # Use environment variables instead of addon options + echo "... convert scripts to use environment variables instead of addon options" + while IFS= read -r scripts + do + sed -i -e 's/bashio::config.has_value[[:space:]]*["'"'"']\([^"'"'"']*\)["'"'"']/[ ! -z "${\1:-}" ]/g' \ + -e 's/bashio::config.true[[:space:]]*["'"'"']\([^"'"'"']*\)["'"'"']/[ ! -z "${\1:-}" ] \&\& [ "${\1:-}" = "true" ]/g' \ + -e 's/\$(bashio::config[[:space:]]*["'"'"']\([^"'"'"']*\)["'"'"'])/${\1:-}/g' \ + -e 's/\$(bashio::addon.port[[:space:]]*["'"'"']\([0-9]*\)["'"'"'])/${\1:-}/g' \ + -e 's/bashio::config.require.ssl/true/g' \ + -e 's/\$(bashio::addon.ingress_port)/""/g' \ + -e 's/\$(bashio::addon.ingress_entry)/""/g' \ + -e 's/\$(bashio::addon.ip_address)/""/g' "$scripts" + done < <(grep -srl "bashio" /etc/cont-init.d /custom-services.d) + exit 0 fi +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::log.blue " Architecture: $(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.blue \ + '-----------------------------------------------------------' +bashio::log.green \ + ' Provided by: https://github.com/alexbelgium/hassio-addons ' +bashio::log.blue \ + '-----------------------------------------------------------' + # ============================================================================== # Global actions for all addons # ============================================================================== if bashio::config.has_value "PUID" && bashio::config.has_value "PGID"; then - bashio::log.green \ - ' Defining permissions for main user : ' + bashio::log.green ' Defining permissions for main user : ' PUID="$(bashio::config "PUID")" PGID="$(bashio::config "PGID")" bashio::log.blue "User UID: $PUID" - bashio::log.blue "User GID : $PGID" - id -u abc &>/dev/null || usermod -o -u "$PUID" abc &>/dev/null || true - id -g abc &>/dev/null || groupmod -o -g "$PGID" abc &>/dev/null || true + bashio::log.blue "User GID: $PGID" + + # Only modify user/group if they exist + if id abc &>/dev/null; then + usermod -o -u "$PUID" abc &>/dev/null + fi + if getent group abc &>/dev/null; then + groupmod -o -g "$PGID" abc &>/dev/null + fi + bashio::log.blue \ '-----------------------------------------------------------' fi -# Clean bashrc file -if [ -f ~/.bashrc ]; then rm ~/.bashrc; fi +# Clean bashrc file safely +if [ -f ~/.bashrc ]; then : > ~/.bashrc; fi diff --git a/.templates/00-global_var.sh b/.templates/00-global_var.sh index 0ed168d..3159ae2 100755 --- a/.templates/00-global_var.sh +++ b/.templates/00-global_var.sh @@ -2,6 +2,11 @@ # shellcheck shell=bash set -e +if ! bashio::supervisor.ping 2>/dev/null; then + echo "..." + exit 0 +fi + ################################### # Export all addon options as env # ################################### @@ -27,7 +32,7 @@ for KEYS in "${arr[@]}"; do VALUE=$(jq ."$KEYS" "${JSONSOURCE}") # Check if the value is an array if [[ "$VALUE" == \[* ]]; then - bashio::log.warning "$VALUE is an array, skipping" + bashio::log.warning "One of your option is an array, skipping" else # Continue for single values VALUE="${VALUE//[\"\']/}" @@ -54,7 +59,7 @@ for KEYS in "${arr[@]}"; do VALUE="$secret" fi # text - if bashio::config.false "verbose" || [[ "${KEYS}" == *"PASS"* ]]; then + if bashio::config.false "verbose" || [[ "${KEYS,,}" == *"pass"* ]]; then bashio::log.blue "${KEYS}=******" else bashio::log.blue "$line" diff --git a/.templates/00-local_mounts.sh b/.templates/00-local_mounts.sh index e65d206..aa98877 100755 --- a/.templates/00-local_mounts.sh +++ b/.templates/00-local_mounts.sh @@ -2,6 +2,11 @@ # shellcheck shell=bash set -e +if ! bashio::supervisor.ping 2>/dev/null; then + echo "..." + exit 0 +fi + ###################### # MOUNT LOCAL SHARES # ###################### diff --git a/.templates/00-smb_mounts.sh b/.templates/00-smb_mounts.sh index a8e45f3..5d0537c 100755 --- a/.templates/00-smb_mounts.sh +++ b/.templates/00-smb_mounts.sh @@ -3,6 +3,11 @@ # shellcheck disable= set -e +if ! bashio::supervisor.ping 2>/dev/null; then + bashio::log.blue "Disabled : please use another method" + exit 0 +fi + #################### # DEFINE FUNCTIONS # #################### @@ -19,6 +24,7 @@ test_mount () { fi # Exit if can't write + [[ -e "/mnt/$diskname/testaze" ]] && rm -r "/mnt/$diskname/testaze" # shellcheck disable=SC2015 mkdir "/mnt/$diskname/testaze" && touch "/mnt/$diskname/testaze/testaze" && rm -r "/mnt/$diskname/testaze" || ERROR_MOUNT=true if [[ "$ERROR_MOUNT" == "true" ]]; then @@ -65,7 +71,7 @@ if bashio::config.has_value 'networkdisks'; then # Alert message that it is a new code if [[ "$(date +"%Y%m%d")" -lt "20240201" ]]; then bashio::log.warning "------------------------" - bashio::log.warning "This is a new code, please report any issues on https://github.com/Mesteriis/hassio-addons-avm" + bashio::log.warning "This is a new code, please report any issues on https://github.com/alexbelgium/hassio-addons" bashio::log.warning "------------------------" fi diff --git a/.templates/01-config_yaml.sh b/.templates/01-config_yaml.sh index 4e9b749..79cce29 100755 --- a/.templates/01-config_yaml.sh +++ b/.templates/01-config_yaml.sh @@ -7,22 +7,23 @@ set -e # INITIALIZATION # ################## -# Exit if /config is not mounted -if [ ! -d /config ]; then +# Disable if config not present +if [ ! -d /config ] || ! bashio::supervisor.ping 2>/dev/null; then + echo "..." exit 0 fi # Define slug -slug="${HOSTNAME}" +slug="${HOSTNAME/-/_}" +slug="${slug#*_}" # Check type of config folder if [ ! -f /config/configuration.yaml ] && [ ! -f /config/configuration.json ]; then # New config location CONFIGLOCATION="/config" - CONFIGFILEBROWSER="/addon_configs/$slug/config.yaml" + CONFIGFILEBROWSER="/addon_configs/${HOSTNAME/-/_}/config.yaml" else # Legacy config location - slug="${HOSTNAME#*-}" CONFIGLOCATION="/config/addons_config/${slug}" CONFIGFILEBROWSER="/homeassistant/addons_config/$slug/config.yaml" fi @@ -35,6 +36,9 @@ CONFIGSOURCE="$CONFIGLOCATION"/config.yaml if bashio::config.has_value 'CONFIG_LOCATION'; then CONFIGSOURCE=$(bashio::config "CONFIG_LOCATION") + if [[ "$CONFIGSOURCE" == *.* ]]; then + CONFIGSOURCE=$(dirname "$CONFIGSOURCE") + fi # If does not end by config.yaml, remove trailing slash and add config.yaml if [[ "$CONFIGSOURCE" != *".yaml" ]]; then CONFIGSOURCE="${CONFIGSOURCE%/}"/config.yaml @@ -89,7 +93,7 @@ else bashio::log.green "If accessing the file with filebrowser it should be mapped to $CONFIGSOURCE" fi bashio::log.green "---------------------------------------------------------" -bashio::log.green "Wiki here on how to use : github.com/Mesteriis/hassio-addons-avm/wiki/Add‐ons-feature-:-add-env-variables" +bashio::log.green "Wiki here on how to use : github.com/alexbelgium/hassio-addons/wiki/Add‐ons-feature-:-add-env-variables" echo "" # Check if config file is there, or create one from template @@ -103,7 +107,7 @@ if [ ! -f "$CONFIGSOURCE" ]; then cp /templates/config.yaml "$(dirname "${CONFIGSOURCE}")" else # Download template - TEMPLATESOURCE="https://raw.githubusercontent.com/Mesteriis/hassio-addons-avm/master/.templates/config.template" + TEMPLATESOURCE="https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/config.template" curl -f -L -s -S "$TEMPLATESOURCE" --output "$CONFIGSOURCE" fi fi @@ -111,7 +115,7 @@ fi # Check if there are lines to read cp "$CONFIGSOURCE" /tempenv sed -i '/^#/d' /tempenv -sed -i '/^ /d' /tempenv +sed -i '/^[[:space:]]*$/d' /tempenv sed -i '/^$/d' /tempenv # Exit if empty if [ ! -s /tempenv ]; then @@ -154,6 +158,10 @@ parse_yaml "$CONFIGSOURCE" "" >/tmpfile # Escape dollars sed -i 's|$.|\$|g' /tmpfile +# Look where secrets.yaml is located +SECRETSFILE="/config/secrets.yaml" +if [ -f "$SECRETSFILE" ]; then SECRETSFILE="/homeassistant/secrets.yaml"; fi + while IFS= read -r line; do # Clean output line="${line//[\"\']/}" @@ -162,10 +170,10 @@ while IFS= read -r line; do echo "secret detected" secret=${line#*secret } # Check if single match - secretnum=$(sed -n "/$secret:/=" /config/secrets.yaml) + secretnum=$(sed -n "/$secret:/=" "$SECRETSFILE") [[ $(echo $secretnum) == *' '* ]] && bashio::exit.nok "There are multiple matches for your password name. Please check your secrets.yaml file" # Get text - secret=$(sed -n "/$secret:/p" /config/secrets.yaml) + secret=$(sed -n "/$secret:/p" "$SECRETSFILE") secret=${secret#*: } line="${line%%=*}='$secret'" fi diff --git a/.templates/01-custom_script.sh b/.templates/01-custom_script.sh index e57485f..003671d 100755 --- a/.templates/01-custom_script.sh +++ b/.templates/01-custom_script.sh @@ -6,36 +6,37 @@ set -e # INITIALIZATION # ################## -# Exit if /config is not mounted -if [ ! -d /config ]; then +# Exit if /config is not mounted or HA not used +if [ ! -d /config ] || ! bashio::supervisor.ping 2>/dev/null; then + echo "..." exit 0 fi # Define slug -slug="${HOSTNAME}" +slug="${HOSTNAME/-/_}" +slug="${slug#*_}" # Check type of config folder if [ ! -f /config/configuration.yaml ] && [ ! -f /config/configuration.json ]; then # New config location CONFIGLOCATION="/config" - CONFIGFILEBROWSER="/addon_configs/$slug/${HOSTNAME#*-}.sh" + CONFIGFILEBROWSER="/addon_configs/${HOSTNAME/-/_}/$slug.sh" else # Legacy config location - slug="${HOSTNAME#*-}" CONFIGLOCATION="/config/addons_autoscripts" - CONFIGFILEBROWSER="/homeassistant/addons_config/${slug}/${slug}.sh" + CONFIGFILEBROWSER="/homeassistant/addons_autoscripts/$slug.sh" fi # Default location mkdir -p "$CONFIGLOCATION" || true -CONFIGSOURCE="$CONFIGLOCATION/${HOSTNAME#*-}.sh" +CONFIGSOURCE="$CONFIGLOCATION/$slug.sh" bashio::log.green "Execute $CONFIGFILEBROWSER if existing" -bashio::log.green "Wiki here : github.com/Mesteriis/hassio-addons-avm/wiki/Add-ons-feature-:-customisation" +bashio::log.green "Wiki here : github.com/alexbelgium/hassio-addons/wiki/Add-ons-feature-:-customisation" # Download template if no script found and exit if [ ! -f "$CONFIGSOURCE" ]; then - TEMPLATESOURCE="https://raw.githubusercontent.com/Mesteriis/hassio-addons-avm/master/.templates/script.template" + TEMPLATESOURCE="https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/script.template" curl -f -L -s -S "$TEMPLATESOURCE" --output "$CONFIGSOURCE" || true exit 0 fi diff --git a/.templates/config.template b/.templates/config.template index c765bfa..ab98829 100644 --- a/.templates/config.template +++ b/.templates/config.template @@ -1,3 +1,7 @@ +#============================# +# ALEXBELGIUM'S ENV INJECTOR # +#============================# +# # All env variables set in this file will be enabled in the app # This allows enabling more options that normally available in the addon options # This file must be filled according to the yaml format. diff --git a/.templates/ha_autoapps.sh b/.templates/ha_autoapps.sh index b72a2d5..05bfecf 100755 --- a/.templates/ha_autoapps.sh +++ b/.templates/ha_autoapps.sh @@ -20,7 +20,7 @@ if ! command -v curl >/dev/null 2>/dev/null; then fi # Call apps installer script if needed -curl -f -L -s -S "https://raw.githubusercontent.com/Mesteriis/hassio-addons-avm/master/.templates/ha_automatic_packages.sh" --output /ha_automatic_packages.sh +curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/ha_automatic_packages.sh" --output /ha_automatic_packages.sh chmod 777 /ha_automatic_packages.sh eval /./ha_automatic_packages.sh "${PACKAGES:-}" diff --git a/.templates/ha_automatic_packages.sh b/.templates/ha_automatic_packages.sh index 367a137..884cc0b 100755 --- a/.templates/ha_automatic_packages.sh +++ b/.templates/ha_automatic_packages.sh @@ -64,7 +64,7 @@ for files in "/etc/cont-init.d" "/etc/services.d"; do COMMAND="mount" if grep -q -rnw "$files/" -e "$COMMAND"; then [ "$VERBOSE" = true ] && echo "$COMMAND required" - [ "$PACKMANAGER" = "apk" ] && PACKAGES="$PACKAGES exfatprogs ntfs-3g squashfs-tools fuse lsblk" + [ "$PACKMANAGER" = "apk" ] && PACKAGES="$PACKAGES exfatprogs ntfs-3g ntfs-3g-progs squashfs-tools fuse lsblk" [ "$PACKMANAGER" = "apt" ] && PACKAGES="$PACKAGES exfat* ntfs* squashfs-tools util-linux" #[ "$PACKMANAGER" = "pacman" ] && PACKAGES="$PACKAGES ntfs-3g" fi @@ -216,10 +216,10 @@ fi ####################### # Install micro texteditor -curl https://getmic.ro | bash -mv micro /usr/bin -micro -plugin install bounce -micro -plugin install filemanager +curl https://getmic.ro | bash || true +mv micro /usr/bin || true +micro -plugin install bounce || true +micro -plugin install filemanager || true for files in "/etc/services.d" "/etc/cont-init.d"; do diff --git a/.templates/ha_automodules.sh b/.templates/ha_automodules.sh index b1e96e7..223360d 100755 --- a/.templates/ha_automodules.sh +++ b/.templates/ha_automodules.sh @@ -28,7 +28,7 @@ mkdir -p /etc/cont-init.d # Download scripts for scripts in $MODULES; do - echo "$scripts" && curl -f -L -s -S "https://raw.githubusercontent.com/Mesteriis/hassio-addons-avm/master/.templates/$scripts" -o /etc/cont-init.d/"$scripts" && + 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 diff --git a/.templates/ha_entrypoint.sh b/.templates/ha_entrypoint.sh index 01a520b..cbc78dc 100755 --- a/.templates/ha_entrypoint.sh +++ b/.templates/ha_entrypoint.sh @@ -1,5 +1,6 @@ #!/command/with-contenv bashio # shellcheck shell=bash + echo "Starting..." #################### @@ -11,11 +12,11 @@ for SCRIPTS in /etc/cont-init.d/*; do echo "$SCRIPTS: executing" # Check if run as root - if test "$(id -u)" == 0 && test "$(id -u)" == 0; then + if [ "$(id -u)" -eq 0 ]; then chown "$(id -u)":"$(id -g)" "$SCRIPTS" chmod a+x "$SCRIPTS" else - bashio::log.warning "Script executed with user $(id -u):$(id -g), things can break and chown won't work" + echo -e "\e[38;5;214m$(date) WARNING: Script executed with user $(id -u):$(id -g), things can break and chown won't work\e[0m" # Disable chown and chmod in scripts sed -i "s/^chown /true # chown /g" "$SCRIPTS" sed -i "s/ chown / true # chown /g" "$SCRIPTS" @@ -26,34 +27,70 @@ for SCRIPTS in /etc/cont-init.d/*; do # Get current shebang, if not available use another currentshebang="$(sed -n '1{s/^#![[:blank:]]*//p;q}' "$SCRIPTS")" if [ ! -f "${currentshebang%% *}" ]; then - for shebang in "/command/with-contenv bashio" "/usr/bin/env bashio" "/usr/bin/bashio" "/bin/bash" "/bin/sh"; do if [ -f "${shebang%% *}" ]; then break; fi; done + for shebang in "/command/with-contenv bashio" "/usr/bin/with-contenv bashio" "/usr/bin/env bashio" "/usr/bin/bashio" "/usr/bin/bash" "/usr/bin/sh" "/bin/bash" "/bin/sh"; do + command_path="${shebang%% *}" + if [ -x "$command_path" ] && "$command_path" echo "yes" >/dev/null 2>&1; then + echo "Valid shebang: $shebang" + break + fi + done sed -i "s|$currentshebang|$shebang|g" "$SCRIPTS" fi # Use source to share env variables when requested if [ "${ha_entry_source:-null}" = true ] && command -v "source" &>/dev/null; then - # Exit cannot be used with source sed -i "s/(.*\s|^)exit ([0-9]+)/\1 return \2 || exit \2/g" "$SCRIPTS" sed -i "s/bashio::exit.nok/return 1/g" "$SCRIPTS" sed -i "s/bashio::exit.ok/return 0/g" "$SCRIPTS" - # shellcheck source=/dev/null + # shellcheck disable=SC1090 source "$SCRIPTS" || echo -e "\033[0;31mError\033[0m : $SCRIPTS exiting $?" else - # Support for posix only shell - /."$SCRIPTS" || echo -e "\033[0;31mError\033[0m : $SCRIPTS exiting $?" + "$SCRIPTS" || echo -e "\033[0;31mError\033[0m : $SCRIPTS exiting $?" fi # Cleanup rm "$SCRIPTS" + done ###################### # Starting container # ###################### -echo " " -echo -e "\033[0;32mStarting the upstream container\033[0m" -echo " " - -# Launch lsio mods -if [ -f /docker-mods ]; then exec /docker-mods; fi +# If PID 1, keep alive and manage sigterm +if [ "$$" -eq 1 ]; then + echo " " + echo -e "\033[0;32mEverything started!\033[0m" + terminate() { + echo "Termination signal received, forwarding to subprocesses..." + # Terminate all subprocesses + if command -v pgrep &>/dev/null; then + for pid in $(pgrep -P $$); do + echo "Terminating child PID $pid" + kill -TERM "$pid" 2>/dev/null || echo "Failed to terminate PID $pid" + done + else + # Fallback to iterating through /proc if pgrep is not available + for pid in /proc/[0-9]*/; do + pid=${pid#/proc/} + pid=${pid%/} + if [[ "$pid" -ne 1 ]] && grep -q "^PPid:\s*$$" "/proc/$pid/status" 2>/dev/null; then + echo "Terminating child PID $pid" + kill -TERM "$pid" 2>/dev/null || echo "Failed to terminate PID $pid" + fi + done + fi + + wait + echo "All subprocesses terminated. Exiting." + exit 0 + } + trap terminate SIGTERM SIGINT + while :; do sleep infinity & wait $!; done +else + echo " " + echo -e "\033[0;32mStarting the upstream container\033[0m" + echo " " + # Launch lsio mods + if [ -f /docker-mods ]; then exec /docker-mods; fi +fi diff --git a/.templates/ha_entrypoint_modif.sh b/.templates/ha_entrypoint_modif.sh index 026efff..15b724e 100755 --- a/.templates/ha_entrypoint_modif.sh +++ b/.templates/ha_entrypoint_modif.sh @@ -39,7 +39,9 @@ mkdir -p /run/s6/container_environment # Check if shebang exists for shebang in "/command/with-contenv bashio" "/usr/bin/with-contenv bashio" "/usr/bin/env bashio" "/usr/bin/bashio" "/usr/bin/bash" "/usr/bin/sh" "/bin/bash" "/bin/sh"; do - if [ -f "${shebang%% *}" ]; then + command_path="${shebang%% *}" + if [ -x "$command_path" ] && "$command_path" echo "yes" >/dev/null 2>&1; then + echo "Valid shebang: $shebang" break fi done diff --git a/.templates/ha_lsio.sh b/.templates/ha_lsio.sh index fa21dc9..5ee75a7 100755 --- a/.templates/ha_lsio.sh +++ b/.templates/ha_lsio.sh @@ -51,6 +51,11 @@ if [ -f /etc/s6-overlay/s6-rc.d/svc-cron/run ]; then sed -i "/exec \/usr\/sbin\/cron/c exec /usr/sbin/cron -f &>/proc/1/fd/1" /etc/s6-overlay/s6-rc.d/svc-cron/run fi +# variables not found +for file in $(grep -srl "/usr/bin" /etc/cont-init.d /etc/s6-overlay/s6-rc.d); do + sed -i "1a set +u" "$file" +done + # Replace lsiown if not found if [ ! -f /usr/bin/lsiown ]; then for file in $(grep -sril "lsiown" /etc); do diff --git a/.templates/script.template b/.templates/script.template index 90afec5..367b110 100644 --- a/.templates/script.template +++ b/.templates/script.template @@ -6,4 +6,4 @@ ################# # Any commands written in this bash script will be executed at addon start -# See guide here : https://github.com/Mesteriis/hassio-addons-avm/wiki/Add%E2%80%90ons-feature-:-customisation +# See guide here : https://github.com/alexbelgium/hassio-addons/wiki/Add%E2%80%90ons-feature-:-customisation