1
0
mirror of https://gitlab.com/fdroid/fdroidserver.git synced 2024-11-16 11:50:10 +01:00
fdroidserver/buildserver/provision-gradle
Marcus Hoffmann 2a2613520a provision-gradle: skip versions older than 2.2.1
These are almost never used now and still can be downloaded on-demand.
2018-11-27 17:34:53 +01:00

29 lines
778 B
Bash

#!/bin/bash
set -ex
# version compare magic
vergte() {
printf '%s\n%s' "$1" "$2" | sort -C -V -r
}
test -e /opt/gradle/versions || mkdir -p /opt/gradle/versions
cd /opt/gradle/versions
for f in /vagrant/cache/gradle-*.zip; do
ver=`echo $f | sed 's,.*gradle-\([0-9][0-9.]*\).*\.zip,\1,'`
# only use versions greater or equal 2.2.1
if vergte $ver 2.2.1 && [ ! -d /opt/gradle/versions/${ver} ]; then
unzip -qq $f
mv gradle-${ver} /opt/gradle/versions/${ver}
fi
done
chmod -R a+rX /opt/gradle
test -e /opt/gradle/bin || mkdir -p /opt/gradle/bin
ln -fs /home/vagrant/fdroidserver/gradlew-fdroid /opt/gradle/bin/gradle
chown -h vagrant.vagrant /opt/gradle/bin/gradle
chown vagrant.vagrant /opt/gradle/versions
chmod 0755 /opt/gradle/versions