3 if [ `dirname $0` != "." ]; then
4 echo "only run this script like ./`basename $0`"
8 if [ -z $WORKSPACE ]; then
12 # make sure that no VirtualBox processes are left running
15 echo "$(date -u) - cleanup in progress..."
16 ps auxww | grep -e VBox -e qemu
17 virsh --connect qemu:///system list --all
18 ls -hl /var/lib/libvirt/images
19 cd $WORKSPACE/buildserver
24 killall -9 VBoxHeadless
25 echo "$(date -u) - cleanup done."
27 trap cleanup_all INT TERM EXIT
32 # make sure we have the vagrant box image cached
33 test -e ~/.cache/fdroidserver || mkdir -p ~/.cache/fdroidserver
34 cd ~/.cache/fdroidserver
35 wget --tries=1 --timeout=5 --continue https://f-droid.org/jessie64.box || true
36 echo "de3e3c4a9c13e8c015e30edeea0f583b195d1ee8ff9ad4814e933bbfb560200f jessie64.box" > jessie64.box.sha256
37 sha256sum -c jessie64.box.sha256
39 # redirect homes to be in the git repo, so they'll get cleaned and reset
40 export XDG_CONFIG_HOME=$WORKSPACE
41 export VBOX_USER_HOME=$WORKSPACE/VirtualBox
43 if which VBoxManage; then
44 VBoxManage setproperty machinefolder $WORKSPACE/virtualbox.d
45 VBoxManage setproperty logginglevel debug
47 export VAGRANT_HOME=$WORKSPACE/vagrant.d
51 echo "debian_mirror = 'https://deb.debian.org/debian/'" > $WORKSPACE/makebuildserver.config.py
52 echo "boot_timeout = 1200" >> $WORKSPACE/makebuildserver.config.py
53 echo "apt_package_cache = True" >> $WORKSPACE/makebuildserver.config.py
54 echo "copy_caches_from_host = True" >> $WORKSPACE/makebuildserver.config.py
55 echo "memory = 6144" >> $WORKSPACE/makebuildserver.config.py
56 echo "cpus = 2" >> $WORKSPACE/makebuildserver.config.py
57 ./makebuildserver -vv --clean
59 if [ -z "`vagrant box list | egrep '^buildserver\s+\((libvirt|virtualbox), [0-9]+\)$'`" ]; then
61 echo "ERROR: buildserver box does not exist!"
65 # this can be handled in the jenkins job, or here:
66 if [ -e fdroiddata ]; then
68 while ! git fetch; do sleep 1; done
71 git reset --hard origin/master
75 git clone --depth 1 https://gitlab.com/fdroid/fdroiddata.git fdroiddata
80 if [ -z $ANDROID_HOME ]; then
81 if [ -e ~/.android/bashrc ]; then
84 echo "ANDROID_HOME must be set!"
89 # if it can't build fdroid, then its really broken
90 ../fdroid build --verbose --stop --latest org.fdroid.fdroid
91 # Gradle, JNI, preassemble
92 ../fdroid build --verbose --stop org.adaway:55
93 # building old versions should still work
94 ../fdroid build --verbose --stop org.fdroid.fdroid:96150
95 # test OTA update ZIP build and publish
96 ../fdroid build --verbose --stop org.fdroid.fdroid.privileged.ota:2070