#!/bin/bash

LEOPARDTOOLS=NO

######################################################
# Manual preparation before running this...
#
# SAVE ORIGINAL /usr/local AND MOVE IT OUT OF THE WAY
# mv /usr/local /usr/local.save
#
# #
######################################################

# We're going to run this in the MacTeXDVD working directory...
WORK=`pwd`

# echo "Removing old file tree at ${WORK}/root"
rm -rf ${WORK}/root

# Create root

mkdir -p ${WORK}/root/usr/local/bin
cd ${WORK}/root/usr/local/bin
ln -s /Library/TeX/scripts/texdist texdist
cd ${WORK}
chown -R root ${WORK}/root
chgrp -R wheel ${WORK}/root
chmod -R 755 ${WORK}/root
 

# Build the package!
# echo "Building the Installer package"
# cd ${WORK}
# ./../PackageMaker.app/Contents/MacOS/PackageMaker  -build -p ${WORK}/FixMacTeX2012.pkg -ds -s \
# 	-f ${WORK}/root -r ${WORK}/resources -i ${WORK}/Info.plist -d ${WORK}/Description.plist


# echo "Building the Installer package"
#  /Developer/Applications/Utilities/PackageMaker.app/Contents/MacOS/Packagemaker   --out ${WORK}/FixMacTeX2012.pkg  --target 10.5  \
# 	--root ${WORK}/root --resources ${WORK}/resources --id org.tug.mactex.fixmactex2012  --verbose --no-recommend  \
# 	--root-volume-only --no-relocate --scripts ${WORK}/scripts
