Fwtools.nsi
Jump to navigation
Jump to search
This is the FWTools NSIS Script circa FWTools 2.0.0. It is here as an example for work on the OSGeo Win32 Installer.
; $Id: fwtools.nsi,v 1.1 2004/11/06 18:28:10 fwarmerdam Exp $
; The name of the installer
Name "FWTools"
!define VERSION 2.0.1
!define SVERSION 201
; The file to write
OutFile "FWTools${SVERSION}.exe"
; Options
SetCompressor lzma
; The default installation directory
InstallDir $PROGRAMFILES\FWTools${VERSION}
; Registry key to check for directory (so if you install again, it will
; overwrite the old one automatically) (DISABLED)
; InstallDirRegKey HKLM "Software\FWTools" "Install_Dir"
; Declare user variables.
Var SHORTINSTDIR
;--------------------------------
; Pages
Page components
Page directory
Page instfiles
UninstPage uninstConfirm
UninstPage instfiles
;--------------------------------
/****************************************************************************/
Section "FWTools Executables (required)"
SectionIn RO
; Set output path to the installation directory.
SetOutPath $INSTDIR
GetFullPathName /SHORT $SHORTINSTDIR $INSTDIR
; Put file there
File "C:\warmerda\fwtoolsbuild\ReadMe.txt"
File "C:\warmerda\FWTools\icon.ico"
File /r "C:\warmerda\FWTools\bin"
File /r "C:\warmerda\FWTools\data"
File /r "C:\warmerda\FWTools\pics"
File /r "C:\warmerda\FWTools\proj_lib"
File /r "C:\warmerda\FWTools\pymod"
File /r "C:\warmerda\FWTools\python"
File /r "C:\warmerda\FWTools\ramps"
File /r "C:\warmerda\FWTools\tools"
File /r "C:\warmerda\FWTools\html"
File /r "C:\warmerda\FWTools\xmlconfig"
File /r "C:\warmerda\FWTools\wms"
File /r "C:\warmerda\FWTools\csharp"
;; Write out setfw.bat script.
FileOpen $0 $INSTDIR\setfw.bat w
FileWrite $0 "@echo off$\n"
FileWrite $0 "SET FWTOOLS_DIR=$SHORTINSTDIR$\n"
FileWrite $0 'call %FWTOOLS_DIR%\bin\setfwenv.bat$\n'
FileClose $0
;; Write out standalone openev.bat script.
FileOpen $0 $INSTDIR\openev.bat w
FileWrite $0 "@echo off$\n"
FileWrite $0 "set OLD_PATH=%PATH%$\n"
FileWrite $0 "SET OPENEV_HOME=$SHORTINSTDIR$\n"
FileWrite $0 "SET FWTOOLS_DIR=$SHORTINSTDIR$\n"
FileWrite $0 'call %FWTOOLS_DIR%\bin\setfwenv.bat$\n'
FileWrite $0 'start pythonw "%OPENEV_HOME%\pymod\openev.py" %*$\n'
FileWrite $0 "set PATH=%OLD_PATH%$\n"
FileClose $0
; Write the installation path into the registry
WriteRegStr HKLM "Software\FWtools" "Install_Dir" "$INSTDIR"
; Write the uninstall keys for Windows
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\FWTools${SVERSION}" "DisplayName" "FWTools ${VERSION}"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\FWTools${SVERSION}" "UninstallString" '"$INSTDIR\uninstall.exe"'
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\FWTools${SVERSION}" "NoModify" 1
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\FWTools${SVERSION}" "NoRepair" 1
WriteUninstaller "uninstall.exe"
; Start Menu group.
CreateDirectory "$SMPROGRAMS\FWTools ${VERSION}"
CreateShortCut "$SMPROGRAMS\FWTools ${VERSION}\OpenEV_FW.lnk" "$INSTDIR\openev.bat" "" "$INSTDIR\icon.ico" 0
CreateShortCut "$SMPROGRAMS\FWTools ${VERSION}\FWTools Shell.lnk" "cmd.exe" '/K "$INSTDIR\setfw.bat"'
CreateShortCut "$SMPROGRAMS\FWTools ${VERSION}\Uninstall.lnk" "$INSTDIR\uninstall.exe" "" "$INSTDIR\uninstall.exe" 0
SectionEnd
/****************************************************************************/
Section "Developer Files (*.h, *.lib)"
; Set output path to the installation directory.
SetOutPath $INSTDIR
; Put file there
File /r "C:\warmerda\FWTools\lib"
File /r "C:\warmerda\FWTools\include"
File /r "C:\warmerda\FWTools\vb6"
ExecWait '"$INSTDIR\bin\fwpostinstall.bat"'
; ExecWait '"$INSTDIR\python.exe" "$INSTDIR\pymod\fwpostinstall.py" "$INSTDIR"'
SectionEnd
/****************************************************************************/
Section "Demo Data"
SetOutPath $INSTDIR
File /r "C:\warmerda\FWTools\demo-data"
SectionEnd
/****************************************************************************/
Section "Desktop Shortcuts"
CreateShortCut "$DESKTOP\OpenEV_FW.lnk" "$INSTDIR\openev.bat" "" "$INSTDIR\icon.ico" 0
CreateShortCut "$DESKTOP\FWTools Shell.lnk" "cmd.exe" '/K "$INSTDIR\setfw.bat"'
SectionEnd
/****************************************************************************/
; Uninstaller
Section "Uninstall"
; Remove registry keys
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\FWTools${SVERSION}"
DeleteRegKey HKLM SOFTWARE\FWTools
; Remove files and uninstaller
RMDir /r /REBOOTOK "$INSTDIR"
; Remove shortcuts, if any
Delete "$DESKTOP\FWTools Shell.lnk"
Delete "$DESKTOP\OpenEV_FW.lnk"
RMDir /r "$SMPROGRAMS\FWTools ${VERSION}"
SectionEnd