From 382a23cae88f896f41f17414904c300754b0883a Mon Sep 17 00:00:00 2001
From: isabelle <isabelle.vallet@nexedi.com>
Date: Tue, 27 Oct 2015 14:29:15 +0000
Subject: [PATCH] nayuos: On the way to re6stnet.

---
 instance.cfg                  |  2 +-
 scripts/cros_full_build.sh.in | 20 +++++++++++++++-----
 software.cfg                  |  2 +-
 3 files changed, 17 insertions(+), 7 deletions(-)

diff --git a/instance.cfg b/instance.cfg
index 0d9f0d53..322d622f 100644
--- a/instance.cfg
+++ b/instance.cfg
@@ -48,7 +48,7 @@ scripts_dir = {{ scripts_dir }}
 recipe = slapos.recipe.template:jinja2
 template = {{ scripts_dir }}/cros_full_build.sh.in
 rendered = ${directory:run}/cros_full_build.sh
-md5sum = a698b56b99492b22f76d402d3def5774
+md5sum = 0e10850c8f9272272ed1a4cabce66529
 mode = 0770
 context =
 # for access to the eggs from the instance
diff --git a/scripts/cros_full_build.sh.in b/scripts/cros_full_build.sh.in
index ad824ee9..248fd437 100644
--- a/scripts/cros_full_build.sh.in
+++ b/scripts/cros_full_build.sh.in
@@ -17,10 +17,19 @@ cd {{ cros_location }}
 # create chroot environment (exit on failure)
 cros_sdk --download || exit 1
 
+# compile Python with sqlite support (-> change USE flag) for dev-lang/python
+# it is needed by re6st
+# just need to change -sqlite by sqlite on the right line
+PACKAGE_USE_FILE={{ cros_location }}/src/third_party/chromiumos-overlay/profiles/targets/chromeos/package.use
+line_number=$(sed -n '/dev-lang\/python/=' ${PACKAGE_USE_FILE})
+if [ $line ] ; then
+        sed -i "${line_number}s/-sqlite/sqlite/" ${PACKAGE_USE_FILE}
+fi
+
 # add custom script for modifying the final image after building
-# that is useful for custumizing Chromium OS and produce Nayu images for now
-cp {{ scripts_dir }}/modify_image.sh {{ cros_location }}/src/scripts/modify_image.sh \
-  && chmod 770 {{ cros_location }}/src/scripts/modify_image.sh || exit 1
+# that is useful for custumizing Chromium OS and producing Nayu images for now
+#cp {{ scripts_dir }}/modify_image.sh {{ cros_location }}/src/scripts/modify_image.sh \
+#  && chmod 770 {{ cros_location }}/src/scripts/modify_image.sh || exit 1
 
 # add custom ebuilds
 for category in $( ls {{ ebuilds_dir }} ); do
@@ -78,18 +87,19 @@ done
 
 ####################################### Post build ##########################################
 # keep only the substring between - as current release
-RELEASE=$(sed 's/.*-\(.*\)-.*//' <<< "$BRANCH")
+RELEASE=$(echo ${BRANCH} | cut -d- -f2)
 DIR_IMAGE_LOCATION={{ cros_location }}/images/${RELEASE}/$(date +'%F')
 install ${DIR_IMAGE_LOCATION} -d
 mv {{ cros_location }}/src/scripts/*.img ${DIR_IMAGE_LOCATION}
 
 cd ${DIR_IMAGE_LOCATION}
-for hashfunction in md5sum sha1 sha256 sh512; do
+for hashfunction in md5sum sha1sum sha256sum sha512sum; do
   ${hashfunction} *.img >> hashes.txt
 done
 
 for file in $(ls *.img); do
   tar cfz ${file}.tar ${file}
+  rm ${file}
 done
 
 exit 0
\ No newline at end of file
diff --git a/software.cfg b/software.cfg
index 3b2c0d23..3cbf5a3c 100644
--- a/software.cfg
+++ b/software.cfg
@@ -35,7 +35,7 @@ command = sudo -V
 recipe = slapos.recipe.template:jinja2
 template = ${:_profile_base_location_}/instance.cfg
 rendered = ${buildout:directory}/instance.cfg
-md5sum = fd1efcf9ad466694bde651ab52fd31c9
+md5sum = 78f4aa77239313bdc9de3907fe332bd7
 mode = 0644
 scripts_dir = ${:_profile_base_location_}/scripts
 ebuilds_dir = ${:_profile_base_location_}/custom_ebuilds
-- 
2.30.9