A quickly written NSIS install script, not yet decided whether it will be used.
[wammu.git] / wammu.nsi
blob3529ffef34f14822ed3bbbfc315e2aa65a190cae
1 ; Script generated by the HM NIS Edit Script Wizard.
2 ; This script is for Unicode version of NSIS (http://www.scratchpaper.com/).
4 ; HM NIS Edit Wizard helper defines
5 !define PRODUCT_NAME "Wammu"
6 !define PRODUCT_INST_NAME "wammu"
7 !define PRODUCT_EXE_NAME "wammu.exe"
8 !define PRODUCT_VERSION "0.30"
9 !define PRODUCT_PUBLISHER "Michal Čihař"
10 !define PRODUCT_WEB_SITE "http://wammu.eu/"
11 !define PRODUCT_SUPPORT_SITE "http://wammu.eu/support/"
12 !define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\${PRODUCT_EXE_NAME}"
13 !define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
14 !define PRODUCT_UNINST_ROOT_KEY "HKLM"
15 !define PRODUCT_STARTMENU_REGVAL "NSIS:StartMenuDir"
17 SetCompressor /SOLID lzma
19 ; MUI 1.67 compatible ------
20 !include "MUI.nsh"
22 ; MUI Settings
23 !define MUI_ABORTWARNING
24 !define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\modern-install.ico"
25 !define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\modern-uninstall.ico"
27 ; Language Selection Dialog Settings
28 !define MUI_LANGDLL_REGISTRY_ROOT "${PRODUCT_UNINST_ROOT_KEY}"
29 !define MUI_LANGDLL_REGISTRY_KEY "${PRODUCT_UNINST_KEY}"
30 !define MUI_LANGDLL_REGISTRY_VALUENAME "NSIS:Language"
32 ; Welcome page
33 !insertmacro MUI_PAGE_WELCOME
34 ; License page
35 !insertmacro MUI_PAGE_LICENSE "COPYING"
36 ; Components page
37 !insertmacro MUI_PAGE_COMPONENTS
38 ; Directory page
39 !insertmacro MUI_PAGE_DIRECTORY
40 ; Start menu page
41 var ICONS_GROUP
42 !define MUI_STARTMENUPAGE_NODISABLE
43 !define MUI_STARTMENUPAGE_DEFAULTFOLDER "Wammu"
44 !define MUI_STARTMENUPAGE_REGISTRY_ROOT "${PRODUCT_UNINST_ROOT_KEY}"
45 !define MUI_STARTMENUPAGE_REGISTRY_KEY "${PRODUCT_UNINST_KEY}"
46 !define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "${PRODUCT_STARTMENU_REGVAL}"
47 !insertmacro MUI_PAGE_STARTMENU Application $ICONS_GROUP
48 ; Instfiles page
49 !insertmacro MUI_PAGE_INSTFILES
50 ; Finish page
51 !define MUI_FINISHPAGE_RUN "$INSTDIR\${PRODUCT_EXE_NAME}"
52 !insertmacro MUI_PAGE_FINISH
54 ; Uninstaller pages
55 !insertmacro MUI_UNPAGE_CONFIRM
56 !insertmacro MUI_UNPAGE_INSTFILES
58 ; Language files
59 !insertmacro MUI_LANGUAGE "Danish"
60 !insertmacro MUI_LANGUAGE "German"
61 !insertmacro MUI_LANGUAGE "Czech"
62 !insertmacro MUI_LANGUAGE "Norwegian"
64 ; Reserve files
65 !insertmacro MUI_RESERVEFILE_INSTALLOPTIONS
66 !insertmacro MUI_RESERVEFILE_LANGDLL
68 ; MUI end ------
70 Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
71 OutFile "${PRODUCT_INST_NAME}-${PRODUCT_VERSION}-setup.exe"
72 InstallDir "$PROGRAMFILES\${PRODUCT_NAME}"
73 InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}" ""
74 ShowInstDetails show
75 ShowUnInstDetails show
77 Function .onInit
78 !insertmacro MUI_LANGDLL_DISPLAY
79 FunctionEnd
81 Section "Program" SEC01
82 SetOutPath "$INSTDIR"
83 SetOverwrite ifnewer
84 File /r /x locale dist\*.*
86 ; Shortcuts
87 !insertmacro MUI_STARTMENU_WRITE_BEGIN Application
88 CreateDirectory "$SMPROGRAMS\$ICONS_GROUP"
89 CreateShortCut "$SMPROGRAMS\$ICONS_GROUP\${PRODUCT_NAME}.lnk" "$INSTDIR\${PRODUCT_EXE_NAME}"
90 CreateShortCut "$DESKTOP\Wammu.lnk" "$INSTDIR\${PRODUCT_EXE_NAME}"
91 !insertmacro MUI_STARTMENU_WRITE_END
92 SectionEnd
94 Section "Locales" SEC02
95 SetOutPath "$INSTDIR/share/locale/"
96 File /r dist\share\locale\*.*
98 ; Shortcuts
99 !insertmacro MUI_STARTMENU_WRITE_BEGIN Application
100 !insertmacro MUI_STARTMENU_WRITE_END
101 SectionEnd
103 Section -AdditionalIcons
104 !insertmacro MUI_STARTMENU_WRITE_BEGIN Application
105 WriteIniStr "$INSTDIR\${PRODUCT_NAME}.url" "InternetShortcut" "URL" "${PRODUCT_WEB_SITE}"
106 CreateShortCut "$SMPROGRAMS\$ICONS_GROUP\Website.lnk" "$INSTDIR\${PRODUCT_NAME}.url"
107 CreateShortCut "$SMPROGRAMS\$ICONS_GROUP\Uninstall.lnk" "$INSTDIR\uninst.exe"
108 !insertmacro MUI_STARTMENU_WRITE_END
109 SectionEnd
111 Section -Post
112 WriteUninstaller "$INSTDIR\uninst.exe"
113 WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "" "$INSTDIR\${PRODUCT_EXE_NAME}"
114 WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "$(^Name)"
115 WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\uninst.exe"
116 WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayIcon" "$INSTDIR\${PRODUCT_EXE_NAME}"
117 WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}"
118 WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "URLInfoAbout" "${PRODUCT_WEB_SITE}"
119 WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "HelpLink" "${PRODUCT_SUPPORT_SITE}"
120 WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "Publisher" "${PRODUCT_PUBLISHER}"
121 WriteRegDWord ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "NoModify" 1
122 WriteRegDWord ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "NoRepair" 1
123 SectionEnd
125 ; Section descriptions
126 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
127 !insertmacro MUI_DESCRIPTION_TEXT ${SEC01} "Main"
128 !insertmacro MUI_DESCRIPTION_TEXT ${SEC02} "Translations..."
129 !insertmacro MUI_FUNCTION_DESCRIPTION_END
132 Function un.onInit
133 !insertmacro MUI_UNGETLANGUAGE
134 FunctionEnd
136 Section Uninstall
137 !insertmacro MUI_STARTMENU_GETFOLDER "Application" $ICONS_GROUP
139 Delete "$SMPROGRAMS\$ICONS_GROUP\Uninstall.lnk"
140 Delete "$SMPROGRAMS\$ICONS_GROUP\Website.lnk"
141 Delete "$DESKTOP\Wammu.lnk"
142 Delete "$SMPROGRAMS\$ICONS_GROUP\Wammu.lnk"
144 RMDir "$SMPROGRAMS\$ICONS_GROUP"
145 RMDir /r /REBOOTOK "$INSTDIR"
147 DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
148 DeleteRegKey HKLM "${PRODUCT_DIR_REGKEY}"
149 SetAutoClose true
150 SectionEnd