refactoring for buildozer vm 2.0

This commit is contained in:
Mathieu Virbel 2017-05-12 20:39:22 +02:00
parent f02b1d4a73
commit b522bf9c49
12 changed files with 169 additions and 13 deletions

View file

@ -0,0 +1,8 @@
## Release 2.0 - 12 May 2017
- Brand new VM image using latest zesty ubuntu (64 bits)
- Image created for Virtualbox 5.1.22
- Pre-installed guest tools
- Increase disk space to 20GB
- Ready for shared-folder in Virtualbox
- /build can store buildozer builds (specify with build_dir=/build/myapp)

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

View file

@ -6,16 +6,16 @@ d-i keyboard-configuration/variant string us
### Network
d-i netcfg/choose_interface select auto
d-i netcfg/get_hostname string ubuntu
d-i netcfg/get_hostname string kivy-buildozer-vm
d-i netcfg/get_domain string local
d-i netcfg/wireless_wep string
### Mirror
d-i mirror/country string manual
d-i mirror/http/hostname string jp.archive.ubuntu.com
d-i mirror/http/directory string /ubuntu
# d-i mirror/http/hostname string fr.archive.ubuntu.com
# d-i mirror/http/directory string /ubuntu
d-i mirror/http/hostname string 192.168.1.16:3142
d-i mirror/http/directory string /fr.archive.ubuntu.com/ubuntu
d-i mirror/http/proxy string
### Time

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

View file

@ -0,0 +1,7 @@
body {
padding: 20px;
}
pre {
padding: 20px;
}

View file

@ -0,0 +1,67 @@
<html>
<head>
<meta charset="UTF-8">
<title>Kivy/Buildozer VM</title>
<link rel="stylesheet" href="milligram.min.css">
<link rel="stylesheet" href="buildozer.css"
</head>
<body>
<h1>Welcome to the Kivy/Buildozer VM</h1>
<p id="menu">
<a href="https://github.com/kivy/buildozer">Github</a> -
<a href="https://buildozer.readthedocs.io/en/latest/">Documentation</a>
</p>
<p>
Thanks for using Kivy/Buildozer VM. It has been installed only for
packaging Kivy application for Android.<br/>
<b>Credentials</b>: username: <code>kivy</code> / password: <code>kivy</code>
</p>
<h2>How to use the VM</h2>
<p>
Buildozer has been used to build a project and should be functionnal
for yours. It is preferrable to add a Shared Folder and build from there.
By the time we shipped the VM and you using it, you may need to
<a href="#update-buildozer">update buildozer</a>.
</p>
<p>
Go into your project directory, then:
<pre># Just build your application
buildozer android_new debug
# Build your application, deploy on the phone,
# run it, and display the logs from the phone
buildozer android_new debug deploy run logcat</pre>
</p>
<p class="warning">
Virtualbox doesn't support symlink in Shared Folder anymore. So buildozer
will fail during the build.<br/>
We already created a <code>/build</code> directory where you can put your
build in it. Edit your <code>buildozer.ini</code>:
<pre>[buildozer]
build_dir = /build/buildozer-myapp</pre>
</p>
<a name="update-buildozer"></a>
<h2>Update buildozer</h2>
<p>
The buildozer version you have may be outdated, as well as the dependencies.
The best is to regulary update buildozer:
<pre>sudo pip install -U buildozer</pre>
</p>
<h2>Cleaning cache</h2>
<p>
The simplest way to update kivy and other modules is to clean all the
buildozer cache, and rebuild everything.
<pre>rm -rf ~/.buildozer/android/packages</pre>
<p>
</body>
</html>

File diff suppressed because one or more lines are too long

View file

@ -3,5 +3,8 @@
wget http://bootstrap.pypa.io/get-pip.py
python get-pip.py
rm get-pip.py
apt-get -y install git openjdk-7-jdk --no-install-recommends zlib1g-dev
pip install cython buildozer
apt-get -y install lib32z1 lib32ncurses5
apt-get -y install build-essential
apt-get -y install git openjdk-9-jdk --no-install-recommends zlib1g-dev
pip install cython buildozer python-for-android

View file

@ -0,0 +1,13 @@
#!/bin/bash
# Mount the disk image
cd /tmp
mkdir /tmp/isomount
mount -t iso9660 -o loop /root/VBoxGuestAdditions.iso /tmp/isomount
# Install the drivers
/tmp/isomount/VBoxLinuxAdditions.run
# Cleanup
umount isomount
rm -rf isomount /root/VBoxGuestAdditions.iso

