summaryrefslogtreecommitdiffstats
path: root/update.sh
diff options
context:
space:
mode:
authorTilo Spannagel <development@tilosp.de>2018-03-13 10:58:19 +0100
committerTilo Spannagel <development@tilosp.de>2018-03-13 11:15:27 +0100
commitd104e1cba04adcbb8d4e310598eec747ba4ddd6d (patch)
treeca37bee871f4f215261dd90b529e37dc07476ba4 /update.sh
parentcf450e5d14e5f32dc672643d3b045a467ec1c1ad (diff)
Add images for Release Candidates
Diffstat (limited to 'update.sh')
-rwxr-xr-xupdate.sh130
1 files changed, 83 insertions, 47 deletions
diff --git a/update.sh b/update.sh
index c14a551a..7b5dbdf0 100755
--- a/update.sh
+++ b/update.sh
@@ -29,70 +29,106 @@ declare -A pecl_versions=(
[redis]='3.1.6'
)
+variants=(
+ apache
+ fpm
+ fpm-alpine
+)
+
+min_version='11.0'
+
# version_greater_or_equal A B returns whether A >= B
function version_greater_or_equal() {
[[ "$(printf '%s\n' "$@" | sort -V | head -n 1)" != "$1" || "$1" == "$2" ]];
}
-latests=( $( curl -fsSL 'https://download.nextcloud.com/server/releases/' |tac|tac| \
- grep -oE 'nextcloud-[[:digit:]]+(.[[:digit:]]+)+' | \
- grep -oE '[[:digit:]]+(.[[:digit:]]+)+' | \
- sort -urV ) )
-
-find . -maxdepth 1 -type d -regextype sed -regex '\./[[:digit:]]\+\.[[:digit:]]\+' -exec rm -r '{}' \;
+# checks if the the rc is already released
+function check_released() {
+ printf '%s\n' "${fullversions[@]}" | grep -qE "^$( echo "$1" | grep -oE '[[:digit:]]+(\.[[:digit:]]+){2}' )"
+}
travisEnv=
-for latest in "${latests[@]}"; do
- version=$(echo "$latest" | cut -d. -f1-2)
- if [ -d "$version" ]; then
- continue
+function create_variant() {
+ dir="$1/$variant"
+
+ # Create the version+variant directory with a Dockerfile.
+ mkdir -p "$dir"
+
+ cp "Dockerfile-${base[$variant]}.template" "$dir/Dockerfile"
+
+ echo "updating $fullversion [$1] $variant"
+
+ # Replace the variables.
+ sed -ri -e '
+ s/%%PHP_VERSION%%/'"${php_version[$version]-${php_version[default]}}"'/g;
+ s/%%VARIANT%%/'"$variant"'/g;
+ s/%%VERSION%%/'"$fullversion"'/g;
+ s/%%BASE_DOWNLOAD_URL%%/'"$2"'/g;
+ s/%%CMD%%/'"${cmd[$variant]}"'/g;
+ s/%%VARIANT_EXTRAS%%/'"${extras[$variant]}"'/g;
+ s/%%APCU_VERSION%%/'"${pecl_versions[APCu]}"'/g;
+ s/%%MEMCACHED_VERSION%%/'"${pecl_versions[memcached]}"'/g;
+ s/%%REDIS_VERSION%%/'"${pecl_versions[redis]}"'/g;
+ ' "$dir/Dockerfile"
+
+ # Copy the shell scripts
+ for name in entrypoint cron; do
+ cp "docker-$name.sh" "$dir/$name.sh"
+ done
+
+ # Copy the config directory
+ cp -rT .config "$dir/config"
+
+ # Remove Apache config if we're not an Apache variant.
+ if [ "$variant" != "apache" ]; then
+ rm "$dir/config/apache-pretty-urls.config.php"
fi
- # Only add versions >= 11
- if version_greater_or_equal "$version" "11.0"; then
-
- for variant in apache fpm fpm-alpine; do
- # Create the version+variant directory with a Dockerfile.
- mkdir -p "$version/$variant"
-
- template="Dockerfile-${base[$variant]}.template"
- cp "$template" "$version/$variant/Dockerfile"
-
- echo "updating $latest [$version] $variant"
-
- # Replace the variables.
- sed -ri -e '
- s/%%PHP_VERSION%%/'"${php_version[$version]-${php_version[default]}}"'/g;
- s/%%VARIANT%%/'"$variant"'/g;
- s/%%VERSION%%/'"$latest"'/g;
- s/%%CMD%%/'"${cmd[$variant]}"'/g;
- s/%%VARIANT_EXTRAS%%/'"${extras[$variant]}"'/g;
- s/%%APCU_VERSION%%/'"${pecl_versions[APCu]}"'/g;
- s/%%MEMCACHED_VERSION%%/'"${pecl_versions[memcached]}"'/g;
- s/%%REDIS_VERSION%%/'"${pecl_versions[redis]}"'/g;
- ' "$version/$variant/Dockerfile"
-
- # Copy the shell scripts
- for name in entrypoint cron; do
- cp "docker-$name.sh" "$version/$variant/$name.sh"
- done
+ for arch in i386 amd64; do
+ travisEnv='\n - env: VERSION='"$1"' VARIANT='"$variant"' ARCH='"$arch$travisEnv"
+ done
+}
- # Copy the config directory
- cp -rT .config "$version/$variant/config"
+find . -maxdepth 1 -type d -regextype sed -regex '\./[[:digit:]]\+\.[[:digit:]]\+\(-rc\)\?' -exec rm -r '{}' \;
- # Remove Apache config if we're not an Apache variant.
- if [ "$variant" != "apache" ]; then
- rm "$version/$variant/config/apache-pretty-urls.config.php"
- fi
+fullversions=( $( curl -fsSL 'https://download.nextcloud.com/server/releases/' |tac|tac| \
+ grep -oE 'nextcloud-[[:digit:]]+(\.[[:digit:]]+){2}' | \
+ grep -oE '[[:digit:]]+(\.[[:digit:]]+){2}' | \
+ sort -urV ) )
+versions=( $( printf '%s\n' "${fullversions[@]}" | cut -d. -f1-2 | sort -urV ) )
+for version in "${versions[@]}"; do
+ fullversion="$( printf '%s\n' "${fullversions[@]}" | grep -E "^$version" | head -1 )"
- for arch in i386 amd64; do
- travisEnv='\n - env: VERSION='"$version"' VARIANT='"$variant"' ARCH='"$arch$travisEnv"
- done
+ if version_greater_or_equal "$version" "$min_version"; then
+
+ for variant in "${variants[@]}"; do
+
+ create_variant "$version" "https:\/\/download.nextcloud.com\/server\/releases"
done
fi
done
+fullversions_rc=( $( curl -fsSL 'https://download.nextcloud.com/server/prereleases/' |tac|tac| \
+ grep -oE 'nextcloud-[[:digit:]]+(\.[[:digit:]]+){2}RC[[:digit:]]+' | \
+ grep -oE '[[:digit:]]+(\.[[:digit:]]+){2}RC[[:digit:]]+' | \
+ sort -urV ) )
+versions_rc=( $( printf '%s\n' "${fullversions_rc[@]}" | cut -d. -f1-2 | sort -urV ) )
+for version in "${versions_rc[@]}"; do
+ fullversion="$( printf '%s\n' "${fullversions_rc[@]}" | grep -E "^$version" | head -1 )"
+
+ if version_greater_or_equal "$version" "$min_version"; then
+
+ if ! check_released "$fullversion"; then
+
+ for variant in "${variants[@]}"; do
+
+ create_variant "$version-rc" "https:\/\/download.nextcloud.com\/server\/prereleases"
+ done
+ fi
+ fi
+done
+
# replace the fist '-' with ' '
travisEnv="$(echo "$travisEnv" | sed '0,/-/{s/-/ /}')"