view common/bootstrap/run-build-stages.sh @ 33:a051c841d782

Add command recording ability (via record-commands wrapper).
author Rob Landley <rob@landley.net>
date Fri, 22 Mar 2013 22:54:03 -0500
parents a90ac7ed5d64
children
line wrap: on
line source

#!/bin/sh

# Run each of the individual package build files, in order.

[ -z "$MANIFEST" ] && MANIFEST=/usr/src/packages
touch "$MANIFEST"
  
[ -z "$FILTER" ] || FILTER="/$FILTER/d"
PACKAGES="$(sed -r -e "$FILTER" -e "s@#.*@@" /mnt/package-list)"
PACKAGECOUNT=$(echo "$PACKAGES" | wc -w)
X=0
for i in $PACKAGES
do
  X=$(($X+1))
  if [ -z "$FORCE" ] && grep -q "$i" "$MANIFEST"
  then
    echo "$i already installed"
    continue
  fi
  if [ ! -z "$RECORD" ]
  then
    [ "${RECORD:0:1}" != "," ] && RECORD=",$RECORD"
    if [ "$RECORD" == ,all ] || [ "$RECORD" != "${RECORD/,$i/}" ]
    then
      echo recording commands for $i
      export RECORD_COMMANDS=record-commands
    else
      RECORD_COMMANDS=
    fi
  fi
  X_OF_Y="($X of $PACKAGECOUNT)" /mnt/build-one-package.sh "$i" || exit 1
  
  sed -i -e "/$i/d" "$MANIFEST" &&
  echo "$i" >> "$MANIFEST" || exit 1
done