Commit 6f16963d authored by iv's avatar iv

nayuos: Adding a script to /etc/run for downloading Chromium OS sources +...

nayuos: Adding a script to /etc/run for downloading Chromium OS sources + building instead of doing it during instanciation.
parent 83be4842
#!/bin/sh
#XXX: should not depend on the host's sh ^
# Download sources using the "repo" command
DL_LOG={{ instance_log_dir }}/cros_sources_dl.log
echo "getting Chromium OS sources..." >> $DL_LOG
{{ depot_tools_export_path_cmd }}
cd {{ cros_location }}
repo init -u https://chromium.googlesource.com/chromiumos/manifest.git -b {{ branch }} >> $DL_LOG
repo sync >> $DL_LOG
# Build
{{ depot_tools_export_path_cmd }}
cd {{ cros_location }}
IMAGE_LOCATION={{ board }}.img
BUILD_LOG={{ instance_log_dir }}/cros_build.log
echo "building packages for a {{ board }}-flavoured Chromium OS..." >> $BUILD_LOG \
&& cros_sdk -- ./build_packages --board={{ board }} >> $BUILD_LOG \
&& echo "building image for a {{ board }}-flavoured Chromium OS..." >> $BUILD_LOG \
&& cros_sdk -- ./build_image --board={{ board }} >> $BUILD_LOG \
&& echo "removing old image if any and creating image file {{ board }}.img..." >> $BUILD_LOG \
&& cros_sdk -- rm -f $IMAGE_LOCATION \
&& cros_sdk -- touch $IMAGE_LOCATION \
&& cros_sdk -- cros flash --board={{ board }} file://$IMAGE_LOCATION >> $BUILD_LOG
[buildout] [buildout]
parts = parts =
parameters parameters
get-chromium-sources template-full-build-script
build-chromiumos
# eggs given by software.cfg # eggs given by software.cfg
eggs-directory = {{ eggs_directory }} eggs-directory = {{ eggs_directory }}
...@@ -20,11 +19,6 @@ branch = master ...@@ -20,11 +19,6 @@ branch = master
export-path = export-path =
export PATH=${clone-depot-tools:location}:"$PATH"; export PATH=${clone-depot-tools:location}:"$PATH";
[build-commands]
env =
${depot-tools:export-path}
cd ${get-chromium-sources:location};
############################################################################################ ############################################################################################
[parameters] [parameters]
...@@ -39,31 +33,24 @@ url = ${slap_connection:server_url} ...@@ -39,31 +33,24 @@ url = ${slap_connection:server_url}
key = ${slap_connection:key_file} key = ${slap_connection:key_file}
cert = ${slap_connection:cert_file} cert = ${slap_connection:cert_file}
[get-chromium-sources] [directory]
recipe = plone.recipe.command recipe = slapos.cookbook:mkdirectory
stop-on-error = true log = ${buildout:directory}/var/log
location = ${clone-depot-tools:location}/../chromiumos run = ${buildout:directory}/etc/run
command = cros_location = ${buildout:directory}/parts/chromiumos
echo "getting Chromium OS sources..."
${depot-tools:export-path} [template-full-build-script]
mkdir ${:location} # create the instance.cfg file in the buildout directory
cd ${:location} # (use jinja for templating)
repo init -u https://chromium.googlesource.com/chromiumos/manifest.git -b ${parameters:configuration.branch} recipe = slapos.recipe.template:jinja2
repo sync template = {{ script_dir }}/cros_full_build.sh.in
update-command = rendered = ${directory:run}/cros_full_build.sh
${depot-tools:export-path} # md5sum =
cd ${:location} mode = 0770
repo sync context =
# for access to the eggs from the instance
[build-chromiumos] key instance_log_dir directory:log
recipe = plone.recipe.command key cros_location directory:cros_location
stop-on-error = true key depot_tools_export_path_cmd depot-tools:export-path
command = key branch parameters:configuration.branch
${build-commands:env} key board parameters:configuration.board
# cros_sdk --delete \ No newline at end of file
echo "building packages for Chromium OS..."
cros_sdk -- ./build_packages --board=${parameters:configuration.board}
&& cros_sdk -- ./build_image --board=${parameters:configuration.board}
&& touch $(pwd)/${parameters:configuration.board}.img
&& cros flash --board=${parameters:configuration.board} file://$(pwd)/${parameters:configuration.board}.img
\ No newline at end of file
...@@ -35,12 +35,13 @@ command = sudo -V ...@@ -35,12 +35,13 @@ command = sudo -V
recipe = slapos.recipe.template:jinja2 recipe = slapos.recipe.template:jinja2
template = ${:_profile_base_location_}/instance.cfg template = ${:_profile_base_location_}/instance.cfg
rendered = ${buildout:directory}/instance.cfg rendered = ${buildout:directory}/instance.cfg
md5sum = 2e8558f042d6790a0245c292888b35fc md5sum = 0b1a50348c080b280f95dab1817e1033
mode = 0644 mode = 0644
context = context =
# for access to the eggs from the instance # for access to the eggs from the instance
key eggs_directory buildout:eggs-directory key eggs_directory buildout:eggs-directory
key develop_eggs_directory buildout:develop-eggs-directory key develop_eggs_directory buildout:develop-eggs-directory
key script_dir :_profile_base_location_
[install-eggs-for-the-instance] [install-eggs-for-the-instance]
# after installation of the eggs, the recipes # after installation of the eggs, the recipes
......
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