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