changeset 1392:d16057658651

Make /mnt/init work with more/chroot-splice.sh.
author Rob Landley <rob@landley.net>
date Sun, 19 Jun 2011 21:51:42 -0500
parents 42ec661e3916
children 4770338067dc
files sources/control-images/bootstrap-skeleton/mnt/init
diffstat 1 files changed, 18 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/sources/control-images/bootstrap-skeleton/mnt/init	Fri Jun 17 13:00:17 2011 -0500
+++ b/sources/control-images/bootstrap-skeleton/mnt/init	Sun Jun 19 21:51:42 2011 -0500
@@ -6,15 +6,24 @@
 
 [ -z "$NATIVE_BUILD" ] && NATIVE_BUILD=chroot
 
-# Always chroot, because even if root filesystem is writeable it's hard to
-# tell tar to skip /proc and /sys and such without unmounting bits of the
-# host environment.
+# Is the root filesystem already writeable?
 
-setup-chroot /home/"$NATIVE_BUILD" /mnt/run-build-stages.sh
+if touch /.amiwrite 2>/dev/null && rm /.amiwrite 2>/dev/null
+then
+  # build and install stuff on the writable filesystem
+
+  /mnt/run-build-stages.sh
+else
+  # Create a new writeable chroot, build and install stuff in there
 
-if [ $? -eq 0 ]
-then
-  set_titlebar "upload tarball"
-  tar czvf "$NATIVE_BUILD".tar.gz "$NATIVE_BUILD" | dotprogress &&
-  upload_result "$NATIVE_BUILD".tar.gz
+  setup-chroot /home/"$NATIVE_BUILD" /mnt/run-build-stages.sh
+
+  # Upload a tarball of the result to the host
+
+  if [ $? -eq 0 ]
+  then
+    set_titlebar "upload tarball"
+    tar czvf "$NATIVE_BUILD".tar.gz "$NATIVE_BUILD" | dotprogress &&
+    upload_result "$NATIVE_BUILD".tar.gz
+  fi
 fi