| 1 |
; example2.nsi |
| 2 |
; |
| 3 |
; This script is based on example1.nsi, but it remembers the directory, |
| 4 |
; has uninstall support and (optionally) installs start menu shortcuts. |
| 5 |
; |
| 6 |
; It will install example2.nsi into a directory that the user selects, |
| 7 |
|
| 8 |
;-------------------------------- |
| 9 |
|
| 10 |
; The name of the installer |
| 11 |
Name "ASCEND PyGTK" |
| 12 |
|
| 13 |
; The file to write |
| 14 |
!ifdef OUTFILE |
| 15 |
OutFile ${OUTFILE}.exe |
| 16 |
!else |
| 17 |
OutFile ascend-setup.exe |
| 18 |
!endif |
| 19 |
|
| 20 |
|
| 21 |
SetCompressor /SOLID lzma |
| 22 |
|
| 23 |
; The default installation directory |
| 24 |
InstallDir $PROGRAMFILES\ASCEND |
| 25 |
|
| 26 |
; Registry key to check for directory (so if you install again, it will |
| 27 |
; overwrite the old one automatically) |
| 28 |
InstallDirRegKey HKLM "Software\ASCEND" "Install_Dir" |
| 29 |
|
| 30 |
;-------------------------------- |
| 31 |
|
| 32 |
; Pages |
| 33 |
|
| 34 |
Page components |
| 35 |
Page directory |
| 36 |
Page instfiles |
| 37 |
|
| 38 |
UninstPage uninstConfirm |
| 39 |
UninstPage instfiles |
| 40 |
|
| 41 |
;-------------------------------- |
| 42 |
|
| 43 |
; The stuff to install |
| 44 |
Section "ASCEND (required)" |
| 45 |
|
| 46 |
SectionIn RO |
| 47 |
|
| 48 |
; Set output path to the installation directory. |
| 49 |
SetOutPath $INSTDIR |
| 50 |
|
| 51 |
; Python interface |
| 52 |
File "_ascpy.dll" |
| 53 |
File "..\ascend.dll" |
| 54 |
File "config.py" |
| 55 |
File "*.py" |
| 56 |
SetOutPath $INSTDIR\glade |
| 57 |
File "glade\*.glade" |
| 58 |
File "glade\*.png" |
| 59 |
|
| 60 |
; Model Library |
| 61 |
SetOutPath $INSTDIR\models |
| 62 |
File /r /x .svn "..\models\*.a4*" |
| 63 |
File /r /x .svn "..\models\*.bz2" |
| 64 |
|
| 65 |
; Tcl/Tk interface |
| 66 |
SetOutPath $INSTDIR\tcltk |
| 67 |
File /r /x .svn "..\tcltk\TK\*" |
| 68 |
SetOutPath $INSTDIR |
| 69 |
File "..\tcltk\generic\interface\ascendtcl.dll" |
| 70 |
File "..\tcltk\generic\interface\ascend4.exe" |
| 71 |
|
| 72 |
SetOutPath $INSTDIR |
| 73 |
File "Makefile.bt" |
| 74 |
File "ascend.syn" |
| 75 |
|
| 76 |
; Set 'librarypath' in .ascend.ini |
| 77 |
WriteINIstr $APPDATA\.ascend.ini Directories librarypath "$DOCUMENTS\ascdata;$INSTDIR\models" |
| 78 |
|
| 79 |
; Create 'ascend.bat' launcher for PyGTK interface |
| 80 |
ClearErrors |
| 81 |
FileOpen $0 $INSTDIR\ascend.bat w |
| 82 |
IfErrors done |
| 83 |
FileWrite $0 "@echo off" |
| 84 |
FileWriteByte $0 "13" |
| 85 |
FileWriteByte $0 "10" |
| 86 |
FileWrite $0 "set PATH=c:\Python24;c:\GTK\bin" |
| 87 |
FileWriteByte $0 "13" |
| 88 |
FileWriteByte $0 "10" |
| 89 |
FileWrite $0 "cd " |
| 90 |
FileWrite $0 $INSTDIR |
| 91 |
FileWriteByte $0 "13" |
| 92 |
FileWriteByte $0 "10" |
| 93 |
FileWrite $0 "c:\Python24\python gtkbrowser.py %1 %2 %3 %4 %5 %6 %7 %8" |
| 94 |
FileWriteByte $0 "13" |
| 95 |
FileWriteByte $0 "10" |
| 96 |
|
| 97 |
FileClose $0 |
| 98 |
done: |
| 99 |
|
| 100 |
; Write the installation path into the registry |
| 101 |
WriteRegStr HKLM SOFTWARE\ASCEND "Install_Dir" "$INSTDIR" |
| 102 |
|
| 103 |
; Write the uninstall keys for Windows |
| 104 |
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\ASCEND" "DisplayName" "ASCEND Simulation Environment" |
| 105 |
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\ASCEND" "UninstallString" '"$INSTDIR\uninstall.exe"' |
| 106 |
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\ASCEND" "NoModify" 1 |
| 107 |
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\ASCEND" "NoRepair" 1 |
| 108 |
WriteUninstaller "uninstall.exe" |
| 109 |
|
| 110 |
SectionEnd |
| 111 |
|
| 112 |
; Optional section (can be disabled by the user) |
| 113 |
Section "Start Menu Shortcuts" |
| 114 |
|
| 115 |
CreateDirectory "$SMPROGRAMS\ASCEND" |
| 116 |
CreateShortCut "$SMPROGRAMS\ASCEND\Uninstall.lnk" "$INSTDIR\uninstall.exe" "" "$INSTDIR\uninstall.exe" 0 |
| 117 |
CreateShortCut "$SMPROGRAMS\ASCEND\ASCEND.lnk" "$INSTDIR\ascend.bat" "" "$INSTDIR\ascend.bat" 0 |
| 118 |
CreateShortCut "$SMPROGRAMS\ASCEND\ASCEND Tcl/Tk.lnk" "$INSTDIR\ascend4.exe" "" "$INSTDIR\ascend4.exe" 0 |
| 119 |
|
| 120 |
SectionEnd |
| 121 |
|
| 122 |
;-------------------------------- |
| 123 |
|
| 124 |
; Uninstaller |
| 125 |
|
| 126 |
Section "Uninstall" |
| 127 |
|
| 128 |
; Remove registry keys |
| 129 |
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\ASCEND" |
| 130 |
DeleteRegKey HKLM SOFTWARE\ASCEND |
| 131 |
|
| 132 |
; Remove files and uninstaller |
| 133 |
Delete $INSTDIR\_ascpy.dll |
| 134 |
Delete $INSTDIR\ascendtcl.dll |
| 135 |
Delete $INSTDIR\ascend.dll |
| 136 |
Delete $INSTDIR\ascend.bat |
| 137 |
Delete $INSTDIR\*.py |
| 138 |
Delete $INSTDIR\glade\* |
| 139 |
Delete $INSTDIR\Makefile.bt |
| 140 |
Delete $INSTDIR\ascend.syn |
| 141 |
Delete $INSTDIR\models\* |
| 142 |
Delete $INSTDIR\models\johnpye\* |
| 143 |
RMDir /r $INSTDIR\tcltk |
| 144 |
RMDir $INSTDIR\models\johnpye |
| 145 |
RMDIR $INSTDIR\models |
| 146 |
|
| 147 |
; Remove shortcuts, if any |
| 148 |
Delete "$SMPROGRAMS\ASCEND\*.*" |
| 149 |
|
| 150 |
; Remove directories used |
| 151 |
RMDir "$SMPROGRAMS\ASCEND" |
| 152 |
RMDir "$INSTDIR" |
| 153 |
|
| 154 |
SectionEnd |