Commit 5865e011 authored by thiolliere's avatar thiolliere
Browse files

package ansiblecube in binary

parent 81e8ccb6
......@@ -17,6 +17,11 @@ matrix:
- wget http://download.kiwix.org/dev/pibox-installer-vexpress-boot.zip
- unzip pibox-installer-vexpress-boot.zip
# Download playbook
- wget https://github.com/thiolliere/ansiblecube/archive/oneUpdateFile0.3.zip
- unzip oneUpdateFile0.3.zip
- mv ansiblecube-oneUpdateFile0.3 ansiblecube
# Bundle QEMU
- git clone https://github.com/auriamg/macdylibbundler/
- cd macdylibbundler/
......@@ -92,6 +97,11 @@ matrix:
- wget http://download.kiwix.org/dev/pibox-installer-vexpress-boot.zip
- unzip pibox-installer-vexpress-boot.zip
# Download playbook
- wget https://github.com/thiolliere/ansiblecube/archive/oneUpdateFile0.3.zip
- unzip oneUpdateFile0.3.zip
- mv ansiblecube-oneUpdateFile0.3 ansiblecube
# Compile QEMU statically
- wget http://download.qemu-project.org/$QEMU_ARCHIVE
- tar -xf $QEMU_ARCHIVE
......
......@@ -45,6 +45,7 @@ install dependencies:
* [pygobject](https://pygobject.readthedocs.io/en/latest/getting_started.html):
on Windows you can also install it using [pygi-aio](https://sourceforge.net/projects/pygobjectwin32/)
* [pibox-installer-vexpress-boot](http://download.kiwix.org/dev/pibox-installer-vexpress-boot.zip): unzip in the directory
* [ansiblecube thiolliere fork](https://github.com/thiolliere/ansiblecube): branch oneUpdateFile0.3, rename the directory to ansiblecube
create a virtual a virtual environment that includes pygobject: `python3 -m venv --system-site-packages my_venv`
......
......@@ -23,6 +23,11 @@ install:
- appveyor DownloadFile "http://download.kiwix.org/dev/pibox-installer-vexpress-boot.zip"
- 7z.exe x pibox-installer-vexpress-boot.zip
# Download playbook
- appveyor DownloadFile "https://github.com/thiolliere/ansiblecube/archive/oneUpdateFile0.3.zip"
- 7z.exe x oneUpdateFile0.3.zip
- move ansiblecube-oneUpdateFile0.3 ansiblecube
# Install pygobject
# pygi-aio provides a way to install from cmd even if it is not documented
# the only package to install is GTK with GIR
......
......@@ -9,6 +9,7 @@ a = Analysis(['pibox-installer/__main__.py'],
datas=[('ui.glade', '.'),
('pibox_ideascube_conf.py', '.'),
('pibox-installer-logo.png', '.'),
('ansiblecube', 'ansiblecube'),
('pibox-installer-vexpress-boot', 'pibox-installer-vexpress-boot')],
hiddenimports=[],
hookspath=['additional-hooks'],
......
......@@ -12,6 +12,7 @@ a = Analysis(['pibox-installer/__main__.py'],
datas=[('ui.glade', '.'),
('pibox_ideascube_conf.py', '.'),
('pibox-installer-logo.png', '.'),
('ansiblecube', 'ansiblecube'),
('pibox-installer-vexpress-boot', 'pibox-installer-vexpress-boot')],
hiddenimports=[],
hookspath=['additional-hooks'],
......
......@@ -72,6 +72,7 @@ a = Analysis(['pibox-installer/__main__.py'],
datas=[('ui.glade', '.'),
('pibox_ideascube_conf.py', '.'),
('pibox-installer-logo.png', '.'),
('ansiblecube', 'ansiblecube'),
('pibox-installer-vexpress-boot', 'pibox-installer-vexpress-boot')],
hiddenimports=[],
hookspath=['additional-hooks'],
......
......@@ -72,6 +72,7 @@ a = Analysis(['pibox-installer/__main__.py'],
datas=[('ui.glade', '.'),
('pibox_ideascube_conf.py', '.'),
('pibox-installer-logo.png', '.'),
('ansiblecube', 'ansiblecube'),
('pibox-installer-vexpress-boot', 'pibox-installer-vexpress-boot')],
hiddenimports=[],
hookspath=['additional-hooks'],
......
import json
# machine must provide write_file and exec_cmd functions
def run(machine, name, timezone, wifi_pwd, edupi, aflatoun, kalite, zim_install):
def run(machine, name, timezone, wifi_pwd, edupi, aflatoun, kalite, zim_install, ansiblecube_path):
machine.exec_cmd("sudo apt-get update")
machine.exec_cmd("sudo apt-get install -y python-pip git python-dev libffi-dev libssl-dev gnutls-bin")
machine.exec_cmd("sudo pip install ansible==2.2.0 markupsafe")
machine.exec_cmd("sudo pip install cryptography --upgrade")
ansiblecube_url = "https://github.com/thiolliere/ansiblecube.git"
ansiblecube_path = "/var/lib/ansible/local"
machine.exec_cmd("sudo mkdir --mode 0755 -p %s" % ansiblecube_path)
machine.exec_cmd("sudo git clone {url} {path}".format(url=ansiblecube_url, path=ansiblecube_path))
machine.exec_cmd("sudo mkdir --mode 0755 -p /etc/ansible")
machine.exec_cmd("sudo cp %s/hosts /etc/ansible/hosts" % ansiblecube_path)
......@@ -58,13 +53,11 @@ def run(machine, name, timezone, wifi_pwd, edupi, aflatoun, kalite, zim_install)
extra_vars += " own_config_file=True"
extra_vars += " managed_by_bsf=False"
ansible_pull_cmd = "sudo /usr/local/bin/ansible-pull"
ansible_pull_cmd += " --checkout oneUpdateFile0.3"
ansible_pull_cmd += " --directory /var/lib/ansible/local"
ansible_pull_cmd += " --inventory hosts"
ansible_pull_cmd += " --url https://github.com/thiolliere/ansiblecube.git"
ansible_pull_cmd += " --tags master,custom"
ansible_pull_cmd += " --extra-vars \"%s\"" % extra_vars
ansible_pull_cmd += " main.yml"
ansible_args = "--inventory hosts"
ansible_args += " --tags master,custom"
ansible_args += " --extra-vars \"%s\"" % extra_vars
ansible_args += " main.yml"
ansible_pull_cmd = "sudo sh -c 'cd {} && /usr/local/bin/ansible-playbook {}'".format(ansiblecube_path, ansible_args)
machine.exec_cmd(ansible_pull_cmd)
......@@ -17,3 +17,5 @@ pibox_logo = os.path.join(data_dir, "pibox-installer-logo.png")
raspbian_url = "http://downloads.raspberrypi.org/raspbian_lite/images/raspbian_lite-2017-03-03/2017-03-02-raspbian-jessie-lite.zip"
raspbian_zip_path = "2017-03-02-raspbian-jessie-lite.img"
ansiblecube_path = os.path.join(data_dir, "ansiblecube")
from backend import ansiblecube
from backend import qemu
from backend.util import subprocess_pretty_check_call
import data
from util import ReportHook
from datetime import datetime
import os
......@@ -67,6 +68,10 @@ def run_installation(name, timezone, language, wifi_pwd, kalite, aflatoun, edupi
# Resize filesystem
emulation.resize_fs()
ansiblecube_emulation_path = "/var/lib/ansible/local"
emulation.exec_cmd("sudo mkdir --mode 0755 -p /var/lib/ansible/")
emulation.put_dir(data.ansiblecube_path, ansiblecube_emulation_path)
# Run ansiblecube
logger.step("Run ansiblecube")
ansiblecube.run(
......@@ -77,6 +82,7 @@ def run_installation(name, timezone, language, wifi_pwd, kalite, aflatoun, edupi
kalite=kalite,
edupi=edupi,
aflatoun=aflatoun,
ansiblecube_path=ansiblecube_emulation_path,
zim_install=zim_install)
# Write ideascube configuration
......@@ -132,8 +138,6 @@ LANGUAGE_CODE = '{}'
if favicon is not None:
emulation.put_file(logo, "/usr/share/ideascube/static/branding/favicon.png")
# TODO run ideascube collect static ? how does ansiblecube does it ?
# Write image to SD Card
if sd_card:
emulator.copy_image(sd_card)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment