Can not get preinstall script to work during imaging

rdagel
New Contributor II

I have a package that i want to install at imaging time that will nuke all the fonts on the image and only add back these fonts in the package. I have taken the time to find out what are the base OS fonts needed and want to remove the rest.

I have it in a PKG form so i can do a preinstall script in the package. Here is the script:

#!/bin/sh
## preinstall

pathToScript=$0
pathToPackage=$1
targetLocation=$2
targetVolume=$3

###### removes fonts in system and library level

/bin/rm -rf "/Library/Fonts/" /bin/rm -rf "/System/Library/Fonts/"

exit 0 ## Success
exit 1 ## Failure

For some reason it dose not delete the fonts. it just adds that fonts from the package. (I also gave the fonts a label so i would know what fonts where added to a computer down the road)

I have given it a priority of 20 so it is the last package to install in case any others also installed fonts.

Richard

2 REPLIES 2

tlarkin
Honored Contributor

You may want to run this post image because while netbooted it may be running the command on the netinstall/netboot image instead of the client hard drive.

-Tom

talkingmoose
Moderator
Moderator

Without knowing which fonts you're trying to delete I can only suggest
On 10/13/11 1:43 PM, "San Fran Geek" <sanfrangeek at gmail.com> wrote:
that you're running into Apple's protected fonts feature that restores
fonts to the /System folder if they're deleted. For example, deleting
certain fonts such as Helvetica from /System/Library/Fonts will result in
a dialog tell you it's a protected font and will be restored.

We gave up the battle of the System fonts and opted to stop trying to
remove/customize them. Instead, Extensis Suitcase Fusion has a feature
that will allow your versions of fonts to override the System fonts. I'm
not sure you can enable it with the GUI but you can enable this via script.

--

William Smith
Technical Analyst
Merrill Communications LLC
(651) 632-1492