Update daily_README.yaml

This commit is contained in:
Alexandre
2022-12-05 21:48:09 +01:00
committed by GitHub
parent 401fec1a1d
commit 0bc64e247a

View File

@@ -48,23 +48,24 @@ jobs:
COUNT3=0
# Go through all folders, add to filters if not existing
# shellcheck disable=SC2086
for f in $( find -- * -maxdepth 0 -type d | sort -r ); do
DOWNLOADS=0
if [ -f "$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
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 -f -s -L https://github.com/alexbelgium/hassio-addons/pkgs/container/$SLUG-$ARCH/latest | awk '/Total downloads/{getline; print}' | awk -F '<|>' '{print $3}')"
if [ -z "$COUNT" ]; then echo "$(curl -f -s -L https://github.com/alexbelgium/hassio-addons/pkgs/container/$SLUG-$ARCH/latest | awk '/Total downloads/{getline; print}')"; fi
COUNT1="$COUNT"
echo "$COUNT $ARCH users with $SLUG" && DOWNLOADS="$(( DOWNLOADS + COUNT))"
else COUNT1="-"; fi
if [[ $(jq '.arch[]' "$f/config.json") == *"amd64"* ]]; then
if [[ "$(jq '.arch[]' "$f/config.json")" == *"amd64"* ]]; then
ARCH=amd64 && COUNT="$(curl -f -s -L https://github.com/alexbelgium/hassio-addons/pkgs/container/$SLUG-$ARCH/latest | awk '/Total downloads/{getline; print}' | awk -F '<|>' '{print $3}')"
until [ ! -z "$COUNT" ]; do COUNT="$(curl -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; done
COUNT2="$COUNT"
echo "$COUNT $ARCH users with $SLUG" && DOWNLOADS="$(( DOWNLOADS + COUNT))"
else COUNT2="-"; fi
if [[ $(jq '.arch[]' "$f/config.json") == *"aarch64"* ]]; then
if [[ "$(jq '.arch[]' "$f/config.json")" == *"aarch64"* ]]; then
ARCH=aarch64 && COUNT="$(curl -f -s -L https://github.com/alexbelgium/hassio-addons/pkgs/container/$SLUG-$ARCH/latest | awk '/Total downloads/{getline; print}' | awk -F '<|>' '{print $3}')"
if [ -z "$COUNT" ]; then echo "$(curl -f -s -L https://github.com/alexbelgium/hassio-addons/pkgs/container/$SLUG-$ARCH/latest | awk '/Total downloads/{getline; print}')"; fi
COUNT3="$COUNT"
@@ -96,8 +97,6 @@ jobs:
# Init
echo "Starting"
declare -i DOWNLOADS
declare -i COUNT
# Prepare template
@@ -109,6 +108,7 @@ jobs:
# Sort folders by addon name
# shellcheck disable=SC2086
for f in $( find -- * -maxdepth 0 -type d | sort -r ); do
if [ -f "$f"/config.json ]; then
NAME=$(jq -r '.name' "$f"/config.json)
@@ -130,12 +130,12 @@ jobs:
# Get variables
if [ -f "$f/oldname" ]; then FOLDERNAME="$(cat "$f/oldname")"; else FOLDERNAME="$f"; fi
NAME=$(jq -r '.name' "$f/config.json")
DESCRIPTION=$(jq -r '.description' "$f/config.json")
NAME="$(jq -r '.name' "$f/config.json")"
DESCRIPTION="$(jq -r '.description' "$f/config.json")"
# Get icon
if [ "$(jq '.panel_icon' "$f/config.json")" != null ]; then
ICON="$(jq -r '.panel_icon' "$f/config.json")"
ICON=${ICON#*:}
ICON="${ICON#*:}"
ICON="![image](https://api.iconify.design/mdi/$ICON.svg)"
else
ICON=""
@@ -144,19 +144,19 @@ jobs:
# Write infos
echo "Writing infos"
sed -i "$ADDONSLINE"'{G;}' README2.md
if [[ $(jq '.schema' "$f/config.json" 2>/dev/null) == *"localdisks"* ]]; then sed -i "$ADDONSLINE"'a ![localdisks][localdisks-badge]' README2.md; fi
if [[ $(jq '.schema' "$f/config.json" 2>/dev/null) == *"networkdisks"* ]]; then sed -i "$ADDONSLINE"'a ![smb][smb-badge]' README2.md; fi
if [[ $(jq '.full_access' "$f/config.json" 2>/dev/null) == "true" ]]; then sed -i "$ADDONSLINE"'a ![full_access][full_access-badge]' README2.md; fi
if [[ $(jq '.services[]' "$f/config.json" 2>/dev/null) == *"mqtt"* ]]; then sed -i "$ADDONSLINE"'a ![mqtt][mqtt-badge]' README2.md; fi
if [[ $(jq '.services[]' "$f/config.json" 2>/dev/null) == *"mysql"* ]]; then sed -i "$ADDONSLINE"'a ![MariaDB][mariadb-badge]' README2.md; fi
if [[ $(jq '.ingress' "$f/config.json" 2>/dev/null) == "true" ]]; then sed -i "$ADDONSLINE"'a ![ingress][ingress-badge]' README2.md; fi
if [[ $(jq '.arch[]' "$f/config.json") == *"armv7"* ]]; then
if [[ "$(jq '.schema' "$f/config.json" 2>/dev/null)" == *"localdisks"* ]]; then sed -i "$ADDONSLINE"'a ![localdisks][localdisks-badge]' README2.md; fi
if [[ "$(jq '.schema' "$f/config.json" 2>/dev/null)" == *"networkdisks"* ]]; then sed -i "$ADDONSLINE"'a ![smb][smb-badge]' README2.md; fi
if [[ "$(jq '.full_access' "$f/config.json" 2>/dev/null)" == "true" ]]; then sed -i "$ADDONSLINE"'a ![full_access][full_access-badge]' README2.md; fi
if [[ "$(jq '.services[]' "$f/config.json" 2>/dev/null)" == *"mqtt"* ]]; then sed -i "$ADDONSLINE"'a ![mqtt][mqtt-badge]' README2.md; fi
if [[ "$(jq '.services[]' "$f/config.json" 2>/dev/null)" == *"mysql"* ]]; then sed -i "$ADDONSLINE"'a ![MariaDB][mariadb-badge]' README2.md; fi
if [[ "$(jq '.ingress' "$f/config.json" 2>/dev/null)" == "true" ]]; then sed -i "$ADDONSLINE"'a ![ingress][ingress-badge]' README2.md; fi
if [[ "$(jq '.arch[]' "$f/config.json")" == *"armv7"* ]]; then
sed -i "$ADDONSLINE"'a ![armv7][armv7-badge]' README2.md
else sed -i "$ADDONSLINE"'a ![armv7no][armv7no-badge]' README2.md; fi || true
if [[ $(jq '.arch[]' "$f/config.json") == *"amd64"* ]]; then
if [[ "$(jq '.arch[]' "$f/config.json")" == *"amd64"* ]]; then
sed -i "$ADDONSLINE"'a ![amd64][amd64-badge]' README2.md
else sed -i "$ADDONSLINE"'a ![amd64no][amd64no-badge]' README2.md; fi || true
if [[ $(jq '.arch[]' "$f/config.json") == *"aarch64"* ]]; then
if [[ "$(jq '.arch[]' "$f/config.json")" == *"aarch64"* ]]; then
sed -i "$ADDONSLINE"'a ![aarch64][aarch64-badge]' README2.md
else sed -i "$ADDONSLINE"'a ![aarch64no][aarch64no-badge]' README2.md; fi || true
if [[ -f "$f/updater.json" ]]; then sed -i "$ADDONSLINE"'a ![Update](https://img.shields.io/badge/dynamic/json?label=Updated&query=%24.last_update&url=https%3A%2F%2Fraw.githubusercontent.com%2Falexbelgium%2Fhassio-addons%2Fmaster%2F'"$FOLDERNAME"'%2Fupdater.json)' README2.md; fi