2016-06-15 15:25:57 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
2018-07-08 17:34:17 +02:00
|
|
|
set -ex
|
2016-06-15 15:25:57 +02:00
|
|
|
|
2018-11-27 16:29:44 +01:00
|
|
|
|
|
|
|
# version compare magic
|
|
|
|
vergte() {
|
|
|
|
printf '%s\n%s' "$1" "$2" | sort -C -V -r
|
|
|
|
}
|
|
|
|
|
2016-06-15 15:25:57 +02:00
|
|
|
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,'`
|
2018-11-27 16:29:44 +01:00
|
|
|
# only use versions greater or equal 2.2.1
|
|
|
|
if vergte $ver 2.2.1 && [ ! -d /opt/gradle/versions/${ver} ]; then
|
2016-06-15 15:25:57 +02:00
|
|
|
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
|
2018-07-08 17:34:17 +02:00
|
|
|
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
|
2020-01-14 23:27:40 +01:00
|
|
|
|
|
|
|
GRADLE_HOME=/home/vagrant/.gradle
|
|
|
|
test -d $GRADLE_HOME/ || mkdir $GRADLE_HOME/
|
|
|
|
cat <<EOF > $GRADLE_HOME/gradle.properties
|
|
|
|
# builds are not reused, so the daemon is a waste of time
|
|
|
|
org.gradle.daemon=false
|
|
|
|
|
2020-02-12 13:58:47 +01:00
|
|
|
# set network timeouts to 10 minutes
|
|
|
|
# https://github.com/gradle/gradle/pull/3371/files
|
|
|
|
systemProp.http.connectionTimeout=600000
|
|
|
|
systemProp.http.socketTimeout=600000
|
|
|
|
systemProp.org.gradle.internal.http.connectionTimeout=600000
|
|
|
|
systemProp.org.gradle.internal.http.socketTimeout=600000
|
2020-01-14 23:27:40 +01:00
|
|
|
EOF
|
2020-03-15 15:34:25 +01:00
|
|
|
|
2020-01-14 23:27:40 +01:00
|
|
|
chown -R vagrant.vagrant $GRADLE_HOME/
|
|
|
|
chmod -R a+rX $GRADLE_HOME/
|