#!/bin/sh
# makeworld.sh
# v1.1 by Jason

# Very simple make world script for splack
# Steps through all the disk sets and packages, and builds
# each package's SlackBuild (if it exists).

# WARNING:  Do not rely on this script!  It has several problems.
# - It will bypass any directory not containing a SlackBuild (i.e.
#   "build"-based packages and hand-assembled packages).
# - It will build faulty tgz files for packages that have b0rked SlackBuilds.
# - There's no warning that a SlackBuild may have failed.
# - It will hang on SlackBuilds that require user input
#   (stunnel, kernel-scsi, probably others I'm forgetting).
# - It doesn't seperate built packages into disksets.  :-)

# Revision history:
# 1.1:  Added source-in-diskset requirement.
# 1.0:  Initial release.

# TODO:
# Make it play nice with Slacktrack?



mkdir -p /tmp/SlackBuildLogs

for DISKSET in *; do
  ( cd $DISKSET;

  for SlackBuild in */*SlackBuild; do 
    DIRNAME=`dirname $SlackBuild`;
    echo "Building $DIRNAME..."
    rm -f /tmp/SlackBuildLogs/$DIRNAME.*;

    ( cd $DIRNAME
      sh ../$SlackBuild \
        1> /tmp/SlackBuildLogs/$DIRNAME.msg \
        2> /tmp/SlackBuildLogs/$DIRNAME.err
    );
  done
  )

done


