Typo
[gpg4win.git] / src / installer-finish.nsi
1 # installer-finish.nsi - Installer for GPG4Win.      -*- coding: latin-1; -*-
2 # Copyright (C) 2005, 2008 g10 Code GmbH
3
4 # This file is part of GPG4Win.
5
6 # GPG4Win is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 2 of the License, or
9 # (at your option) any later version.
10
11 # GPG4Win is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 # GNU General Public License for more details.
15
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software
18 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
19
20 Var MYTMP
21
22 # Last section is a hidden one.
23 Section
24   WriteUninstaller "$INSTDIR\${PACKAGE}-uninstall.exe"
25
26 !ifdef HAVE_STARTMENU
27   # Check if the start menu entries where requested.
28   !insertmacro MUI_INSTALLOPTIONS_READ $R0 "installer-options.ini" \
29         "Field 2" "State"
30   IntCmp $R0 0 no_start_menu_uninstall
31
32   # Create a shortcut named "new shortcut" in the start menu programs
33   # directory point the new shortcut at the program uninstaller
34   CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Uninstall.lnk" \
35     "$INSTDIR\${PACKAGE}-uninstall.exe" \
36     "" "$INSTDIR\${PACKAGE}-uninstall.exe" "" SW_SHOWNORMAL "" $(DESC_Menu_uninstall)
37   no_start_menu_uninstall:
38 !endif
39
40   # Windows Add/Remove Programs support
41   # Note that the version is appended to the DisplayName, despite that
42   # this is not necessary as a click on "support information" gives
43   # the version number.  Some tools do that, other don't.  I don't
44   # like it but others want me to do that.  -wk
45   StrCpy $MYTMP "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRETTY_PACKAGE_SHORT}"
46   WriteRegExpandStr HKLM $MYTMP "UninstallString" '"$INSTDIR\${PACKAGE}-uninstall.exe"'
47   WriteRegExpandStr HKLM $MYTMP "InstallLocation" "$INSTDIR"
48   WriteRegStr       HKLM $MYTMP "DisplayName"     "${PRETTY_PACKAGE} (${VERSION})"
49   WriteRegStr       HKLM $MYTMP "DisplayIcon"     "$INSTDIR\gpg.exe,0"
50   WriteRegStr       HKLM $MYTMP "DisplayVersion"  "${VERSION}"
51   WriteRegStr       HKLM $MYTMP "Publisher"       "The Gpg4win Project"
52   WriteRegStr       HKLM $MYTMP "URLInfoAbout"    "http://www.gpg4win.org/"
53   WriteRegDWORD     HKLM $MYTMP "NoModify"        "1"
54   WriteRegDWORD     HKLM $MYTMP "NoRepair"        "1"
55 SectionEnd
56
57
58 Section Uninstall
59
60 !ifdef HAVE_STARTMENU
61   # Make sure that the context of the automatic variables has been set to
62   # the "all users" shell folder.  This guarantees that the menu gets written
63   # for all users.  We have already checked that we are running as Admin; or
64   # we printed a warning that installation will not succeed.
65   SetShellVarContext all
66
67   #---------------------------------------------------
68   # Delete the menu entries and any empty parent menus
69   #---------------------------------------------------
70   !insertmacro MUI_STARTMENU_GETFOLDER Application $MYTMP
71   g4wihelp::config_fetch "inst_start_menu_folder"
72   StrCmp $R0 "" +2
73   StrCpy $MYTMP $R0
74   Delete "$SMPROGRAMS\$MYTMP\*.lnk"
75   Delete "$SMPROGRAMS\$MYTMP\$(DESC_Menu_manuals)\*.lnk"
76   RMDir "$SMPROGRAMS\$MYTMP\$(DESC_Menu_manuals)"
77
78   RMDir "$SMPROGRAMS\$MYTMP\$(DESC_Desktop_manuals)"
79   StrCpy $MYTMP "$SMPROGRAMS\$MYTMP"
80   startMenuDeleteLoop:
81     ClearErrors
82     RMDir $MYTMP
83     GetFullPathName $MYTMP "$MYTMP\.."
84     IfErrors startMenuDeleteLoopDone
85     StrCmp $MYTMP $SMPROGRAMS startMenuDeleteLoopDone startMenuDeleteLoop
86   startMenuDeleteLoopDone:
87
88   DeleteRegValue HKLM "Software\GNU\${PRETTY_PACKAGE_SHORT}" \
89         "Start Menu Folder"
90
91
92   # Delete Desktop links.
93 !ifdef HAVE_PKG_WINPT
94   Delete "$DESKTOP\WinPT.lnk"
95 !endif
96 !ifdef HAVE_PKG_GPA
97   Delete "$DESKTOP\GPA.lnk"
98 !endif
99 !ifdef HAVE_PKG_KLEOPATRA
100   Delete "$DESKTOP\Kleopatra.lnk"
101 !endif
102 !ifdef HAVE_PKG_SYLPHEED_CLAWS
103   Delete "$DESKTOP\Sylpheed-Claws.lnk"
104   Delete "$DESKTOP\Sylpheed-Claws Manual.lnk" \
105   # We better delete also the name we used prior to 1.0.3
106   Delete "$DESKTOP\Sylpheed.lnk"
107 !endif
108 !ifdef HAVE_PKG_CLAWS_MAIL
109   Delete "$DESKTOP\Claws-Mail.lnk"
110   Delete "$DESKTOP\$(DESC_Desktop_manuals)\Claws-Mail Manual.lnk"
111 !endif
112 !ifdef HAVE_PKG_COMPENDIUM_DE
113   Delete "$DESKTOP\$(DESC_Desktop_manuals)\$(DESC_Name_compendium_de_html).lnk"
114   Delete "$DESKTOP\$(DESC_Desktop_manuals)\$(DESC_Name_compendium_de).lnk"
115 !endif
116 !ifdef HAVE_PKG_MAN_NOVICE_DE
117   Delete "$DESKTOP\$(DESC_Desktop_manuals)\$(DESC_Name_man_novice_de).lnk"
118 !endif
119 !ifdef HAVE_PKG_MAN_NOVICE_EN
120   Delete "$DESKTOP\$(DESC_Desktop_manuals)\$(DESC_Name_man_novice_en).lnk"
121 !endif
122 !ifdef HAVE_PKG_MAN_ADVANCED_DE
123   Delete "$DESKTOP\$(DESC_Desktop_manuals)\$(DESC_Name_man_advanced_de).lnk"
124 !endif
125 !ifdef HAVE_PKG_GPGEE
126   Delete "$DESKTOP\$(DESC_Desktop_manuals)\GPGee Manual.lnk"
127 !endif
128   Delete "$DESKTOP\$(DESC_Desktop_manuals)\GnuPG FAQ.lnk"
129   Delete "$DESKTOP\$(DESC_Desktop_manuals)\Gpg4Win README.lnk"
130   RMDir "$DESKTOP\$(DESC_Desktop_manuals)"
131
132   # Delete Quick Launch Bar links.
133   StrCmp $QUICKLAUNCH $TEMP no_quick_launch_uninstall
134 !ifdef HAVE_PKG_WINPT
135   Delete "$QUICKLAUNCH\WinPT.lnk"
136 !endif
137 !ifdef HAVE_PKG_GPA
138   Delete "$QUICKLAUNCH\GPA.lnk"
139 !endif
140 !ifdef HAVE_PKG_KLEOPATRA
141   Delete "$QUICKLAUNCH\Kleopatra.lnk"
142 !endif
143 !ifdef HAVE_PKG_SYLPHEED_CLAWS
144   Delete "$QUICKLAUNCH\Sylpheed-Claws.lnk"
145   # We better delete also the name we used prior to 1.0.3
146   Delete "$QUICKLAUNCH\Sylpheed.lnk"
147 !endif
148 !ifdef HAVE_PKG_CLAWS_MAIL
149   Delete "$QUICKLAUNCH\Claws-Mail.lnk"
150 !endif
151 !ifdef HAVE_PKG_COMPENDIUM_DE
152   Delete "$QUICKLAUNCH\$(DESC_Name_compendium_de).lnk"
153 !endif
154 !ifdef HAVE_PKG_MAN_NOVICE_DE
155   Delete "$QUICKLAUNCH\$(DESC_Name_man_novice_de).lnk"
156 !endif
157 !ifdef HAVE_PKG_MAN_ADVANCED_DE
158   Delete "$QUICKLAUNCH\$(DESC_Name_man_advanced_de).lnk"
159 !endif
160 !ifdef HAVE_PKG_GPGEE
161   Delete "$QUICKLAUNCH\GPGee Manual.lnk"
162 !endif
163   Delete "$QUICKLAUNCH\GnuPG FAQ.lnk"
164   Delete "$QUICKLAUNCH\Gpg4Win README.lnk"
165 no_quick_launch_uninstall:
166
167 !endif
168
169   Delete "$INSTDIR\${PACKAGE}-uninstall.exe"
170   RMDir "$INSTDIR"
171
172   # If we installed in the default location, try to be really, really
173   # nice with sugar on it to clean up behind us.  In any case, try very
174   # hard to get rid of directories which could have REBOOTOK files.
175   RMDir /REBOOTOK "$INSTDIR\bin"
176   RMDir /REBOOTOK "$INSTDIR"
177   StrCmp "$INSTDIR" "$PROGRAMFILES\GNU\${INSTALL_DIR}" 0 +2
178   RMDir /REBOOTOK "$PROGRAMFILES\GNU"
179
180   # Clean the registry.
181   DeleteRegValue HKLM "Software\GNU\${PRETTY_PACKAGE_SHORT}" \
182         "Install Directory"
183   DeleteRegKey /ifempty HKLM "Software\GNU\${PRETTY_PACKAGE_SHORT}"
184   DeleteRegKey /ifempty HKLM "Software\GNU\GnuPG"
185   DeleteRegKey /ifempty HKLM "Software\GNU"
186
187   # Remove Windows Add/Remove Programs support.
188   DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRETTY_PACKAGE_SHORT}"
189 SectionEnd