Mailing Lists: Apple Mailing Lists

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

RE: Package maker



> I have seen some cool installers which actually use PackageMaker but make
it
> interactive. I actually Had one that popped up a window prompting me for
> some information! I was impressed. I can't for the life of me remember
what
> it was. Any clues? Suggestions?

AppleScript is your friend. I needed to get a server hostname during
install, and came up with this:


PackageName.pre_install:

#!/bin/tcsh
set hostname = `"$PACKAGE_PATH/Contents/Resources/getserver"`
echo $hostname > /tmp/ServerHost.dat


PackageName.pre_upgrade:

#!/bin/tcsh
set oldhost = `cat /old/config/file`
set hostname = `"$PACKAGE_PATH/Contents/Resources/getserver" $oldhost`
echo $hostname > /tmp/ServerHost.dat


getserver:

#!/bin/tcsh
/usr/bin/osascript <<END
beep
tell application "Installer"
activate
set reply to (display dialog "Enter the hostname of your server.\r\rPress
None if you will not be using network rendering." default answer "$1"
buttons {"OK", "None"} default button "OK")
set res to (button returned of reply) as string
set hostn to (text returned of reply) as string
if res = "None" then set hostn to ""
end tell
return hostn
END


PackageName.post_install and .post_upgrade:

#!/bin/tcsh
set hostname = `cat /tmp/ServerHost.dat`
rm /tmp/ServerHost.dat
if ( $hostname != "" ) then
# Do something usefuls with $hostname
endif


Hope this helps

Phil
_______________________________________________
darwin-development mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/darwin-development
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.