Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Shell Script produces Error in Installer, but not in Terminal



Hello,

I'm trying to have an installer package move earlier versions of the just-installed software into the trash. To this end, I wrote the following shell script, which is executed after installing:

#!/bin/tcsh
if test -d "$2/Xkeys.app"; then
mv "$2/Xkeys.app" ~/.Trash/Xkeys.app
fi
exit 0

Notes: Xkeys.app is the name of the old install. $2 is the path of the folder the application was installed into, typically /Applications. The new installation resides in a folder, and so can't directly overwrite the old one.

When I have Installer process the package, I get the following error at the end: "There were errors installing the software".

Running the script without the if clause works fine, but only if the file actually exists, else the same error appears. (exit 0 doesn't seem to mean much.) Running the script from the command line ( sh postflight whatever /Applications ) works fine.

But the installer dislikes it. I don't know a lot about shell scripts, so I might be making an obvious error here. I'd be very grateful if somebody with some more experience could help me with this, because I'm running out of syntactic permutations to try.

Regards,

David Stark

email@hidden
http://www.zarkonnen.com
_______________________________________________
projectbuilder-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/projectbuilder-users
Do not post admin requests to the list. They will be ignored.



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.