From 7042567a443caa2c486d35ba658d28380a9958b4 Mon Sep 17 00:00:00 2001
From: iv <isabelle.vallet@nexedi.com>
Date: Fri, 6 Nov 2015 14:58:20 +0000
Subject: [PATCH] nayuos: On the way to a clean and working way to add
 re6stnet.

---
 instance.cfg                  |  5 +++--
 scripts/cros_full_build.sh.in | 16 ++++++++++++----
 scripts/modify_image.sh       | 10 ----------
 software.cfg                  |  2 +-
 4 files changed, 16 insertions(+), 17 deletions(-)
 delete mode 100644 scripts/modify_image.sh

diff --git a/instance.cfg b/instance.cfg
index fdc88c3ae..edebde16b 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 = 711901bd5da4f7edd11d711e65b14bbc
+md5sum = 5a219df73265afae234e03892079d0ce
 mode = 0770
 context =
 # for access to the eggs from the instance
@@ -59,4 +59,5 @@ context =
   key boards_list parameters:configuration.boards
   key ebuilds_dir directory:ebuilds_dir
   key scripts_dir directory:scripts_dir
-  raw nayu_packages dev-vcs/git net-misc/re6stnet
\ No newline at end of file
+  raw nayu_dev_packages net-libs/nodejs net-misc/re6stnet dev-vcs/git # would need to be in /usr/bin
+  raw nayu_dev_root chromeos-base/re6stnet-init # should be in /etc/init and /etc/re6stnet (and not /usr/local/etc/...)
\ No newline at end of file
diff --git a/scripts/cros_full_build.sh.in b/scripts/cros_full_build.sh.in
index c11bbf9c4..493b28ff7 100644
--- a/scripts/cros_full_build.sh.in
+++ b/scripts/cros_full_build.sh.in
@@ -34,17 +34,17 @@ fi
 # add custom ebuilds
 for category in $( ls {{ ebuilds_dir }} ); do
   echo ${category}
-  cp -R {{ ebuilds_dir }}/${category}/* {{ cros_location}}/src/third_party/chromiumos-overlay/${category}/
+  cp -R {{ ebuilds_dir }}/${category}/* {{ cros_location }}/src/third_party/chromiumos-overlay/${category}/
 done
 
 ### packages management ###
 
-BASE_CHROMEOS_DEV_ROOT_EBUILD={{ cros_location}}/src/third_party/chromiumos-overlay/chromeos-base/chromeos-dev-root/chromeos-dev-root-0.0.1.ebuild
-VIRTUAL_CHROMEOS_OS_DEV_EBUILD={{ cros_location}}/src/third_party/chromiumos-overlay/virtual/target-chromium-os-dev/target-chromium-os-dev-1.ebuild
+BASE_CHROMEOS_DEV_ROOT_EBUILD={{ cros_location }}/src/third_party/chromiumos-overlay/chromeos-base/chromeos-dev-root/chromeos-dev-root-0.0.1.ebuild
+VIRTUAL_CHROMEOS_OS_DEV_EBUILD={{ cros_location }}/src/third_party/chromiumos-overlay/virtual/target-chromium-os-dev/target-chromium-os-dev-1.ebuild
 
 # change the virtual ebuild responsible for installing all packages to add the ones 
 # needed for NayuOS
-for package in {{ nayu_packages }} ; do
+for package in {{ nayu_dev_packages }} ; do
   if cat ${VIRTUAL_CHROMEOS_OS_DEV_EBUILD} | grep ${package} ; then
     echo "no need to change ${VIRTUAL_CHROMEOS_OS_DEV_EBUILD} file to add ${package}..." >> "${BUILD_LOG}"
   else
@@ -55,6 +55,14 @@ done
 # do not install the Upstart init script that starts ssh daemon at boot time
 sed -i '/openssh-server-init/ d' ${BASE_CHROMEOS_DEV_ROOT_EBUILD}
 
+for package in {{ nayu_dev_root }} ; do
+  if cat ${BASE_CHROMEOS_DEV_ROOT_EBUILD} | grep ${package} ; then
+    echo "no need to change ${BASE_CHROMEOS_DEV_ROOT_EBUILD} file to add ${package}..." >> "${BUILD_LOG}"
+  else
+    printf "\n\nRDEPEND=\"\${RDEPEND}\n          ${package}\"\n">> ${BASE_CHROMEOS_DEV_ROOT_EBUILD}
+  fi
+done
+
 ######################################## Build ##############################################
 BOARDS="{{ boards_list }}"
 
diff --git a/scripts/modify_image.sh b/scripts/modify_image.sh
deleted file mode 100644
index 936e7421e..000000000
--- a/scripts/modify_image.sh
+++ /dev/null
@@ -1,10 +0,0 @@
-#! /bin/bash
-
-# This script will modify all the images produced after running it for the given board,
-# that is given as first parameter
-BOARD=$1
-
-./mount_gpt_image.sh -f $( ./get_latest_image.sh --board=${BOARD} )
-sudo rm /tmp/m/etc/init/openssh-server.conf
-sudo emerge-${BOARD} --root=/tmp/m --root-deps=rdeps --usepkgonly git babeld-re6stnet re6stnet
-./mount_gpt_image.sh -f $( ./get_latest_image.sh --board=${BOARD} ) -u
\ No newline at end of file
diff --git a/software.cfg b/software.cfg
index 463932e48..268e06ad2 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 = 274271cee06f175653ff20f351cc5c65
+md5sum = e58fa5979e33e93c42cb8605033322c6
 mode = 0644
 scripts_dir = ${:_profile_base_location_}/scripts
 ebuilds_dir = ${:_profile_base_location_}/custom_ebuilds
-- 
2.30.9