view sources/native-builds/gentoo-bootstrap/build/functions.sh @ 1252:ba951c11fb48

Refactor the gentoo bootstrap build some more. Add "build" and "files" subdirectories, split each package build into a separate file, break out reusable shell functions into functions.sh. Flow control now init chrooting into run-build-stages.sh calling the individual package scripts.
author Rob Landley <rob@landley.net>
date Sat, 25 Sep 2010 13:40:04 -0500
parents
children
line wrap: on
line source

#!/bin/echo This file is sourced not run

upload_result()
{
  ftpput $FTP_SERVER -P $FTP_PORT "$1-$HOST" "$1"
}

set_titlebar()
{
  echo -en "\033]2;($HOST) $1\007"
  echo === "$1"
}

dotprogress()
{
  while read i; do echo -n .; done; echo
}

do_in_chroot()
{
  # Copy root filesystem into a new chroot directory and restart in there.

  CHROOT="$1"
  shift

  set_titlebar "Setup chroot"
  mkdir "$CHROOT"
  cp -a /mnt/files/. "$CHROOT"
  find / -xdev | cpio -m -v -p "$CHROOT" | dotprogress
  for i in mnt proc sys dev; do mount --bind /$i "$CHROOT"/$i; done

  echo Chroot
  chroot "$CHROOT" "$@"
  RC=$?

  echo Chroot cleanup
  for i in mnt proc sys dev; do umount "$CHROOT"/$i; done

  return $RC
}