From 263baba4b2ccc69dff0651fc3a3a16d879702ab8 Mon Sep 17 00:00:00 2001 From: Alexandre <44178713+alexbelgium@users.noreply.github.com> Date: Thu, 11 Jan 2024 15:58:32 +0100 Subject: [PATCH] Update 99-run.sh --- .../rootfs/etc/cont-init.d/99-run.sh | 30 ++++++++++++------- 1 file changed, 19 insertions(+), 11 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 2840b6e59..bc7f5bdad 100755 --- a/addons_updater/rootfs/etc/cont-init.d/99-run.sh +++ b/addons_updater/rootfs/etc/cont-init.d/99-run.sh @@ -200,29 +200,37 @@ for f in */; do #Execute version search # shellcheck disable=SC2086 - LASTVERSION="$(lastversion "$UPSTREAM" $ARGUMENTS 2>&1)" || \ - \ - # check if it is an issue with no releases in github - ( if [[ "$SOURCE" == "github" ]] && [[ ${LASTVERSION,,} == *"no release found"* ]]; then + LASTVERSION="$(lastversion "$UPSTREAM" $ARGUMENTS 2>&1)" || { if [[ "$SOURCE" == "github" ]] && [[ ${LASTVERSION,,} == *"no release found"* ]]; then # Is there a package echo "No version found, looking if packages available" - last_packages="$(curl -s https://github.com/$REPOSITORY/packages | sed -n "s/.*\/container\/package\/\([^\"]*\).*/\1/p")" - last_package="$(echo "$last_packages" | head -n 1)" + last_packages="$(curl -s https://github.com/$REPOSITORY/packages | sed -n "s/.*\/container\/package\/\([^\"]*\).*/\1/p")" || true + last_package="$(echo "$last_packages" | head -n 1)" || true if [[ "$(echo -n "$last_packages" | grep -c '^')" -gt 0 ]]; then - echo "A total of $(echo -n "$last_packages" | grep -c '^') packages were found, using $last_package" + echo "A total of $(echo -n "$last_packages" | grep -c '^') packages were found, using $last_package" + LASTVERSION="$(curl -s https://github.com/$REPOSITORY/pkgs/container/$last_package | sed -n "s/.*?tag=\([^\"]*\)\">.*/\1/p" | + sed -e '/.*latest.*/d' | + sed -e '/.*dev.*/d' | + sed -e '/.*nightly.*/d' | + sed -e '/.*beta.*/d' | + sed -e "/.*$EXCLUDE_TEXT.*/d" | + sort -V | + tail -n 1)" || true + if [[ "$LASTVERSION" == "" ]]; then + # Continue to next + continue + fi else echo "No packages found" # Continue to next continue fi - - # Are there tags - else # Continue to next continue - fi ) + fi } + fi + # Add brackets LASTVERSION='"'${LASTVERSION}'"'