[svn-upgrade] Integrating new upstream version, jabref (2.2)
[debian/jabref.git] / src / windows / nsis / setup.nsi
1 # Auto-generated by EclipseNSIS Script Wizard
2 # 29.12.2005 01:09:51
3
4 !ifndef VERSION
5         !define VERSION "2.2"
6 !endif
7
8 !define EXENAME "JabRef-${VERSION}-Setup.exe"
9
10 Name "JabRef ${VERSION}"
11
12 !define REGKEY "SOFTWARE\$(^Name)"
13 !define COMPANY "JabRef Team"
14 !define URL http://jabref.sourceforge.net/
15
16 # MUI defines
17 !define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\modern-install-full.ico"
18 !define MUI_FINISHPAGE_NOAUTOCLOSE
19 !define MUI_STARTMENUPAGE_REGISTRY_ROOT HKLM
20 !define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\JabRef"
21 !define MUI_STARTMENUPAGE_REGISTRY_VALUENAME StartMenuGroup
22 !define MUI_STARTMENUPAGE_DEFAULT_FOLDER "JabRef ${VERSION}"
23 !define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\modern-uninstall-full.ico"
24 !define MUI_FINISHPAGE_RUN $INSTDIR/JabRef.exe
25 !define MUI_UNFINISHPAGE_NOAUTOCLOSE
26 !define MUI_COMPONENTSPAGE_SMALLDESC
27
28 # Included files
29 !include Sections.nsh
30 !include MUI.nsh
31 !include fileassoc.nsh
32
33 # Reserved Files
34
35 # Variables
36 Var StartMenuGroup
37
38 # Installer pages
39 !insertmacro MUI_PAGE_WELCOME
40 !insertmacro MUI_PAGE_LICENSE dist/GPL.txt
41 !insertmacro MUI_PAGE_DIRECTORY
42 !insertmacro MUI_PAGE_STARTMENU Application $StartMenuGroup
43 !insertmacro MUI_PAGE_COMPONENTS
44 !insertmacro MUI_PAGE_INSTFILES
45 !insertmacro MUI_PAGE_FINISH
46
47 !insertmacro MUI_UNPAGE_CONFIRM
48 !insertmacro MUI_UNPAGE_INSTFILES
49
50 # Installer languages
51 !insertmacro MUI_LANGUAGE English
52
53 # Installer attributes
54 OutFile "${EXENAME}"
55 InstallDir "$PROGRAMFILES\JabRef"
56 CRCCheck on
57 XPStyle on
58 ShowInstDetails show
59 VIProductVersion 1.3.0.0
60 VIAddVersionKey ProductName "JabRef"
61 VIAddVersionKey ProductVersion "${VERSION}"
62 VIAddVersionKey CompanyName "${COMPANY}"
63 VIAddVersionKey CompanyWebsite "${URL}"
64 VIAddVersionKey FileVersion ""
65 VIAddVersionKey FileDescription ""
66 VIAddVersionKey LegalCopyright ""
67 InstallDirRegKey HKLM "${REGKEY}" Path
68 ShowUninstDetails show
69
70 # Installer sections
71 Section -Main SEC0000
72     SetOutPath $INSTDIR
73     SetOverwrite on
74     File /r dist\*.*
75     WriteRegStr HKLM "${REGKEY}\Components" Main 1
76 SectionEnd
77
78 Section "Associate .bib with JabRef" AssociateBib
79     !insertmacro APP_ASSOCIATE "bib" "JabRef.BibTeX" "BibTeX File" "$INSTDIR\JabRef.exe,0" "Open in JabRef" "$INSTDIR\JabRef.exe $\"%1$\""
80 SectionEnd
81
82 LangString DESC_AssociateBib {LANG_ENGLISH} "Will associate files of extension .bib with JabRef."
83
84 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
85   !insertmacro MUI_DESCRIPTION_TEXT ${AssociateBib} $(DESC_AssociateBib)
86 !insertmacro MUI_FUNCTION_DESCRIPTION_END
87
88 Section "un.Associate .bib with JabRef" un.AssociateBib
89
90    !insertmacro APP_UNASSOCIATE "bib" "JabRef.BibTeX"
91
92 SectionEnd
93
94
95
96 Section -post SEC0001
97     WriteRegStr HKLM "${REGKEY}" Path $INSTDIR
98     WriteUninstaller $INSTDIR\uninstall.exe
99     !insertmacro MUI_STARTMENU_WRITE_BEGIN Application
100     SetOutPath $SMPROGRAMS\$StartMenuGroup
101     CreateShortCut "$SMPROGRAMS\$StartMenuGroup\Start $(^Name).lnk" $INSTDIR\JabRef.exe
102     CreateShortCut "$SMPROGRAMS\$StartMenuGroup\Uninstall $(^Name).lnk" $INSTDIR\uninstall.exe
103     !insertmacro MUI_STARTMENU_WRITE_END
104     WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" DisplayName "$(^Name)"
105     WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" DisplayVersion "${VERSION}"
106     WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" Publisher "${COMPANY}"
107     WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" URLInfoAbout "${URL}"
108     WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" DisplayIcon $INSTDIR\uninstall.exe
109     WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" UninstallString $INSTDIR\uninstall.exe
110     WriteRegDWORD HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" NoModify 1
111     WriteRegDWORD HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" NoRepair 1
112        
113 SectionEnd
114
115 # Macro for selecting uninstaller sections
116 !macro SELECT_UNSECTION SECTION_NAME UNSECTION_ID
117     Push $R0
118     ReadRegStr $R0 HKLM "${REGKEY}\Components" "${SECTION_NAME}"
119     StrCmp $R0 1 0 next${UNSECTION_ID}
120     !insertmacro SelectSection "${UNSECTION_ID}"
121     Goto done${UNSECTION_ID}
122 next${UNSECTION_ID}:
123     !insertmacro UnselectSection "${UNSECTION_ID}"
124 done${UNSECTION_ID}:
125     Pop $R0
126 !macroend
127
128 # Uninstaller sections
129 Section /o un.Main UNSEC0000
130     Delete /REBOOTOK $INSTDIR\jabref.jar
131     Delete /REBOOTOK $INSTDIR\JabRef.exe
132     Delete /REBOOTOK $INSTDIR\GPL.txt
133     Delete /REBOOTOK $INSTDIR\Credits.txt
134     DeleteRegValue HKLM "${REGKEY}\Components" Main
135 SectionEnd
136
137 Section un.post UNSEC0001
138     DeleteRegKey HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)"
139     Delete /REBOOTOK "$SMPROGRAMS\$StartMenuGroup\Uninstall $(^Name).lnk"
140     Delete /REBOOTOK "$SMPROGRAMS\$StartMenuGroup\Start $(^Name).lnk"
141     Delete /REBOOTOK $INSTDIR\uninstall.exe
142     DeleteRegValue HKLM "${REGKEY}" StartMenuGroup
143     DeleteRegValue HKLM "${REGKEY}" Path
144     DeleteRegKey /ifempty HKLM "${REGKEY}\Components"
145     DeleteRegKey /ifempty HKLM "${REGKEY}"
146     RMDir /REBOOTOK $SMPROGRAMS\$StartMenuGroup
147     RMDir /REBOOTOK $INSTDIR
148 SectionEnd
149
150 # Installer functions
151 Function .onInit
152     InitPluginsDir
153 FunctionEnd
154
155 # Uninstaller functions
156 Function un.onInit
157     ReadRegStr $INSTDIR HKLM "${REGKEY}" Path
158     ReadRegStr $StartMenuGroup HKLM "${REGKEY}" StartMenuGroup
159     !insertmacro SELECT_UNSECTION Main ${UNSEC0000}
160 FunctionEnd
161