#!/bin/sh
#
# Script to make a CUPS root compatible with the darwinup command.  Standard
# instructions for people getting these roots are:
#
#    sudo darwinup install ~/Desktop/cups-LABEL
#    sudo killall cupsd
#    cupsctl --debug-logging
#
# Usage:
#
#   makedarwinup radar-number-or-label
#

if test $# != 1; then
	echo "Usage: makedarwinup radar-number-or-label"
	exit 1
fi

buildit -update PrevailingLobo -project cups -arch i386 -arch x86_64 -archive -archiveName cups-$1 -archiveOutputDir ~/Desktop -dsymsInDstroot -buildAllAliases -noverify . || exit 1
rm -f ~/Desktop/Shared_cups-$1_HDRDSTROOT_osx.tar.gz
mv -f ~/Desktop/Shared_cups-$1_DSTROOT_osx.tar.gz ~/Desktop/cups-$1.tar.gz

echo "Send ~/Desktop/cups-$1.tar.gz to tester."
echo ""
echo "Use the following commands to install the root:"
echo ""
echo "  sudo darwinup install ~/Desktop/cups-$1.tar.gz"
echo "  sudo killall cupsd"
echo "  cupsctl --debug-logging"
echo ""
echo "Use the following commands to remove the root:"
echo ""
echo "  sudo darwinup uninstall cups-$1.tar.gz"
echo "  sudo killall cupsd"
