view build.sh @ 40:ef471ef37665 draft default tip

Yank reliance on ash.
author Rob Landley <rob@landley.net>
date Sat, 18 Jul 2015 01:39:24 -0500
parents 676e1b843ee4
children
line wrap: on
line source

#!/bin/bash

if [ "$1" != "all" ] && [ ! -d "images/$1" ]
then
  echo 'Available images (or "all"):'
  ls images
  exit 1
fi

build_control_image()
{
  (
    IMAGENAME="$1"
    MYDIR=$(readlink -f images/"$1")
    BUILDER="$MYDIR"/build.sh
    [ -e "$BUILDER" ] || BUILDER=common/builder.sh

    source common/include.sh &&
    source $BUILDER &&
    squash_image
  )
}

if [ -z "$(which mksquashfs)" ]
then
  echo "no mksquashfs in \$PATH"
  exit 1
fi

if [ "$1" != all ]
then
  build_control_image "$1"
else
  for i in $(ls images)
  do
    echo "=== Checking $i"
    [ -e build/$i.hdc ] && echo "build/$i.hdc exists" && continue
    build_control_image "$i" || exit 1
  done
fi