;------------------------------------------------------------- ; $Id: install_gamap.pro,v 1.1 1999/03/24 04:17:41 mgs Exp $ ;+ ; NAME: ; INSTALL_GAMAP ; ; PURPOSE: ; Installation routine for GAMAP. Installs GAMAP for ; first time users or makes a semi-intelligent upgrade. ; ; CATEGORY: ; Installation ; ; CALLING SEQUENCE: ; INSTALL_GAMAP [,targetdir[,toolsdir]] [/latest] ; ; INPUTS: ; TARGETDIR -> Name of the directory to install GAMAP into. ; Default is ~/IDL/gamap ; ; TOOLSDIR -> Name of the directory to install GAMAP into. ; Default is ~/IDL/tools. ; ; KEYWORD PARAMETERS: ; /LATEST -> By default, install will copy the latest stable ; Release of GAMAP into the users' directory. Use this ; keyword to get a possibly newer experimental version. ; ; /TOOLS_ONLY -> Do not install GAMAP but only the latest tool ; versions. ; ; OUTPUTS: ; ; SUBROUTINES: ; ; REQUIREMENTS: ; Uses the generic install.pro from the tools directory. For ; best performance there should be a local link to install.pro. ; ; NOTES: ; This program may overwrite several files if the target and ; tools directories already exist. A backup of all files will ; be performed before anything is copied. To restore the old ; state of your system, simply delete all files in the target ; and tools directory and move the contents of the latest ; BACKUP* directory to .. (i.e. the target or tools directory). ; ; INSTALL_GAMAP requires that all programs that may need to be updated ; have at least one stable version stored in the RCS system ; (see man rcs, use of -s). ; ; The program automatically links to the Master directories during ; the installation and produces a log file. ; ; EXAMPLE: ; Install_GAMAP ; will perform standard installation ; ; Install_GAMAP,/Latest ; make sure you get the latest kick ; ; (but at your own risk!) ; ; MODIFICATION HISTORY: ; mgs, 22 Jan 1999: VERSION 1.00 ; mgs, 25 Jan 1999: - now uses generic install.pro routine ; ;- ; Copyright (C) 1999, Martin Schultz, Harvard University ; This software is provided as is without any warranty ; whatsoever. It may be freely used, copied or distributed ; for non-commercial purposes. This copyright notice must be ; kept with any copy of this software. If this software shall ; be used commercially or sold as part of a larger package, ; please contact the author to arrange payment. ; Bugs and comments should be directed to mgs@io.harvard.edu ; with subject "IDL routine install" ;------------------------------------------------------------- pro install_gamap,targetdir,toolsdir,latest=latest,tools_only=tools_only FORWARD_FUNCTION yesno,mfindfile resolve_routine,'yesno',/IS_FUNCTION ; Get default for targetdir and see if it already exists if (n_elements(targetdir) eq 0) then targetdir = '~/IDL/gamap' if (n_elements(toolsdir) eq 0) then toolsdir = '~/IDL/tools' ; #### FOR TESTING !!! #### ; if (n_elements(targetdir) eq 0) then targetdir = '~/tmp/gamap' ; if (n_elements(toolsdir) eq 0) then toolsdir = '~/tmp/tools' ; ========================================================= ; Welcome message ; ========================================================= print print,' ================================================= ' print print,'This is the GAMAP installation program.' print,'It will copy all the files required to run GAMAP.' print,'This includes a number of tools which will also' print,'be installed or upgraded.' print,'If you already installed a previous version of GAMAP,' print,'this installation program will create a backup copy' print,'for you.' print print,'If you call INSTALL_GAMAP without any parameters, it will' print,'install the latest stable version of GAMAP and tools' print,'in ~/IDL/gamap and ~/IDL/tools (Note: the ~/IDL' print,'directory must exist).' print,'Alternatively, you can specify the destination directories' print,'as INSTALL_GAMAP,,.' print,'Other options are:' print,' INSTALL_GAMAP,/latest which will install the latest' print,' working version and' print,' INSTALL_GAMAP,/tools_only which will only update' print,' your tools files.' print ch='' read,ch,prompt='press ENTER to continue ...' print print,'During the installation process, there may be a couple' print,'of error messages from (Unix) ls. These can be safely' print,'ignored (I just did not know ho wto prevent them).' print print,'You chose the following options:' print,' GAMAP directory : ',targetdir print,' TOOLS directory : ',toolsdir if (keyword_set(latest)) then istr = 'experimental' $ else istr = 'stable' print,' installation of the latest '+istr+' version' if (keyword_set(tools_only)) then $ print,'Installation/upgrade of TOOLS only.' $ else $ print,'Complete installation/upgrade.' print print,'Journal file : ~/install_gamap.log' if (not yesno('Do you wish to proceed?',def=1)) then return print ; ========================================================= ; Open a journal file for the installation log ; This will always be written to the user's home directory ; because we don't know whether the target dir exists. ; ========================================================= journal,'~/install_gamap.log' journal,'Target directory : '+targetdir journal,'Tools directory : '+toolsdir journal,'' ; The following links point to the GAMAP master directory ; !! Do NOT CHANGE !! GAMAP_HOME = '~mgs/IDL/gamap' TOOLS_HOME = '~mgs/IDL/tools' journal,'GAMAP_HOME : '+GAMAP_HOME journal,'TOOLS_HOME : '+TOOLS_HOME journal,'' r_attr = '-sStab' if (keyword_set(latest) ) then r_attr = '' if (keyword_set(tools_only)) then goto,do_tools ; ========================================================= ; Handle GAMAP program files ; ========================================================= print,'Installing/Updating GAMAP program files ...' install,targetdir,GAMAP_HOME,filemask='*.pro',/RCS,R_Attribute=R_Attr print ; Copy the documentation file ; Since BACKUP was already made, we don't need to do it again install,targetdir,GAMAP_HOME,filemask='gamap.pdf',/NO_BACKUP ; ========================================================= ; Handle GAMAP dat files and gamap.defaults ; ========================================================= ; Test if any *.dat files in target directory CopyDat = 1 test = mfindfile(targetdir+'/*.dat') if (test[0] ne '') then begin ; list available *.dat files in GAMAP_HOME print,'--------------------------------------------------------' print print,'Local versions of *.dat files:' spawn,'ls -l '+targetdir+'/*.dat' print print,'Master versions of *.dat files:' spawn,'ls -l '+GAMAP_HOME+'/*.dat' CopyDat=YesNo('Overwrite local *.dat files?') endif if (CopyDat) then install,targetdir,GAMAP_HOME,filemask='*.dat',/NO_BACKUP ; Test if gamap.defaults file in target directory CopyDat = 1 test = mfindfile(targetdir+'/gamap.defaults') if (test[0] ne '') then begin ; list master version of gamap.defaults in GAMAP_HOME print,'--------------------------------------------------------' print print,'Local version of gamap.defaults:' spawn,'ls -l '+targetdir+'/gamap.defaults' print print,'Master version of gamap.defaults:' spawn,'ls -l '+GAMAP_HOME+'/gamap.defaults' CopyDat=YesNo('Overwrite local gamap.defaults file?') endif if (CopyDat) then $ install,targetdir,GAMAP_HOME,filemask='gamap.defaults',/NO_BACKUP print print,'--------------------------------------------------------' print print,'All generic GAMAP files have been installed now.' print,'There may be other programs (tools) that you need to update' print,'in order to run GAMAP properly.' print print,'If you answer YES to the following question, your old' print,'tools files will be backed up automatically.' print ; ========================================================= ; Handle TOOLS files ; ========================================================= ans = YesNo('Do you wish to update or install the tools?',def=1) if (not ans) then begin print print,'Installation completed. If you encounter problems, ' print,'please install the updated tools before complaining!' print goto,finished endif do_tools: no_backup = (targetdir eq toolsdir AND keyword_set(tools_only) ) install,toolsdir,TOOLS_HOME,listfile=GAMAP_HOME+'/tools.list', $ /RCS,R_Attribute=R_Attr,NO_BACKUP=NO_BACKUP finished: ; Ask user to update his PATH variable in startup file print print,'---------------------------------------------------------------' print print,'IMPORTANT : Please make sure you have your GAMAP and TOOLS' print,'directories added to the IDL !PATH variable! Best is to' print,'add them up front in your startup file (usually idl_startup.pro).' print print,'Example:' print," !PATH = '"+toolsdir+":"+targetdir+":'+!PATH " print print,'===================== END OF INSTALL =========================' ; close journal file journal return end