From ffa77693190de37db0dcfd6186a1aa1a69e1dbfb Mon Sep 17 00:00:00 2001 From: Tilo Spannagel Date: Thu, 26 Jul 2018 18:12:44 +0200 Subject: [PATCH] Add support for betas to update.sh Signed-off-by: Tilo Spannagel --- update.sh | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/update.sh b/update.sh index d080fc58..6c2b0313 100755 --- a/update.sh +++ b/update.sh @@ -47,6 +47,11 @@ function check_released() { printf '%s\n' "${fullversions[@]}" | grep -qE "^$( echo "$1" | grep -oE '[[:digit:]]+(\.[[:digit:]]+){2}' )" } +# checks if the the beta has already a rc +function check_rc_released() { + printf '%s\n' "${fullversions_rc[@]}" | grep -qE "^$( echo "$1" | grep -oE '[[:digit:]]+(\.[[:digit:]]+){2}' )" +} + travisEnv= function create_variant() { @@ -92,7 +97,7 @@ function create_variant() { done } -find . -maxdepth 1 -type d -regextype sed -regex '\./[[:digit:]]\+\.[[:digit:]]\+\(-rc\)\?' -exec rm -r '{}' \; +find . -maxdepth 1 -type d -regextype sed -regex '\./[[:digit:]]\+\.[[:digit:]]\+\(-rc\|-beta\)\?' -exec rm -r '{}' \; fullversions=( $( curl -fsSL 'https://download.nextcloud.com/server/releases/' |tac|tac| \ grep -oE 'nextcloud-[[:digit:]]+(\.[[:digit:]]+){2}' | \ @@ -131,6 +136,26 @@ for version in "${versions_rc[@]}"; do fi done +fullversions_beta=( $( curl -fsSL 'https://download.nextcloud.com/server/prereleases/' |tac|tac| \ + grep -oE 'nextcloud-[[:digit:]]+(\.[[:digit:]]+){2}beta[[:digit:]]+' | \ + grep -oE '[[:digit:]]+(\.[[:digit:]]+){2}beta[[:digit:]]+' | \ + sort -urV ) ) +versions_rc=( $( printf '%s\n' "${fullversions_beta[@]}" | cut -d. -f1-2 | sort -urV ) ) +for version in "${versions_rc[@]}"; do + fullversion="$( printf '%s\n' "${fullversions_beta[@]}" | grep -E "^$version" | head -1 )" + + if version_greater_or_equal "$version" "$min_version"; then + + if ! check_rc_released "$fullversion"; then + + for variant in "${variants[@]}"; do + + create_variant "$version-beta" "https:\/\/download.nextcloud.com\/server\/prereleases" + done + fi + fi +done + # replace the fist '-' with ' ' travisEnv="$(echo "$travisEnv" | sed '0,/-/{s/-/ /}')"