]> Pileus Git - aweather/blob - aweather.nsi
Version bump for 0.5
[aweather] / aweather.nsi
1 !define MULTIUSER_EXECUTIONLEVEL Highest
2 !define MULTIUSER_MUI
3 !define MULTIUSER_INSTALLMODE_COMMANDLINE
4 !define MULTIUSER_INSTALLMODE_INSTDIR AWeather
5 !include "MultiUser.nsh"
6 !include "MUI2.nsh"
7
8 Function .onInit
9         !insertmacro MULTIUSER_INIT
10 FunctionEnd
11
12 Function un.onInit
13         !insertmacro MULTIUSER_UNINIT
14 FunctionEnd
15
16 name "AWeather"
17 !ifndef VERSION
18         !define VERSION LATEST
19 !endif
20 !ifdef USE_GTK
21         outFile "aweather-${VERSION}-gtk.exe"
22 !else
23         outFile "aweather-${VERSION}.exe"
24 !endif
25 installDir AWeather
26 Icon "data/aweather.ico"
27
28 !define MUI_ABORTWARNING
29
30 !insertmacro MUI_PAGE_LICENSE "COPYING"
31 !insertmacro MULTIUSER_PAGE_INSTALLMODE
32 !insertmacro MUI_PAGE_COMPONENTS
33 !insertmacro MUI_PAGE_DIRECTORY
34 !insertmacro MUI_PAGE_INSTFILES
35
36 !insertmacro MUI_UNPAGE_CONFIRM
37 !insertmacro MUI_UNPAGE_INSTFILES
38
39 !insertmacro MUI_LANGUAGE "English"
40
41 section "AWeather (required)" SecAWeather
42         SectionIn RO
43
44         setOutPath $INSTDIR
45         file /r build/*
46         !ifdef USE_GTK
47                 file /r gtk/*
48         !endif
49         
50         StrCmp $MultiUser.InstallMode "AllUsers" 0 +4
51                 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\AWeather" "DisplayName" "AWeather"
52                 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\AWeather" "UninstallString" "$INSTDIR\uninstaller.exe"
53         Goto +3
54                 WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\AWeather" "DisplayName" "AWeather"
55                 WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\AWeather" "UninstallString" "$INSTDIR\uninstaller.exe"
56
57         FileOpen $0 $INSTDIR\instmode.dat w
58         FileWrite $0 $MultiUser.InstallMode
59         FileClose $0
60         
61         writeUninstaller $INSTDIR\uninstaller.exe
62 sectionEnd
63 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
64 !insertmacro MUI_DESCRIPTION_TEXT ${SecAWeather} "AWeather core files."
65 !insertmacro MUI_FUNCTION_DESCRIPTION_END
66
67 Section "Desktop Icons"
68         setOutPath $INSTDIR\bin
69         CreateShortCut "$DESKTOP\AWeather.lnk" "$INSTDIR\bin\aweather.exe" "" "$INSTDIR\bin\aweather.exe" 0
70 SectionEnd
71
72 Section "Start Menu Shortcuts"
73         setOutPath $INSTDIR\bin
74         CreateDirectory "$SMPROGRAMS\AWeather"
75         CreateShortCut  "$SMPROGRAMS\AWeather\Uninstall AWeather.lnk" "$INSTDIR\uninstaller.exe"  "" "$INSTDIR\uninstaller.exe"  0
76         CreateShortCut  "$SMPROGRAMS\AWeather\AWeather.lnk"           "$INSTDIR\bin\aweather.exe" "" "$INSTDIR\bin\aweather.exe" 0
77         CreateShortCut  "$SMPROGRAMS\AWeather\AWeather (debug).lnk" "cmd.exe" "/K aweather-dbg.exe -d 7" "$INSTDIR\bin\aweather-dbg.exe" 0
78 SectionEnd
79
80 section "Uninstall"
81         FileOpen $0 $INSTDIR\instmode.dat r
82         FileRead $0 $1
83         FileClose $0
84
85         StrCmp $1 "AllUsers" 0 +4
86                 SetShellVarContext all
87                 DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\AWeather"
88         Goto +3
89                 SetShellVarContext current
90                 DeleteRegKey HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\AWeather"
91
92         delete $DESKTOP\AWeather.exe.lnk
93
94         rmdir /r $SMPROGRAMS\AWeather
95         rmdir /r $INSTDIR
96 sectionEnd