From b919f097fe92c00e48b4dca60d1efd3f93d0eae8 Mon Sep 17 00:00:00 2001 From: Alexandre <44178713+alexbelgium@users.noreply.github.com> Date: Tue, 26 Apr 2022 21:05:03 +0200 Subject: [PATCH] Update 99-run.sh --- .../rootfs/etc/cont-init.d/99-run.sh | 41 ++++++++++--------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/addons_updater/rootfs/etc/cont-init.d/99-run.sh b/addons_updater/rootfs/etc/cont-init.d/99-run.sh index 33c622ea1..3c1c0638b 100644 --- a/addons_updater/rootfs/etc/cont-init.d/99-run.sh +++ b/addons_updater/rootfs/etc/cont-init.d/99-run.sh @@ -28,27 +28,10 @@ if bashio::config.has_value 'gitapi'; then export GITHUB_API_TOKEN fi -LOGINFO="... parse addons" && if [ "$VERBOSE" = true ]; then bashio::log.info "$LOGINFO"; fi - -# Go through all folders, add to filters if not existing -echo "go in folder" -cd /data/hassio-addons || exit -for f in *; do -echo "folder $f" -if [ -f "$f"/updater.json ]; then - cd / - SLUG=$f - REPOSITORY=$(jq -r .repository /data/"$f"/updater.json) - UPSTREAM=$(jq -r .upstream /data/"$f"/updater.json) - BETA=$(jq -r .beta /data/"$f"/updater.json) - FULLTAG=$(jq -r .github_fulltag /data/"$f"/updater.json) - HAVINGASSET=$(jq -r .github_havingasset /data/"$f"/updater.json) - SOURCE=$(jq -r .source /data/"$f"/updater.json) - FILTER_TEXT=$(jq -r .github_tagfilter /data/"$f"/updater.json) - BASENAME=$(basename "https://github.com/$REPOSITORY") - DATE="$(date '+%d-%m-%Y')" - #Create or update local version + REPOSITORY=$(bashio::config 'repository') + BASENAME=$(basename "https://github.com/$REPOSITORY") + if [ ! -d "/data/$BASENAME" ]; then LOGINFO="... $SLUG : cloning ${REPOSITORY}" && if [ "$VERBOSE" = true ]; then bashio::log.info "$LOGINFO"; fi cd /data/ || exit @@ -60,6 +43,24 @@ if [ -f "$f"/updater.json ]; then git pull --rebase &>/dev/null fi +LOGINFO="... parse addons" && if [ "$VERBOSE" = true ]; then bashio::log.info "$LOGINFO"; fi + +# Go through all folders, add to filters if not existing +echo "go in folder" +cd /data/$BASENAME || exit +for f in *; do +echo "folder $f" +if [ -f "$f"/updater.json ]; then + SLUG=$f + + UPSTREAM=$(jq -r .upstream "$f"/updater.json) + BETA=$(jq -r .beta "$f"/updater.json) + FULLTAG=$(jq -r .github_fulltag "$f"/updater.json) + HAVINGASSET=$(jq -r .github_havingasset "$f"/updater.json) + SOURCE=$(jq -r .source "$f"/updater.json) + FILTER_TEXT=$(jq -r .github_tagfilter "$f"/updater.json) + DATE="$(date '+%d-%m-%Y')" + #Define the folder addon LOGINFO="... $SLUG : checking slug exists in repo" && if [ "$VERBOSE" = true ]; then bashio::log.info "$LOGINFO"; fi cd /data/"${BASENAME}"/"${SLUG}" || { bashio::log.error "$SLUG addon not found in this repository. Exiting."; continue; }