#!/bin/bash

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


# ------------------------------------
# Make sure root/Library/Fonts/Latin Modern/* exists with the right permissions
chown root ${WORK}/root
chgrp wheel ${WORK}/root
chmod 755 ${WORK}/root
chown root  ${WORK}/root/Library
chown root  ${WORK}/root/Library/Fonts
chown root  ${WORK}/root/Library/Fonts/'TeX Gyre' 
chmod 755 ${WORK}/root/Library
chmod 1775 ${WORK}/root/Library/Fonts
chmod 755 ${WORK}/root/Library/Fonts/'TeX Gyre'
chgrp wheel ${WORK}/root/Library
chgrp admin ${WORK}/root/Library/Fonts
chgrp admin ${WORK}/root/Library/Fonts/'TeX Gyre'
chown root ${WORK}/root/Library/Fonts/'TeX Gyre'/*
chmod 644 ${WORK}/root/Library/Fonts/'TeX Gyre'/*
chgrp admin ${WORK}/root/Library/Fonts/'TeX Gyre'/*
# ------------------------------------


# Build the package!
echo "Building the Installer package"
# /XCode2.5/Tools/packagemaker -build -p ${WORK}/TeX-Gyre-Fonts.pkg -ds -s \
#	-f ${WORK}/root -r ${WORK}/resources -i ${WORK}/Info.plist -d ${WORK}/Description.plist
# ./../PackageMaker.app/Contents/MacOS/PackageMaker  -build -p ${WORK}/TeX-Gyre-Fonts.pkg -ds -s \
# 	-f ${WORK}/root -r ${WORK}/resources -i ${WORK}/Info.plist -d ${WORK}/Description.plist
	
#  /Developer/Applications/Utilities/PackageMaker.app/Contents/MacOS/Packagemaker   --out ${WORK}/TeX-Gyre-Fonts.pkg  --target 10.5  \
# 	--root ${WORK}/root --resources ${WORK}/resources --id org.tug.mactex.tex-gyre --verbose --no-recommend  \
#	--root-volume-only --no-relocate --scripts ${WORK}/scripts

	
######################################################
# FINALLY, PUT MY /usr/local BACK AS IT WAS
# mv -f /usr/local.save /usr/local
######################################################


