William Stein wrote:
> On Jan 15, 2008 9:31 PM, jdmitchell <[EMAIL PROTECTED]> wrote:
>   
>> Hello,
>>
>> This is my first post to the developer group so please bear with me.
>> Also, I don't mean to distract you from any pressing matters so take
>> your time.
>>     
>
> Hi,
>
> I just want to remark quickly that I am very appreciative for you providing
> this, and that we've all just been very busy and haven't had a chance
> to respond.  Your contribution is actually nicely complementary to that
> of another person related to the same problem.
>
> Again, many thanks!!  And, we will get to this.
>   
Sure, it was no problem.  Just having fun tinkering is all.

I was just talking to Michael about this on IRC.  He was hoping I could 
write some documentation explaining how I made the installer.  For those 
of you running Mac OS X 10.4 (and probably greater), you should be able 
to follow along.

============================
1)  Download the dmg (disk image file) for SAGE at 
http://www.sagemath.org/SAGEbin/apple_osx/intel/sage-2.9.2-osx10.4-intel-i386-Darwin.dmg
 
and mount the image.

2)  Make an empty directory $INSTALL_FROM and copy the 'sage' directory 
on the image to $INSTALL_FROM

3)  Open /Developer/Applications/Utilities/PackageMaker.app
NOTE: I don't recall whether this particular Mac developer software is 
installed with OS X by default.  If you couldn't find it, you'll be able 
to install it from your OS X installation CD.

4)  Unless you're going to get more fancy than me, choose "Single 
Package Project".  You can customize various aspects of the installer 
here but I'll focus on the essentials.

5)  Click on the "Contents" tab and click the icon to the right of the 
text box for "Root:"  Make sure "Absolute" is checked and then click 
"Choose..."  Navigate to $INSTALL_FROM and click "Open".

6)  Click on the "Configuration" tab and then set the "Default 
Location:" to $INSTALL_TO (which I for most people would be 
/Applications).  This is all similar to `cp -R $INSTALL_FROM $INSTALL_TO`

7)  You can hide PackageMaker for a moment.  Now make a new empty 
directory $INST_RESOURCES called 'Install_resources'.  (Apple's 
documentation said that this directory should be named 
'Install_resources' and put in $INSTALL_FROM. But for some reason the 
installer didn't omit it from getting copied to $INSTALL_TO as I recall 
the documentation implied.  It will work if you put it somewhere other 
than in $INSTALL_TO.)  Write the following code to a text file called 
'postflight' in $INST_RESOURCES:

# script runs at the end of installation
# begin script
SAGE=${2}'/sage/sage'  #location of SAGE executable
echo 'Running '$SAGE
open -a /Applications/Utilities/Terminal.app $SAGE
exit 0
# end script

8)  I believe you're required to specify an 'Identifier' under the 
"Package Version" tab.

9)  Press Apple+R to build and run the installer.

10)  When the installation is nearly done, 'postflight' is executed.  
This allows the end-user to have immediate access to SAGE and it also 
gives SAGE the opportunity to hard code its install PATH.

NOTE:  If any of this doesn't seem to work as I explained it, please let 
me know.  I was just recounting this from memory.
=========================

Although this installer does a lot, it still doesn't allow the end-user 
to open SAGE simply by double clicking on 'sage' (the scripts that 
executes SAGE).  To add that functionality, the end-user still has to 
manually bind the 'sage' executable to open with Terminal.app.  This is 
done by double clicking 'sage', clicking "Choose Application..." in the 
dialogue window that comes up, changing "Recommended Applications" to 
"All Applications", navigating to /Applications/Terminal.app, clicking 
"Open", and finally [takes a breather] clicking "Update".

Ideally, this process should be simplified.  There are a number of ways 
we could do this.  Automating the manual steps I just described seems 
surprisingly difficult to do.  I'm not sure, but I think we would have 
to interact with something Apple calls LaunchServices.  If you're 
familiar with interacting with LauchServices, please share what you 
know.  A potentially more simple solution would be to write a script 
that resides in /Applications/ that uses the following command to open SAGE:

open -a /Applications/Utilities/Terminal.app '/Applications/sage/sage'

I just figured out that we can embed that command into an application by 
opening Automator.app and choosing the action "Run shell script".  
Simply write the command in the text box and click the play button to 
test it.  SAGE should open in Terminal.app.  Then save the file to 
/Applications and make sure you've set the file format to Application.  
By dissecting this .app file, we might be able to figure out how to 
embed all of SAGE in one of those fancy .app files that mac fans love so 
much.

Hope this was helpful.

-Jake

>    -- William
>
>   
>> Earlier today I downloaded 
>> http://sagemath.org/SAGEbin/apple_osx/intel/sage-2.9.2-osx10.4-intel-i386-Darwin.dmg
>> for installation on my Macbook.  When I mounted the image, I checked
>> out the 'sage-README-osx.txt' file in the 'sage' directory.  It
>> provides the following steps for installing SAGE:
>>
>> -------------------------
>>
>> 1) Download the dmg somewhere and double click on it.
>> 2) Drag the sage folder somewhere, e.g., /Applications
>> 3) Use finder to visit the sage folder you just copied it and double
>> click on the "sage" icon.
>> 4) Select to run it with "Terminal":
>>      Choose Applications, then select "All Applications" in the
>>      "Enable:" drop down.  Change the "Applications" drop down
>>      to "Utilities".  On the left, scroll and select "Terminal".
>>      Click "Open", then in the next dialog select "Update".
>> 5) SAGE should pop up in a window.
>> 6) For the graphical notebook, type
>>      notebook()
>>    and follow the directions, which are to open firefox or safari
>> (your choice)
>>    to the URL
>>        http://localhost:8000
>>    If you are on a single user machine, using inotebook() is a little
>> easier.
>> 7) Email
>>       http://groups.google.com/group/sage-support
>>    with any questions.
>>
>> -------------------------------------
>>
>> At the end it suggests that somebody could automate steps 4-6.  Well,
>> I started tinkering around because I was curious about package
>> installers in OS X.  I just finished making an installer package for
>> Intel i386 OS X 10.4 systems.  I'd like to share it, but it's about
>> 250 mb and unfortunately I don't have a server to distribute it from.
>> If anyone knows where I could post it, please let me know.
>>
>> Currently it is in the form of an Installer Package rather than a Disk
>> Image.  This means the user would just have to double click on the
>> file and go through an installation wizard to install SAGE
>> (effectively the same as steps 1-3).  Toward the end of installation,
>> a script starts SAGE in the Terminal.app so that the install PATH can
>> be hard coded (which I believe is always done when SAGE is placed in a
>> new directory).
>>
>> I still need to automate step 4 somehow, but I haven't quite figured
>> out how to tell OS X what the default program ('Terminal.app') should
>> be for a particular file ('sage').  One option might be to make a
>> separate file that the end-user would run that has the line:
>>
>> open -a /Applications/Utilities/Terminal.app '/Applications/sage/
>> sage'  # opens SAGE in Terminal.app
>>
>> It would also be possible to write another similar script that would
>> start the notebook.  Perhaps these scripts could be placed in the /
>> Applications folder for easier access.  However, this could annoy Mac
>> users who are used to most applications being in the form of a single
>> *.app file.
>>
>> Any opinions/suggestions?  Thanks.
>>
>> -Jake Mitchell
>>
>>     
>
>
>
>   

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to