view common/bootstrap/init @ 39:31d7462a8649 draft

Copy to chroot if / read-only _or_ if /home has more space. (Now that we use initramfs, / is writeable but only a few dozen megabytes free.)
author Rob Landley <rob@landley.net>
date Wed, 25 Feb 2015 00:44:24 -0600
parents bcd2e358d57f
children
line wrap: on
line source

#!/bin/bash

# Start running here, and hand off to run-build-stages.sh in chroot.

. /mnt/functions.sh

[ -z "$NATIVE_BUILD" ] && NATIVE_BUILD=chroot

# Is the root filesystem already writeable and same or more storage than /

if touch /.amiwrite 2>/dev/null && rm /.amiwrite 2>/dev/null &&
 [ $(($(stat -fc "%a*%S" /))) -ge $(($(stat -fc "%a*%S" /home))) ]
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

  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