#!/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 775 ${WORK}/root
chown root  ${WORK}/root/Library
chown root  ${WORK}/root/Library/Fonts
chown root  ${WORK}/root/Library/Fonts/'Latin Modern' 
chmod 755 ${WORK}/root/Library
chmod 1775 ${WORK}/root/Library/Fonts
chmod 755 ${WORK}/root/Library/Fonts/'Latin Modern'
chgrp wheel ${WORK}/root/Library
chgrp admin ${WORK}/root/Library/Fonts
chgrp admin ${WORK}/root/Library/Fonts/'Latin Modern'
chown root ${WORK}/root/Library/Fonts/'Latin Modern'/*
chmod 644 ${WORK}/root/Library/Fonts/'Latin Modern'/*
chgrp admin ${WORK}/root/Library/Fonts/'Latin Modern'/*
# ------------------------------------


# Build the package!
# echo "Building the Installer package"
# /XCode2.5/Tools/packagemaker -build -p ${WORK}/Latin-Modern-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}/Latin-Modern-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}/Latin-Modern-Fonts.pkg  --target 10.5  \
# 	--root ${WORK}/root --resources ${WORK}/resources --id org.tug.mactex.latin-modern --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
######################################################