View file

@ -1,5 +1,11 @@
#!/bin/bash
# Remove unwanted applications
apt-get -y remove --purge libreoffice*
apt-get -y remove --purge pidgin*
apt-get -y remove --purge thunderbird*
apt-get -y remove --purge fonts-noto-cjk
# Remove APT cache
apt-get -y --purge autoremove
apt-get -y clean
@ -9,13 +15,13 @@ find /var/log -type f | while read f; do echo -ne '' > $f; done;
# Whiteout root
count=`df --sync -kP / | tail -n1 | awk -F ' ' '{print $4}'`;
let count--
count=$(expr $count - 1)
dd if=/dev/zero of=/tmp/whitespace bs=1024 count=$count;
rm /tmp/whitespace;
# Whiteout /boot
count=`df --sync -kP /boot | tail -n1 | awk -F ' ' '{print $4}'`;
let count--
count=$(expr $count - 1)
dd if=/dev/zero of=/boot/whitespace bs=1024 count=$count;
rm /boot/whitespace;

View file

@ -0,0 +1,37 @@
#!/bin/bash
export DBUS_SESSION_BUS_ADDRESS="unix:path=/run/user/1000/bus"
# ensure the kivy user can mount shared folders
adduser kivy vboxsf
# create a space specifically for builds
mkdir /build
chown kivy /build
# add a little face
wget $PACKER_HTTP_ADDR/kivy-icon-96.png
mv kivy-icon-96.png /home/kivy/.face
chown kivy.kivy /home/kivy/.face
# set wallpaper
wget $PACKER_HTTP_ADDR/wallpaper.png
mv wallpaper.png /usr/share/backgrounds/kivy-wallpaper.png
xfconf-query -c xfce4-desktop \
--property /backdrop/screen0/monitor0/workspace0/last-image \
--set /usr/share/backgrounds/kivy-wallpaper.png
# change theme (works better for this wallpaper)
xfconf-query -c xsettings \
--property /Net/ThemeName \
--set Adwaita
xfconf-query -c xsettings \
--property /Net/IconThemeName \
--set elementary-xfce-darker
# copy welcome directory
mkdir -p /usr/share/applications/buildozer-welcome
cd /usr/share/applications/buildozer-welcome
wget $PACKER_HTTP_ADDR/welcome/milligram.min.css
wget $PACKER_HTTP_ADDR/welcome/buildozer.css
wget $PACKER_HTTP_ADDR/welcome/index.css
cd -

View file

@ -4,16 +4,16 @@
"disk_format": "ovf",
"ssh_username": "kivy",
"ssh_password": "kivy",
"hostname": "ubuntu"
"hostname": "kivyvm"
},
"description": "Build a Xubuntu Virtual Machine",
"builders": [{
"type": "virtualbox-iso",
"name": "from-netboot-iso",
"http_directory": "http",
"iso_checksum": "4c58dcf09083cd3aa602eb1b79810a0ff58b7c21",
"iso_checksum": "6131e2cc90cf30407af18f3f1af16c54bf58ffc8",
"iso_checksum_type": "sha1",
"iso_url": "http://archive.ubuntu.com/ubuntu/dists/vivid/main/installer-i386/current/images/netboot/mini.iso",
"iso_url": "http://archive.ubuntu.com/ubuntu/dists/zesty/main/installer-amd64/current/images/netboot/mini.iso",
"ssh_username": "{{user `ssh_username`}}",
"ssh_password": "{{user `ssh_password`}}",
"boot_wait": "3s",
@ -31,13 +31,17 @@
"format": "{{user `disk_format`}}",
"headless": false,
"shutdown_command": "echo {{user `ssh_password`}} | sudo -S shutdown -P now",
"vm_name": "ubuntu",
"vm_name": "Kivy/Buildozer VM",
"guest_os_type": "Ubuntu_64",
"guest_additions_path": "/root",
"ssh_wait_timeout": "120m"
}],
"provisioners": [{
"type": "shell",
"execute_command": "echo {{user `ssh_password`}} | {{ .Vars }} sudo -E -S sh '{{ .Path }}'",
"scripts": [
"scripts/install-virtualbox-guest-additions.sh",
"scripts/setup.sh",
"scripts/additional-packages.sh",
"scripts/minimize.sh"
]